Skip to content

SaaS Boilerplate Architecture Overview

Document Type: Brownfield Project Documentation Generated: 2026-02-12 | Last Full Rescan: 2026-03-26 | Scan Level: Exhaustive | Workflow: document-project v1.2.0 Project Type: Multi-Part SaaS Application (Backend + Frontend + Docs)

Executive Summary

This is a production-ready SaaS boilerplate consisting of two independently deployable applications:

Component Technology Deployment Repository
Backend Express.js + TypeScript + PostgreSQL Vercel saas-boilerplate/
Frontend Next.js 15 + React 19 + TailwindCSS 4 Netlify Sass-boilerplate-frontend-v1/

High-Level Architecture

                    +------------------+
                    |    Netlify CDN   |
                    |   (Frontend)     |
                    +--------+---------+
                             |
                    HTTPS REST API calls
                             |
                    +--------v---------+
                    |  Vercel Edge     |
                    |   (Backend)      |
                    +--------+---------+
                             |
              +--------------+--------------+
              |              |              |
        +-----v-----+  +-----v-----+  +-----v-----+
        | PostgreSQL|  | Cloudinary|  |  Stripe   |
        | (TypeORM) |  |  (Files)  |  | (Payments)|
        +-----------+  +-----------+  +-----------+

Key Features

Authentication & Authorization

  • Multi-provider authentication (Email/Password, Google OAuth, OTP-based login)
  • JWT access tokens with refresh token rotation
  • Two-factor authentication (Email OTP, Google Authenticator)
  • Role-Based Access Control (RBAC) with route-level permissions
  • Login attempt tracking with account lockout

Subscription & Payments

  • Stripe integration for recurring subscriptions
  • LemonSqueezy as alternative payment provider
  • Package-based subscription tiers (Trial, Monthly, Yearly)
  • Coupon/discount code support

Content Management

  • Blog system with categories, tags, and SEO (M:M categories, blog tags, view tracking)
  • Generic pages with rich text (BlockNote editor)
  • Dynamic menu builder v2 with drag-and-drop nested items (@dnd-kit)
  • Product catalog with categories
  • Email template visual builder (disconnected from email sending pipeline)

Admin Dashboard

  • User management with invite-only mode
  • Role and permission management UI
  • Site settings with edit-in-place and theme customization (Google Fonts, colors, dark mode)
  • Analytics dashboard
  • Contact message management
  • Cache revalidation management (tag-based, bulk, all)
  • AI voice integration module (experimental)

Technology Stack Summary

Backend Technologies

Category Technology Purpose
Runtime Node.js JavaScript runtime
Language TypeScript 5.4 Type safety
Framework Express.js 4.18 HTTP server
Database PostgreSQL Relational data
ORM TypeORM 0.3 Database abstraction
Validation Zod 3.22 Request validation
Auth JWT + Passport Authentication
2FA speakeasy + qrcode TOTP authentication
Payments Stripe 18.3 + LemonSqueezy 4.0 Payment processing
Storage Cloudinary + AWS S3 File storage (factory pattern)
Email Nodemailer + Resend + Brevo Transactional email (factory pattern)
Security Helmet 8.1 HTTP security headers
Rate Limiting express-rate-limit 8.0 Request throttling
Compression compression 1.8 Response gzip
Logging Winston 3.17 Structured logging + PostgreSQL transport
Scheduling node-cron 4.2 Cron jobs
Caching node-cache 5.1 In-memory cache
Sanitization sanitize-html 2.17 XSS prevention
Slugs slugify 1.6 URL slug generation
Dates date-fns 3.6 + luxon 3.4 Date manipulation
Docs swagger-jsdoc + swagger-ui-express API documentation

Frontend Technologies

Category Technology Purpose
Framework Next.js 15.3 Full-stack React framework (App Router)
UI Library React 19 Component library
Styling TailwindCSS 4 Utility-first CSS
State (Global) Redux Toolkit 2.8 Auth + settings state
State (Server) TanStack React Query 5 Data fetching/caching
UI Primitives Radix UI (14 components) Accessible components
Forms React Hook Form 7 Form state management
Rich Text BlockNote 0.35 Block-based WYSIWYG editor
Charts ApexCharts 5.3 + Recharts 2.15 Data visualization
Animations Framer Motion 12 Animation library
Drag & Drop @dnd-kit 6.3/10.0 Sortable interfaces
Icons Lucide React 0.510 Icon system
HTTP Axios 1.11 HTTP client with interceptors
Cookies cookies-next 6.1 Cookie management
Auth jwt-decode 4.0 JWT token parsing
Notifications react-hot-toast 2.6 Toast notifications
Theme next-themes 0.4 Dark/light mode
Dates date-fns 4.1 Date utilities
Date Picker react-day-picker 9.8 Calendar component
Code Highlight PrismJS 1.30 Syntax highlighting
Sanitization DOMPurify 3.3 XSS prevention (HTML sanitization)
Command Menu cmdk 1.1 Command palette UI
Transliteration transliteration 2.3 Slug generation

Codebase Metrics (2026-03-26)

Metric Backend Frontend
Source files 289 .ts 413 .js/.jsx
Modules/Pages 30 API modules 74 pages
Entities/Components 29 TypeORM entities 239 component files
Endpoints/Hooks 212 REST endpoints 139 React Query hooks
Middleware/Layouts 14 middleware 4 layouts
Policies/Providers 10 policies 5 providers
Prod dependencies 47 26

Documentation Index

  • Backend Architecture — Express.js API structure, 30 modules, 212 endpoints, 14 middleware, event system
  • Frontend Architecture — Next.js app structure, 74 pages, 239 components, 139 API hooks
  • Database Schema — 29 entities, ~233 columns, 30 relations, 11 enums
  • API Reference — 212 REST endpoints across 30 modules, authentication, response formats
  • Integration Guide — Frontend-backend communication, auth flow, cache revalidation, payments

Quick Start

Backend

cd saas-boilerplate
yarn install
# Configure .env from .env.example
yarn dev  # Starts on port 5500

Frontend

cd Sass-boilerplate-frontend-v1
npm install
# Set NEXT_PUBLIC_API_URL=http://localhost:5500/api/v1
npm run dev  # Starts on port 3000

Environment Dependencies

Runtime Requirements

  • Node.js 18.17+ (required for both backend and frontend)
  • PostgreSQL 14+

Backend Required Services

  • SMTP server (or Resend/Brevo API key)
  • Stripe account (for payments)
  • Cloudinary account (for file uploads)

Frontend Required

  • Backend API URL configured
  • Cookie domain configuration for auth

Generated by BMAD Document Project workflow v1.2.0 — Exhaustive scan, 2026-02-12 | Last full rescan: 2026-03-26