A real-world style API for city-wide and user-specific transaction analytics.
✅ Built with Node.js + Express + TypeScript + Prisma
✅ Powered by PostgreSQL (via Docker)
✅ Features Swagger docs, Postman collection, and Jest tests
- Upload transaction data via CSV
- Generate city-level spend reports (with optional date filters)
- Generate user-specific reports (with merchant/category breakdowns)
- OpenAPI (Swagger) documentation at
/docs - Postman collection included in repo
- Seed realistic data with Faker
- Ready for Docker + GitHub Actions CI
git clone https://github.com/yourname/cityspender-api.git
cd cityspender-api
npm installdocker-compose up -dnpx prisma migrate dev --name init
npx prisma generate
npx ts-node scripts/seed.tsnpx ts-node-dev src/index.tsAccess Swagger UI at http://localhost:3000/docs
| Method | Endpoint | Description |
|---|---|---|
POST |
/transactions/upload |
Upload transactions CSV |
GET |
/report/city |
City-wide report (supports start, end) |
GET |
/report/user/:user_id |
User-specific report |
npm run test- Swagger UI
- Import
CitySpender.postman_collection.jsonin Postman
version: '3.8'
services:
db:
image: postgres:15
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: cityspender
ports:
- '5432:5432'
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:- Node.js + Express + TypeScript
- PostgreSQL + Prisma
- Docker (Postgres DB)
- Jest + Supertest
- Swagger + Postman
MIT