Skip to content
Back to all projects

Full-stack

PawTrack

A multi-clinic system that keeps a vet practice's pet records, appointments, stock and invoices together. Scanning a pet's QR code opens its profile. It is a Spring Boot modular monolith with a Next.js front end; the backend modules are in place and the web screens are still being written.

Problem

On the clinic side, customer and pet records, appointments, visit history, drug stock and the till often live in separate places. The complaints I listed in the PawTrack product document (PRD) all lead to the same point: a pet's history is slow to reach, stock is counted by hand, and invoices are not tied to the work that was done. The goal here is to have these pieces connected in one system. A pet's QR code is scanned, its profile opens, a visit is recorded, and a stock item can be added to the invoice as a line. Because several clinics will share the system, one clinic must never see another clinic's data, and that turned out to be the hard part.

Highlights

  • Multi-tenancy: the clinic arrives in the X-Clinic-Id header and is placed in a TenantContext; TenantAccessService checks that the user is an active member of that clinic, and queries are scoped by clinic id.
  • The QR code carries a random 32 byte token and only its HMAC-SHA256 digest is stored. Generating a new QR revokes the old one, and every generate, scan and revoke lands in the audit log.
  • Stock movements (purchase, return, adjustment, sale, use in a visit, expiry) are applied under a row lock, and a movement that would take the stock below zero is rejected.
  • Invoice lines can point at a stock item; the invoice number is generated on the server and payments are kept as separate records.
  • Account security: JWT with refresh tokens, a validator that refuses to start the application with a weak JWT_SECRET outside the local environment, and per-minute limits on the auth and QR endpoints.
  • There are eight Flyway migrations, 63 test methods in 17 test classes, and separate GitHub Actions workflows for the backend and the frontend.

Architecture and notes

The backend is a single Spring Boot application, but the packages are split like modules: auth, clinic, member, customer, pet, qr, appointment, visit, inventory, billing and a shared common (audit, tenant, security). I picked a modular monolith over microservices because deployment, transaction handling and debugging are simpler, and the modules have clean enough boundaries to be split out once the system grows. The database is PostgreSQL on Neon, Supabase Storage is planned for files, and schema changes come through Flyway. The design decisions are in the numbered documents in the docs folder: PRD, architecture, database, API contract, security and KVKK (the Turkish data protection law), test strategy.

Deleted records are hidden with a deleted flag instead of being removed. User consent (KVKK) is stored as a separate record.

Status: on the Next.js side the login, register, appointment, visit, stock and invoice screens are written. The customer and pet lists, the customer portal and the admin pages are still empty shells, and the notification and file modules exist only as empty packages. That is why there is no working demo yet.

Private repository

Last updated

Technologies

  • Java 21
  • Spring Boot 3
  • Next.js
  • TypeScript
  • Tailwind CSS
  • shadcn/ui
  • PostgreSQL
  • Supabase Storage
  • Flyway

The source code is kept private; I can show it on request.

Request flow

Hover or focus a component to see what it is.

A generic request path built from the project's tech list. It illustrates the stack; it is not a measured trace.