<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: CronoJob</title>
    <description>The latest articles on DEV Community by CronoJob (@crono-job).</description>
    <link>https://dev.to/crono-job</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3637891%2F25377bd6-f198-4970-bfcb-ba72e3134383.png</url>
      <title>DEV Community: CronoJob</title>
      <link>https://dev.to/crono-job</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/crono-job"/>
    <language>en</language>
    <item>
      <title>I built a SaaS with a Dual-Database Architecture (Transactional + Analytics) using Prisma &amp; Neon 🚀</title>
      <dc:creator>CronoJob</dc:creator>
      <pubDate>Sun, 30 Nov 2025 20:00:16 +0000</pubDate>
      <link>https://dev.to/crono-job/i-built-a-saas-with-a-dual-database-architecture-transactional-analytics-using-prisma-neon-3fh1</link>
      <guid>https://dev.to/crono-job/i-built-a-saas-with-a-dual-database-architecture-transactional-analytics-using-prisma-neon-3fh1</guid>
      <description>&lt;p&gt;Hi everyone! 👋&lt;/p&gt;

&lt;p&gt;I'm Olivier, a solo developer based in Spain.&lt;/p&gt;

&lt;p&gt;For the past few months, I've been building &lt;strong&gt;Crono-Job&lt;/strong&gt;, 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.&lt;/p&gt;

&lt;h3&gt;
  
  
  🛠 The Stack
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Frontend:&lt;/strong&gt; React + &lt;a href="https://mantine.dev/" rel="noopener noreferrer"&gt;Mantine UI&lt;/a&gt; (Absolutely love their hooks).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Backend:&lt;/strong&gt; Node.js + Express.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;ORM:&lt;/strong&gt; Prisma.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Database:&lt;/strong&gt; Postgres (hosted on Neon).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Infra:&lt;/strong&gt; Render + Redis (for rate limiting).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🏗 The Challenge: Hot Data vs. Cold Logs
&lt;/h3&gt;

&lt;p&gt;The app handles two very different types of traffic:&lt;/p&gt;

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

&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  💡 The Solution: Dual-Database Architecture
&lt;/h3&gt;

&lt;p&gt;I decided to implement a &lt;strong&gt;Dual-DB strategy&lt;/strong&gt; within the same monorepo:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Main DB (&lt;code&gt;DATABASE_URL&lt;/code&gt;):&lt;/strong&gt; Stores Users, Shifts, Projects, and TimeEntries. It's optimized for transactional integrity.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Analytics DB (&lt;code&gt;DATABASE_URL_ANALYTICS&lt;/code&gt;):&lt;/strong&gt; A separate Postgres instance dedicated to &lt;code&gt;AnalyticsEvent&lt;/code&gt; and logs. It's optimized for write-heavy operations (fire-and-forget).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Using &lt;strong&gt;Prisma&lt;/strong&gt;, 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.&lt;/p&gt;

&lt;h3&gt;
  
  
  🚀 Launching the Public Beta
&lt;/h3&gt;

&lt;p&gt;The project includes some cool features like:&lt;/p&gt;

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

&lt;p&gt;I just launched the &lt;strong&gt;Public Beta&lt;/strong&gt; (it's free right now).&lt;/p&gt;

&lt;p&gt;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!&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Live Demo:&lt;/strong&gt; &lt;a href="https://crono-job.com" rel="noopener noreferrer"&gt;https://crono-job.com&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Happy coding! 💻&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>architecture</category>
      <category>saas</category>
    </item>
  </channel>
</rss>
