
Monthlee
Next.js 15React 19TypeScriptNestJSPostgreSQLPrismaClerkStripeBullMQGoogle Cloud RunNx Monorepo
Monthlee is a SaaS platform that lets local shops offer subscription boxes to their customers. Each shop gets a generated branded storefront under its own subdomain (or custom domain), while a shared admin dashboard handles shop onboarding, template management, and publishing. I led the project as the sole architect and lead engineer, from initial concept through MVP.
Role: Lead Architect / Full-Stack Engineer
Stage: PoC → MVP
Architecture & Leadership
- Designed the full-stack architecture in an Nx monorepo: Next.js 15 (App Router) for both the admin dashboard and tenant storefronts, NestJS for the API layer, and PostgreSQL via Prisma for data.
- Built a multi-tenant routing layer using Next.js middleware: host inspection routes requests to the correct scope (admin dashboard vs. tenant storefront) and injects tenant context for all downstream API calls.
- Designed a site-generation pipeline: shop data flows into a React-to-HTML renderer that produces a static site; a BullMQ job queue handles preview and publish operations with ISR revalidation via Next.js revalidatePath.
- Architected the data model covering user management, shop profiles, subscription offerings with flexible pricing tiers (monthly, quarterly, annual), delivery tracking, and a full subscription event log.
- Integrated Clerk for authentication: JWT validation in NestJS guards, role-based access control (platform admin, shop owner, shop staff, customer), and Clerk webhook sync to keep local user records in step.
Key Technical Achievements
- Tenant storefront generation: shop profile, branding tokens, and product catalog compiled into a deployable static site published to Google Cloud Run or S3 adapters.
- Stripe subscription billing: checkout session creation, recurring billing, and webhook-driven status management (created, renewed, failed, cancelled).
- Draft/publish workflow: editors work on live drafts; publishing enqueues a job that flips status, fans out revalidation calls per tenant path, and updates ISR cache.
- Multi-tenant isolation enforced at every layer: Prisma queries wrapped in a TenantContext guard; NestJS route guards validate tenant scope from Clerk JWT claims; separate cookie namespaces for admin vs. storefront sessions.
- Custom domain support with wildcard TLS and ACME automation for per-tenant certificates.