Skip to content

feat: vibenet stack — faucet, explorer, landing (Next.js port)#165

Draft
chunter-cb wants to merge 4 commits into
masterfrom
feat/vibenet-routing
Draft

feat: vibenet stack — faucet, explorer, landing (Next.js port)#165
chunter-cb wants to merge 4 commits into
masterfrom
feat/vibenet-routing

Conversation

@chunter-cb
Copy link
Copy Markdown

Summary

Ports the vibenet stack from base/base (Rust/nginx) into this Next.js app.

  • Landing page (vibes.base.org/) — reads config.json + contracts.json from mounted volumes, chain connect card, wallet add
  • Faucet (faucet.vibes.base.org/faucet) — ETH drip + USDV mint via viem, per-IP/address in-memory rate limiting matching Rust cooldown semantics
  • Block explorer (explorer.vibes.base.org/explorer) — SQLite-backed (same schema as vibescan Rust crate), address activity index, backfill + live newHeads subscription
  • Background indexer (scripts/indexer.mjs) — runs alongside Next.js in Docker via scripts/start.sh
  • Subdomain routing (src/proxy.ts) — faucet.* and explorer.* rewrite to /faucet and /explorer paths
  • TIPS pages moved to /tips to free the root for vibenet landing
  • Dockerfile updated: self-contained build context (no ui/ prefix), starts indexer + server

Architecture decisions

  • Nginx removed — Next.js serves all UI; WebSocket RPC exposed directly from base-client; Grafana on its own port
  • better-sqlite3 (native, synchronous) used for SQLite in API routes — correct for a single-instance devnet
  • Rate limiting is module-level in-memory state (resets on restart — intentional for devnet)

Test plan

  • TypeScript: npx tsc --noEmit — clean
  • Biome: npx @biomejs/biome check src/ — clean
  • Dev server: all routes (/, /faucet, /explorer, /tips) return 200
  • Explorer stats API returns {"blocks":0,"txs":0,"addresses":0} (SQLite schema init works)
  • Contracts API returns {} gracefully when no volume mounted
  • End-to-end against running devnet (needs just vibe from base/base)
  • Faucet drip with real funded account
  • Explorer indexer picks up blocks after just vibe

Follow-up needed in base/base

Update etc/vibenet/docker-compose.vibenet.yml to:

  • Replace vibenet-faucet + vibescan services with next-app (builds from ../../ui)
  • Remove nginx-gateway service
  • Expose base-client:8546 port directly for WebSocket RPC
  • Add optional Caddy overlay for production TLS/subdomain routing

🤖 Generated with Claude Code

chunter-cb and others added 4 commits May 14, 2026 13:51
Ports the vibenet Rust/nginx stack to this Next.js app:

- Landing page (/) with chain info, features, contracts
- Faucet page + API routes (/faucet, /api/vibenet/faucet/*)
  using viem for signing, in-memory rate limiting per IP/address
- Block explorer pages + API routes (/explorer/*, /api/vibenet/explorer/*)
  backed by better-sqlite3 (same schema as vibescan Rust crate)
- Background indexer script (scripts/indexer.mjs) that backfills and
  subscribes to newHeads via WebSocket
- Subdomain routing via proxy.ts:
  faucet.vibes.base.org → /faucet, explorer.vibes.base.org → /explorer
- TIPS pages moved to /tips to free up root for vibenet landing
- Dockerfile updated: self-contained build context, starts both
  Next.js server and background indexer

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
better-sqlite3 prepare() rejects SQL with multiple statements.
Replace wipeAll prepared statement with a wipeDb() function
that uses db.exec() which handles multi-statement SQL correctly.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- Switch Dockerfile from bun to npm (bun.lock lacked better-sqlite3)
- Add apk build tools (python3/make/g++) for better-sqlite3 native compile
- Add .dockerignore to exclude node_modules/.next/tmp from build context
- Fix proxy.ts: skip /api/* paths in subdomain rewrites so API routes
  work correctly when called from faucet/explorer subdomains

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
next start (non-standalone) + full node_modules lets indexer.mjs resolve
viem and better-sqlite3 without special packaging. For a devnet image the
extra layer size is not a concern.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant