Case study

Smart Track

A production-ready SaaS productivity platform featuring Stripe billing, habit tracking, and automated academic planning.

nextnextauthjsauthjsstripestripepostgresqlpostgresqldrizzledrizzle
Smart Track preview

The Concept

Smart Track was built to eliminate "context-switching friction." Most users juggle four or five apps for tasks, habits, and billing. I unified these into a single, high-performance workspace designed for long-term consistency.

The goal wasn't just to build a to-do list, but to engineer a SaaS ecosystem that handles complex user lifecycles and subscription states with zero lag.

Infrastructure Deep Dive

Financial Integrity with Stripe

Handling money requires a "fail-safe" mindset. I implemented a resilient billing boundary using Stripe Webhooks. To prevent duplicate processing (common in network retries), I built an idempotency cache that verifies cryptographically signed events before updating the database. This ensures user access is always synchronized with their actual payment status.

ACID-Compliant Transactions

When a user upgrades to a Premium tier, multiple database records must update simultaneously. Using Drizzle ORM transactions, I ensured that if a single part of the process fails, the entire operation rolls back. This prevents "zombie states" where a user is charged but doesn't receive their features.

Strategic Data Indexing

Relational databases slow down as user data grows. To keep the dashboard near-instant, I implemented composite indexes on high-frequency lookups (specifically userId + habitId). This optimization ensures that streak counters and analytics remain performant even with thousands of historical data points.

Security Posture

  • Zero-Trust Validation: Every byte of data entering the system is parsed through Zod schemas at the Server Action boundary.
  • Server-Side Authority: Authentication is handled strictly at the server level via Auth.js v5, using Next.js Middleware to protect routes before a single pixel is rendered on the client.
  • Environment Isolation: Sensitive Stripe keys and database credentials are decoupled from the code, using a strict environment configuration to prevent production leaks.

Evolution & Scale

Building Smart Track taught me that Product Engineering is 20% UI and 80% Infrastructure. Navigating the edge cases of subscription state machines—like "grace periods" and "past due" status—transformed my understanding of how to build software that can actually run a business.

Smart Track is not just a tool; it is a demonstration of how to build a scalable, secure, and financially integrated application for the modern web.