Logo Lanfrica

jeasonangel/cameroon-census-api

Domain:

socioeconomic

Record type:

software
Creator:
jea
Host:
Design, implementation of a complete Cameroon Census Data API Environment on the Cloud. Unlike existing systems in Cameroon (ANADOC, CamSED, INS Open Data, BUCREP) which offer only static PDFs and web portals for human consultation, our environment provides # Cameroon Census Data API RESTful API providing access to Cameroonian census data for NGOs, researchers, and journalists. ## Stack - Node.js + Express + TypeScript - PostgreSQL 14+ with PostGIS extension - Redis 6+ - API-key authentication (bcrypt-hashed, `X-API-Key` header) ## Quick Start ```bash # 1. Install dependencies npm install # 2. Configure environment cp .env.example .env # edit .env to point to your Postgres + Redis # 3. Make sure PostGIS is installed in your Postgres database psql -d cameroon_census -c "CREATE EXTENSION IF NOT EXISTS postgis;" # 4. Run migrations (creates all tables) npm run migrate # 5. Seed fictitious data (regions, indicators, data values, admin user) npm run seed # 6. Start dev server npm run dev ``` The seed script prints the bootstrap admin API key — save it. You can also log in via `POST /api/v1/auth/login` with the credentials from `.env`. ## Deployment Build: `npm run build`. Start: `npm start`. Works on Render, Railway, Fly, AWS ECS, or any Node host that can reach a Postgres-with-PostGIS instance and a Redis instance. Set the env vars from `.env.example` in the host's dashboard. ## Endpoints See full route map in the original spec. All routes except `/auth/register` and `/auth/login` require `X-API-Key: ` header. ### Auth - `POST /api/v1/auth/register` - `POST /api/v1/auth/login` - `POST /api/v1/auth/keys` (auth) - `GET /api/v1/auth/keys` (auth) - `DELETE /api/v1/auth/keys/:keyId` (auth) - `GET /api/v1/auth/usage` (auth) ### Geography - `GET /api/v1/geography/regions` - `GET /api/v1/geography/regions/:regionCode/departments` - `GET /api/v1/geography/departments/:departmentCode/districts` - `GET /api/v1/geography/districts/:districtCode/villages` - `GET /api/v1/geography/search?q=...` ### Data - `GET /api/v1/data?geography=...&indicator=...&year=...` - `GET /api/v1/indicators` - `GET /api/v1/export?geography=...&indicator=...&year=...&format=csv` ### Admin (ADMI …