JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q45031F
  • License MIT

CLI tool to instantly bootstrap full-featured SaaS applications with customizable modules

Package Exports

  • saas-factory
  • saas-factory/src/cli.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (saas-factory) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

๐Ÿญ SaaS Factory

npm version downloads license

๐Ÿš€ Bootstrap Your SaaS in Minutes, Not Months

The ultimate CLI tool for generating production-ready SaaS applications.
24 modules โ€ข CRUD generator โ€ข Full-stack templates โ€ข Best practices built-in.


โœจ What is SaaS Factory?

SaaS Factory is a powerful CLI that generates complete, production-ready SaaS applications with:

  • ๐ŸŽจ Next.js 14 frontend with App Router & Tailwind CSS
  • โš™๏ธ Node.js/Express or Python/FastAPI backend
  • ๐Ÿ” Authentication with JWT, OAuth, email verification
  • ๐Ÿ’ณ Stripe payments, subscriptions, billing portal
  • ๐Ÿข Multi-tenancy with workspaces
  • ๐Ÿ‘ฅ Teams with invitations and roles
  • ๐Ÿ›ก๏ธ RBAC permission system
  • ๐Ÿ“Š Dashboard UI components
  • And 16 more modules!

๐Ÿš€ Quick Start

Create a New Project

npx saas-factory init

Follow the interactive prompts to:

  1. Choose your frontend (Next.js or API-only)
  2. Choose your backend (Node.js, Python, or frontend-only)
  3. Select modules (auth, payments, teams, etc.)
  4. Name your project

Add Modules to Existing Project

# Interactive selection
npx saas-factory add

# Or add specific module
npx saas-factory add auth
npx saas-factory add payments
npx saas-factory add ai

Generate CRUD

# Generate complete CRUD for a resource
npx saas-factory generate crud product --fields "name:string,price:number,active:boolean"

Check Project Health

npx saas-factory doctor

๐Ÿ“ฆ Available Modules (24)

Core Modules

Module Description
๐Ÿ” auth Authentication with JWT, OAuth, email verification
๐Ÿ’ณ payments Stripe subscriptions, checkout, billing portal
๐Ÿข workspaces Multi-tenant architecture
๐Ÿ›ก๏ธ permissions Role-based access control (RBAC)
๐Ÿ‘ฅ teams Team management & invitations
๐Ÿ“Š ui Pre-built dashboard components

Feature Modules

Module Description
๐Ÿ“ง email Transactional emails (Resend/Postmark/SMTP)
๐Ÿ”” notifications In-app + realtime (Pusher/Socket.io)
๐Ÿ“ storage File uploads (S3/UploadThing)
๐Ÿ’ฐ pricing Pricing page with Stripe
๐Ÿš€ onboarding User onboarding wizard
๐Ÿ“Š analytics Google Analytics / PostHog
๐Ÿ“‹ audit-log Audit logging for compliance
๐Ÿ“ blog MDX-powered blog with RSS
๐ŸŒ i18n Internationalization

Advanced Modules

Module Description
๐Ÿค– ai AI chat (OpenAI/Anthropic/Google)
๐Ÿ‘‘ admin Admin dashboard panel
๐Ÿ”— webhooks Webhook handling & verification
โšก jobs Background jobs (Inngest/BullMQ)
๐Ÿšฉ feature-flags Feature flags & A/B testing
๐Ÿ›ก๏ธ rate-limit API rate limiting
๐Ÿš€ deploy Deployment configs (Vercel/Docker)
๐Ÿงช testing Testing setup (Vitest/Playwright)

๐Ÿ“– Step-by-Step Guide

Step 1: Create Your Project

npx saas-factory init

You'll be prompted to configure:

? ๐ŸŽจ Choose your frontend framework: Next.js (React with App Router)
? โš™๏ธ  Choose your backend framework: Node.js (Express)
? ๐Ÿ“ฆ Select modules to include:
  โ—‰ ๐Ÿ” Authentication
  โ—‰ ๐Ÿ’ณ Payments (Stripe)
  โ—‰ ๐Ÿข Workspaces
  โ—ฏ ๐Ÿ›ก๏ธ  Permissions
  โ—ฏ ๐Ÿ‘ฅ Teams
  โ—‰ ๐Ÿ“Š Dashboard UI
? ๐Ÿ“ Enter your project name: my-saas-app
? ๐Ÿ”€ Initialize a Git repository? Yes

Step 2: Install Dependencies

cd my-saas-app
npm run install:all

Step 3: Configure Environment

# Copy the example environment file
cp .env.example .env

# Edit .env with your actual values
nano .env  # or use your preferred editor

Key variables to configure:

# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/mydb

# Auth
JWT_SECRET=your-super-secret-key-min-32-chars

# Stripe (if using payments)
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

Step 4: Set Up Database

# Generate Prisma client
cd backend
npx prisma generate

# Push schema to database
npx prisma db push

# (Optional) Seed initial data
npx prisma db seed

Step 5: Start Development

# From project root
npm run dev

This starts:

Step 6: Build for Production

npm run build

๐Ÿ› ๏ธ CLI Commands

Command Description
saas-factory init Create a new SaaS project
saas-factory add [module] Add module to existing project
saas-factory generate crud <name> Generate CRUD for a resource
saas-factory doctor Check project health
saas-factory list List all available modules

Generate CRUD Examples

# Basic resource
saas-factory generate crud post --fields "title:string,content:text,published:boolean"

# E-commerce product
saas-factory generate crud product --fields "name:string,price:number,description:text,stock:number,active:boolean"

# Task/Todo
saas-factory generate crud task --fields "title:string,description:text,dueDate:date,completed:boolean,priority:string"

This generates:

  • prisma/models/<name>.prisma - Database model
  • src/routes/<names>.js - API routes with validation
  • app/dashboard/<names>/page.tsx - List page with search & pagination
  • app/dashboard/<names>/[id]/page.tsx - Create/Edit form

๐Ÿ“ Project Structure

my-saas-app/
โ”œโ”€โ”€ frontend/                 # Next.js application
โ”‚   โ”œโ”€โ”€ app/                  # App Router pages
โ”‚   โ”‚   โ”œโ”€โ”€ auth/            # Login, Register, etc.
โ”‚   โ”‚   โ”œโ”€โ”€ dashboard/       # Protected dashboard
โ”‚   โ”‚   โ””โ”€โ”€ (marketing)/     # Public pages
โ”‚   โ”œโ”€โ”€ components/          # React components
โ”‚   โ””โ”€โ”€ lib/                 # Utilities
โ”‚
โ”œโ”€โ”€ backend/                  # Express/FastAPI server
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ routes/          # API endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ middleware/      # Auth, validation
โ”‚   โ”‚   โ””โ”€โ”€ utils/           # Helpers
โ”‚   โ””โ”€โ”€ prisma/              # Database schema
โ”‚
โ”œโ”€โ”€ shared/                   # Shared modules
โ”‚   โ”œโ”€โ”€ auth/                # Auth utilities
โ”‚   โ”œโ”€โ”€ payments/            # Stripe helpers
โ”‚   โ””โ”€โ”€ ...                  # Other modules
โ”‚
โ”œโ”€โ”€ .env.example             # Environment template
โ”œโ”€โ”€ package.json             # Root scripts
โ””โ”€โ”€ README.md                # Project docs

โš™๏ธ Configuration

Environment Variables

Each module adds its required variables to .env.example. Here's a complete reference:

# ===================
# Core Configuration
# ===================
NODE_ENV=development
FRONTEND_URL=http://localhost:3000
BACKEND_URL=http://localhost:8000

# ===================
# Database
# ===================
DATABASE_URL=postgresql://user:password@localhost:5432/mydb

# ===================
# Authentication
# ===================
JWT_SECRET=your-super-secret-jwt-key-change-in-production
JWT_EXPIRES_IN=7d
REFRESH_TOKEN_EXPIRES_IN=30d

# Email Verification (optional)
EMAIL_VERIFICATION_REQUIRED=true
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=
SMTP_PASSWORD=
FROM_EMAIL=noreply@yourapp.com

# OAuth (optional)
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=

# ===================
# Payments (Stripe)
# ===================
STRIPE_SECRET_KEY=sk_test_...
STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

# ===================
# File Storage
# ===================
STORAGE_PROVIDER=s3
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=us-east-1
AWS_S3_BUCKET=your-bucket

# ===================
# AI (if using ai module)
# ===================
AI_PROVIDER=openai
OPENAI_API_KEY=sk-...

# ===================
# Analytics
# ===================
NEXT_PUBLIC_POSTHOG_KEY=phc_...

๐Ÿš€ Deployment

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel

# Production
vercel --prod

Docker

# Build
docker-compose build

# Run
docker-compose up -d

Railway

# Install Railway CLI
npm i -g @railway/cli

# Login & deploy
railway login
railway init
railway up

๐Ÿงช Testing

If you added the testing module:

# Unit tests
npm run test

# E2E tests
npm run test:e2e

# With coverage
npm run test:coverage

๐Ÿ“š Module Documentation

Each module includes a detailed README.md with:

  • Required dependencies
  • Environment variables
  • Code examples
  • API reference
  • Integration guide

Access module docs at:

shared/<module-name>/README.md

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing)
  5. Open a Pull Request

๐Ÿ“„ License

MIT License - see LICENSE for details.


๐Ÿ™ Acknowledgments

Built with:


Made with โค๏ธ by the SaaS Factory team

GitHub โ€ข npm