DEV Community

Emanuele Licata
Emanuele Licata

Posted on

Building an Expenses Tracker API with NestJS — Back at It After a Break

So I've been sitting on this project for a while.

I started building an expenses tracker API a few months back, then uni got in the way and I kind of abandoned it. Classic. Now I'm picking it up again and I figured — why not document the journey publicly this time?

What it is

A REST API for tracking personal expenses. Built with NestJS and PostgreSQL, using Prisma as ORM and Argon2 for password hashing.

The idea is to make it production-ready — not just "it works on my machine" quality. JWT auth, Redis caching, Docker, Swagger docs, proper test coverage. The kind of backend you'd actually want to maintain.

Also, I'll be honest: it's intentionally over-engineered for a personal finance app. The goal is the architecture, not the app itself. Portfolio project.

Where it is right now

Early stage. Like, early early.

What's working:

  • POST /auth/signup — registers a user, hashes password with Argon2, stores in Postgres via Prisma
  • POST /auth/signin — validates credentials, returns... a stub message for now 😅
  • Global ValidationPipe with whitelist — strips unexpected fields before they hit the service layer
  • Duplicate email detection with a proper error response
  • Docker Compose for the local dev database

What's not working yet:

  • JWT — the signin endpoint exists but doesn't return a token yet. @nestjs/jwt isn't even installed. Next thing on the list.
  • Basically everything else (expenses CRUD, categories, stats, budget tracking, Redis, CSV export...)

The stack

NestJS v11 + TypeScript
PostgreSQL 16
Prisma v5
Argon2
Docker Compose
Jest + Supertest (tests: zero, for now)
Enter fullscreen mode Exit fullscreen mode

What's next

The immediate goal is finishing the auth flow — JWT access + refresh tokens, guards on protected routes, logout with token blacklist in Redis. Once that's solid I'll move on to the expenses CRUD.

I'll try to post updates as I go. No promises on frequency though, still a student.


If you've built something similar, I'd love to hear how you structured the auth module or whether you'd do anything differently with the stack. And if you're also working on a portfolio backend project — drop it in the comments, curious to see what others are building.

Repo:

Expenses Tracker API

A personal finance tracking API built with NestJS and PostgreSQL. Designed both as a practical tool for managing personal expenses and as a showcase of serious backend architecture patterns.

Tech Stack






































Layer Technology
Backend NestJS (v11)
Database PostgreSQL 16
ORM Prisma (v5)
Auth JWT + Argon2
Frontend (planned)
Next.js / React
Caching (planned)
Redis
Deployment Docker + VPS

Features

Implemented

  • User registration (POST /auth/signup) with email/password validation
  • Password hashing with Argon2
  • Duplicate email detection — Prisma P2002 → 403 ForbiddenException
  • User signin (POST /auth/signin) — credential lookup + Argon2 verify
  • Global ValidationPipe with whitelist (strips unexpected fields)
  • Prisma ORM integration with PostgreSQL
  • Database schema: users and expenses tables with relations
  • Expense table indexes on userId and date for query performance
  • Docker Compose setup for local development database
  • Empty module scaffolding: UserModule, ExpenseModule

In Progress

  • JWT access token returned on signin (@nestjs/jwt




Top comments (0)