How base/web works
Project type and purpose
• This is a monorepo full-stack web application (“Base Web”) built with Next.js (React), serving both static/SSR content and API routes.
• It presents the Base Ethereum L2 ecosystem website and supports on-chain interactions (name registration, NFTs, proofs) via Next.js API handlers.
• It includes two apps (apps/web, apps/bridge) and a shared component library (libs/base-ui).
File structure
• Root: Yarn workspaces manage multiple packages (apps, libs, tools).
• apps/web: Next.js front-end + API routes + SSR pages + e2e & unit tests + CI config + Dockerfile + public assets.
• apps/bridge: presumably a separate micro-app (lighter).
• libs/base-ui: shared UI components used by apps.
• utils & scripts: deployment, CI, Docker, build pipelines.
• Config: tsconfig, eslint, prettier at root and per-workspace.
README
• Confirms it’s the Base.org website: Next.js, Yarn workspaces, run via yarn workspace @app/web dev.
• No separate backend service—Next.js API routes handle server logic.
• On-chain interactions use ethers/ABI definitions and JSON-RPC calls to Ethereum L2.
a. Main components
1. Client (Browser/Mobile): React pages & static assets
2. Next.js Server: SSR renderer + API routes
3. Datastores:
• Key-Value store (KV) for caching/proofs
• PostgreSQL for persistent records (registrations, metadata)
4. Ethereum L2 network: RPC endpoints (Optimism) for on-chain reads/writes
5. External services:
• Cloudinary/Pinata (media upload)
• Analytics (Datadog, Bugsnag)
• CDN (serving /public assets)
6. Monorepo tooling: Yarn Workspaces, CI (Buildkite, GitHub Actions), Docker
b. Relationships and interactions
• Browser → Next.js:
• HTTP GET for pages (SSR/static)
• HTTP POST to /api/* routes
• Next.js API routes → Datastores: read/write via imported KV and Postgres clients
• Next.js API routes → Ethereum RPC: calls via ethers.js/ABI layer to L2 nodes
• Next.js → External media: generate Cloudinary URLs, Pinata uploads via helper utils
• CI pipelines → GitHub Actions/Buildkite trigger builds & Docker image publication
c. Architectural patterns/design principles
• Monorepo & Workspaces: isolate apps and shared libs with strict boundaries
• Serverless-style API: Next.js API routes run in edge/node handlers
• SSR + Static Generation: Next.js pages choose SSG or SSR for SEO/performance
• Shared design system: libs/base-ui for reusable UI components
• Layered separation: UI components ↔ data hooks ↔ API handlers ↔ blockchain & DB
d. Key technologies
• Next.js (React, SSR, API routes)
• Node.js, TypeScript
• Ethers.js + ABI JSON for blockchain calls
• PostgreSQL & KV store (likely Redis/Cloudflare KV) via custom datastores utils
• Cloudinary, Pinata for media
• Yarn 3 Workspaces, Docker, GitHub Actions, Buildkite
Detail recommendations
• API endpoints categories (registry, proofs, auth, health).
• Shared libs/base-ui as part of the build pipeline feeding into the frontend bundle.
• CI/CD: code in Git → Yarn build → Docker image → Deployment.