Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,3 @@ jobs:

- name: Build
run: bun run build
env:
VITE_POSTGREST_URL: https://yaci-explorer-apis.fly.dev
VITE_CHAIN_REST_ENDPOINT: https://api.republicai.io
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,3 @@ jobs:

- name: Build
run: bun run build
env:
VITE_POSTGREST_URL: https://yaci-explorer-apis.fly.dev
VITE_CHAIN_REST_ENDPOINT: https://api.republicai.io
5 changes: 0 additions & 5 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ jobs:
app = "$PREVIEW_APP"
primary_region = "sjc"

[build]
[build.args]
VITE_POSTGREST_URL = "https://yaci-explorer-apis.fly.dev"
VITE_CHAIN_REST_ENDPOINT = "https://api.republicai.io"

[http_service]
internal_port = 80
force_https = true
Expand Down
57 changes: 49 additions & 8 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,20 @@ fly secrets set YACI_POSTGRES_DSN="postgres://..." YACI_GRPC_ENDPOINT="..."
# Explorer
cd /path/to/yaci-explorer
fly launch --name yaci-explorer
fly secrets set VITE_POSTGREST_URL="https://..."

# Configure frontend via config.json
cat > config.json << EOF
{
"apiUrl": "https://your-postgrest-url.fly.dev",
"chainRestEndpoint": "https://api.yourchain.io",
"evmEnabled": true,
"ibcEnabled": true,
"appName": "My Explorer"
}
EOF

# Copy config to deployed container
fly ssh console -C "cat > /usr/share/nginx/html/config.json" < config.json
```

## Reverse Proxy
Expand Down Expand Up @@ -97,11 +110,37 @@ server {

## Configuration

### Environment Variables
### Frontend Configuration (config.json)

Frontend configuration is provided at runtime via `config.json` instead of build-time environment variables.

**Create config.json:**
```bash
cp public/config.json.example public/config.json
# Edit config.json with your settings
```

**Key settings:**
- `apiUrl`: PostgREST endpoint URL (required)
- `chainRestEndpoint`: Chain REST API for IBC denom resolution (optional)
- `evmEnabled`: Enable/disable EVM features
- `ibcEnabled`: Enable/disable IBC features
- `appName`: Custom application name
- `branding`: Logo URLs, colors, footer text
- `links`: Website, docs, social media links

**Docker deployment:**
```bash
# Mount config.json as volume
docker run -v ./config.json:/usr/share/nginx/html/config.json ...

**Frontend (.env):**
- `VITE_POSTGREST_URL`: PostgREST endpoint (default: /api for production, http://localhost:3000 for dev)
- `VITE_CHAIN_REST_ENDPOINT`: Chain REST API for IBC denom resolution (optional)
# Or copy to running container
docker cp config.json container:/usr/share/nginx/html/config.json
```

See `public/config.json.example` for all available options.

### Backend Configuration (.env)

**Docker/Backend:**
- `CHAIN_GRPC_ENDPOINT`: gRPC endpoint of chain (required)
Expand All @@ -111,9 +150,11 @@ server {

### EVM Support

Enable per-chain in `src/config/chains.ts`:
```typescript
features: { evm: true }
Enable via config.json:
```json
{
"evmEnabled": true
}
```

### Prometheus Metrics
Expand Down
22 changes: 20 additions & 2 deletions OPERATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,27 @@ BATCH_SIZE=100 # Transactions per batch (default: 100)

#### Frontend Configuration

Frontend configuration is provided at runtime via `config.json`:

```json
{
"apiUrl": "https://yaci-explorer-apis.fly.dev",
"chainRestEndpoint": "https://rest.example.com",
"evmEnabled": true,
"ibcEnabled": true,
"appName": "My Explorer"
}
```

Deploy config.json to container:
```bash
VITE_POSTGREST_URL=https://yaci-explorer-apis.fly.dev
VITE_CHAIN_REST_ENDPOINT=https://rest.example.com # For IBC denom resolution
# Mount as volume in fly.toml
[mounts]
source = "config"
destination = "/usr/share/nginx/html/config.json"

# Or copy after deployment
fly ssh console -C "cat > /usr/share/nginx/html/config.json" < config.json
```

### Database Schema Architecture
Expand Down
66 changes: 66 additions & 0 deletions panda.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,74 @@ export default defineConfig({
},
],

patterns: {
extend: {
// Stat row - compact label/value display
statRow: {
description: 'A compact stat display with label and value',
transform() {
return {
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
py: '2',
px: '3',
borderRadius: 'md',
border: '1px solid',
borderColor: 'border.default',
bg: 'bg.subtle',
}
},
},
// List item with hover effect
listItem: {
description: 'A list item with hover accent border',
transform() {
return {
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
w: 'full',
py: '3',
borderBottomWidth: '1px',
borderColor: 'border.default',
transition: 'all 0.2s',
_hover: {
borderLeftWidth: '2px',
borderLeftColor: 'accent.default',
pl: '2',
bg: 'bg.accentSubtle',
},
_last: { borderBottomWidth: '0' },
}
},
},
// Section header - title with optional action
sectionHeader: {
description: 'A section header with space-between layout',
transform() {
return {
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
mb: '4',
}
},
},
},
},

theme: {
extend: {
tokens: {
sizes: {
'icon.xs': { value: '0.75rem' },
'icon.sm': { value: '1rem' },
'icon.md': { value: '1.25rem' },
'icon.lg': { value: '1.5rem' },
'icon.xl': { value: '2rem' },
},
},
semanticTokens: {
colors: {
chart: {
Expand Down
64 changes: 64 additions & 0 deletions public/config.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"apiUrl": "/api",
"chainRestEndpoint": "",
"evmRpcEndpoint": "",
"evmEnabled": true,
"ibcEnabled": true,
"wasmEnabled": false,
"appName": "Block Explorer",
"appNameShort": "Explorer",
"queries": {
"staleTimeMs": 10000,
"gcTimeMs": 300000
},
"dashboard": {
"refetchIntervalMs": 6000,
"itemCount": 5
},
"transactions": {
"pageSize": 10
},
"blocks": {
"pageSize": 10
},
"search": {
"addressResultLimit": 20,
"autoNavigateSingle": true
},
"analytics": {
"transactionVolumeHours": 24,
"transactionVolumeRefetchMs": 60000,
"messageSampleLimit": 10000,
"messageTopN": 10,
"messageRefetchMs": 60000,
"eventSampleLimit": 10000,
"eventTopN": 10,
"eventRefetchMs": 60000,
"blockIntervalLookback": 100,
"blockIntervalRefetchMs": 30000,
"blockIntervalMaxSeconds": 100,
"networkBlocksWindow": 100,
"networkTxWindow": 1000,
"networkMessageWindow": 2000,
"networkRefetchMs": 10000
},
"resetNotice": {
"enabled": true,
"refetchIntervalMs": 30000,
"hashCheckHeight": 5
},
"branding": {
"logoUrl": "",
"faviconUrl": "",
"primaryColor": "",
"accentColor": "",
"footerText": ""
},
"links": {
"website": "",
"docs": "",
"github": "",
"discord": "",
"twitter": ""
}
}
32 changes: 23 additions & 9 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ if [ "$deploy_type" != "3" ]; then
fi

if [ "$deploy_type" = "3" ]; then
prompt VITE_POSTGREST_URL "PostgREST API URL" "http://localhost:3000"
prompt API_URL "PostgREST API URL" "http://localhost:3000"
prompt CHAIN_REST_ENDPOINT "Chain REST endpoint (optional)" ""
fi

# Optional config
Expand All @@ -85,7 +86,6 @@ if [[ "$advanced" =~ ^[Yy]$ ]]; then
prompt POSTGRES_USER "PostgreSQL user" "postgres"
prompt POSTGRES_DB "PostgreSQL database" "yaci"
prompt YACI_MAX_CONCURRENCY "Yaci max concurrency" "100"
prompt VITE_CHAIN_REST_ENDPOINT "Chain REST endpoint (for IBC)" ""
fi

# Save configuration
Expand All @@ -100,19 +100,29 @@ CHAIN_GRPC_ENDPOINT=${CHAIN_GRPC_ENDPOINT:-localhost:9090}
POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-changeme}
POSTGRES_USER=${POSTGRES_USER:-postgres}
POSTGRES_DB=${POSTGRES_DB:-yaci}
VITE_POSTGREST_URL=${VITE_POSTGREST_URL:-/api}
EOF

if [ -n "$YACI_MAX_CONCURRENCY" ]; then
echo "YACI_MAX_CONCURRENCY=$YACI_MAX_CONCURRENCY" >> .env
fi

if [ -n "$VITE_CHAIN_REST_ENDPOINT" ]; then
echo "VITE_CHAIN_REST_ENDPOINT=$VITE_CHAIN_REST_ENDPOINT" >> .env
fi

echo -e "${GREEN}Configuration saved to .env${NC}"

# Create config.json for frontend-only deployment
if [ "$deploy_type" = "3" ]; then
echo -e "${YELLOW}Creating frontend config.json...${NC}"
cat > public/config.json << EOF
{
"apiUrl": "${API_URL}",
"chainRestEndpoint": "${CHAIN_REST_ENDPOINT:-}",
"evmEnabled": true,
"ibcEnabled": true,
"appName": "Block Explorer"
}
EOF
echo -e "${GREEN}Frontend configuration saved to public/config.json${NC}"
fi

# Execute deployment
echo ""
case $deploy_type in
Expand Down Expand Up @@ -270,15 +280,19 @@ EOF
fi

npm install
VITE_POSTGREST_URL="$VITE_POSTGREST_URL" npm run build
npm run build

echo ""
echo -e "${GREEN}Build complete!${NC}"
echo ""
echo "Configuration: public/config.json has been created"
echo ""
echo "To run locally:"
echo " npx serve -s build/client -l 3001"
echo ""
echo "For production, copy build/client to your web server"
echo "For production:"
echo " 1. Copy build/client to your web server"
echo " 2. Ensure config.json is accessible at /config.json"
;;

*)
Expand Down
Loading