DEV Community

CronoJob
CronoJob

Posted on

I built a SaaS with a Dual-Database Architecture (Transactional + Analytics) using Prisma & Neon πŸš€

Hi everyone! πŸ‘‹

I'm Olivier, a solo developer based in Spain.

For the past few months, I've been building Crono-Job, a workforce management platform. I wanted to share a bit about the technical journey and the architecture choices I made, specifically why I chose to split my data into two different databases.

πŸ›  The Stack

  • Frontend: React + Mantine UI (Absolutely love their hooks).
  • Backend: Node.js + Express.
  • ORM: Prisma.
  • Database: Postgres (hosted on Neon).
  • Infra: Render + Redis (for rate limiting).

πŸ— The Challenge: Hot Data vs. Cold Logs

The app handles two very different types of traffic:

  1. Critical Operations: Users clocking in/out, biometric photos from the Kiosk mode, and payroll calculations. This needs to be fast and consistent (ACID).
  2. Analytics & Audit: Every click, page view, and system event is logged for the "Data Governance" module and audit trails.

I realized early on that if I dumped millions of analytics events into the same Postgres instance as the user data, my queries for the Dashboard would eventually crawl.

πŸ’‘ The Solution: Dual-Database Architecture

I decided to implement a Dual-DB strategy within the same monorepo:

  1. Main DB (DATABASE_URL): Stores Users, Shifts, Projects, and TimeEntries. It's optimized for transactional integrity.
  2. Analytics DB (DATABASE_URL_ANALYTICS): A separate Postgres instance dedicated to AnalyticsEvent and logs. It's optimized for write-heavy operations (fire-and-forget).

Using Prisma, I manage two clients. One for the core app and a custom generated client for the analytics. This keeps my main DB crisp and responsive, no matter how much logging we do.

πŸš€ Launching the Public Beta

The project includes some cool features like:

  • Biometric Kiosk: Uses the webcam to capture evidence and verify identity.
  • Payroll Export: Generates complex Excel files compatible with Spanish payroll software (A3NOM).
  • Smart Policies: Geofencing and anti-fatigue blocks (12h rest rule).

I just launched the Public Beta (it's free right now).

If you are curious about the UI (Mantine in action) or want to stress-test my dual-db setup, feel free to check it out!

πŸ‘‰ Live Demo: https://crono-job.com

I'd love to hear your thoughts on this architecture. Is splitting databases overkill for an MVP, or a smart move for scaling?

Happy coding! πŸ’»

Top comments (0)