Skip to content

Gokul0912/finance-records-api

Repository files navigation

Finance Records API

A TypeScript/Express backend for a finance dashboard with role-based access control, record management, filtering, pagination, and summary analytics.

What This Demonstrates

  • 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

Tech Stack

  • Node.js
  • TypeScript
  • Express
  • Prisma
  • SQLite
  • Zod

Features

  • 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

Roles

ADMIN   - manage users, create/update/delete records, view dashboard
ANALYST - create and update records, view dashboard
VIEWER  - read-only access

Run Locally

npm install

Create .env:

DATABASE_URL="file:./dev.db"

Run migrations:

npx prisma migrate dev --name init

Start the API:

npm run dev

Build:

npm run build

API Overview

POST   /users
GET    /users
GET    /users/:id
PATCH  /users/:id/status

POST   /records
GET    /records
PATCH  /records/:id
DELETE /records/:id
GET    /records/dashboard

Current Limitation

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.

About

TypeScript Express API for finance records, RBAC, filtering, and dashboard analytics.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors