Contributing New Features
Adding a feature end-to-end means touching the database schema, API, and frontend. Here's how the pieces fit together.
The data pipelineβ
Every feature follows this path:
Schema (api/_db.ts)
β API endpoint (api/*.ts)
β API client (src/lib/api.ts)
β React Query hook (src/hooks/useProjects.ts)
β Component (src/components/ or src/pages/)
Adding an API endpointβ
Each serverless function is a single file in api/. Create a new file:
// api/my-endpoint.ts
import type { VercelRequest, VercelResponse } from '@vercel/node';
import { getDb, projects } from './_db';
export default async function handler(req: VercelRequest, res: VercelResponse) {
const db = getDb();
// your logic here
return res.json({ data: result });
}
If your endpoint needs admin access, check the auth header:
const password = req.headers['x-admin-password'];
const token = req.headers['x-admin-token'];
if (password !== process.env.ADMIN_PASSWORD && token !== process.env.ADMIN_TOKEN) {
return res.status(401).json({ error: 'Unauthorized' });
}
Adding a database fieldβ
- Add the column to the table definition in
api/_db.ts - Run
pnpm db:pushto apply the schema change to your local database - Update types in
src/types/ecosystem.tsif needed
Wiring up the frontendβ
- Add a fetch function in
src/lib/api.ts - Create or extend a hook in
src/hooks/useProjects.ts - Use the hook in your component
API endpoints & database schemaβ
See the README for the full project structure, and check api/_db.ts for the current schema. All endpoints live in api/ β one file per endpoint. Admin endpoints require x-admin-password or x-admin-token headers.