How dpgalliance/publicgoods-submission works
Project Type and Purpose
• This is a Next.js–based web application (“webapp”) that renders and serves a dynamic, JSON-schema–driven submission form.
• Its goal is to collect nomination data for the Digital Public Goods Registry via a custom form UI (using Data Driven Forms), hosted and server-rendered on Vercel.
File-Structure Analysis
• Top level:
• .gitmodules – indicates use of one or more submodules (e.g., shared schema repo)
• README.md, LICENSE, CODE_OF_CONDUCT.md, BUGS.md – project docs and governance
• webapp/ – Next.js application containing pages/, components/, API routes, public/ assets, and likely a schemas/ folder
• pages/ – React pages (including form page and API routes under pages/api/)
• components/ – form fields, layout, wrappers
• schemas/ – schema.js JSON definitions for Data Driven Forms
• next.config.js, package.json, tsconfig.json – build and deployment configs
README Insights
• Core stack: Next.js (SSR/SSG + API routes) and Data Driven Forms (for runtime form rendering)
• Deployment: Vercel (leverages serverless functions for API endpoints and global CDN for static assets)
• Schema-driven: The entire form is driven by a JSON schema (no hard-coded form fields)
Main Components
a. Client Tier
• Browser / User Agent
• Static assets served (JS bundles, CSS, images) via Vercel CDN
b. Presentation & Application Tier
• Next.js Frontend (React)
• Server-side rendering (SSR) or static-site generation (SSG) for initial form page
• Client-side hydration for interactive form wizard
• Data Driven Forms Renderer
• Consumes JSON schema (schemas/schema.js)
• Renders form fields dynamically
• Next.js API Routes (serverless functions)
• Endpoint to receive form submissions (POST /api/submit)
c. Data & Integration Tier
• JSON Schema Store (in-repo or submodule)
• External Registry Service or Database (where nominations are persisted)
• May call a third-party API or write to a storage layer (not shown in repo, but include a placeholder)
d. Infrastructure & DevOps
• Vercel Platform
• Global CDN for static assets
• Serverless function hosting for API routes
• Git + Git Submodule (for shared schema)
Relationships & Data Flows
1. User ➔ Browser requests “/submission”
2. Browser ➔ Vercel CDN edge ➔ Next.js serverless (SSR) or static asset
3. Next.js ➔ Loads JSON schema (local file or submodule)
4. Browser renders dynamic form via Data Driven Forms
5. User fills form & submits ➔ POST to /api/submit (Next.js API route)
6. API route processes payload ➔ Forwards to external registry API or persistence layer
7. API returns success/failure ➔ Browser displays confirmation
Architectural Patterns & Design Principles
• Hybrid SSR/SSG: balances SEO and dynamic capabilities
• Schema-driven UI: single source of truth for form definition
• Serverless functions: on-demand backend without dedicated servers
• Monorepo/submodule for schema reuse