A TypeScript/Express backend for a finance dashboard with role-based access control, record management, filtering, pagination, and summary analytics.
- TypeScript backend architecture
- Express routing, controllers, services, and middleware
- Prisma ORM with SQLite for local development
- Zod request validation
- Role-based access control for admin, analyst, and viewer workflows
- Node.js
- TypeScript
- Express
- Prisma
- SQLite
- Zod
- Create and manage users
- Enforce role-based permissions
- Create, update, filter, paginate, and delete finance records
- Calculate dashboard totals for income, expense, net balance, and category breakdowns
- Centralized Prisma client and validation schemas
ADMIN - manage users, create/update/delete records, view dashboard
ANALYST - create and update records, view dashboard
VIEWER - read-only access
npm installCreate .env:
DATABASE_URL="file:./dev.db"
Run migrations:
npx prisma migrate dev --name initStart the API:
npm run devBuild:
npm run buildPOST /users
GET /users
GET /users/:id
PATCH /users/:id/status
POST /records
GET /records
PATCH /records/:id
DELETE /records/:id
GET /records/dashboard
Authentication is mocked so the authorization flow can be tested without a login provider. For production, replace mockAuth with JWT/session authentication and derive the user from a signed token.