How the load-bearing pieces actually work
Deep-dive explainers on the load-bearing pieces of the SaaSForge templates: how multi-tenant architecture works in Postgres, how the RAG pipeline ingests and retrieves, how the credit economy survives Stripe's webhook lifecycle. Each page links to the product that ships it.
All feature deep-dives
SaaSForge Core
Multi-tenant architecture for Next.js B2B SaaS
Multi-tenant architecture in a Next.js SaaS means workspaces are the isolation boundary in Postgres (enforced via RLS), users belong to workspaces with explicit roles, and every read or write is scoped at the database — not the application. SaaSForge Core ships this pattern with four-role RBAC, 2FA, SAML SSO hooks, API keys, and audit logs.
Read the deep-diveSaaSForge AI
RAG pipeline in a Next.js SaaS with Supabase pgvector
A retrieval-augmented generation pipeline ingests documents (uploads), splits them into chunks, embeds the chunks with a model, stores the embeddings in pgvector inside Supabase Postgres, and on each chat turn retrieves the top-k chunks by cosine similarity to ground the LLM's answer. SaaSForge AI ships this end-to-end with Claude and OpenAI as interchangeable providers, plus credit metering tied to real token usage.
Read the deep-diveSaaSForge AI
Stripe credits system for usage-based AI SaaS billing
A credit system meters product usage (typically tokens for AI products) against a balance reset by a Stripe subscription. Each user action — chat turn, embedding, image generation — debits credits proportional to its real cost; the subscription's monthly cycle resets the balance via Stripe webhooks. SaaSForge AI ships this pattern end-to-end with idempotent webhook handling, monthly reset cron-friendly endpoints, and clean separation between metering and UI.
Read the deep-diveFour templates. One purchase decision.
Starter for a polished shell. AI for streaming chat and RAG. Core for multi-tenant B2B. Agency for multilingual marketing sites.