npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

saas-factory

v2.0.1

Published

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

Downloads

586

Readme

🏭 SaaS Factory


✨ 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:

  • Frontend: http://localhost:3000
  • Backend: http://localhost:8000

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=
[email protected]

# 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

Vercel (Recommended for Next.js)

# 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: