Documentation
SaaS Template Core Documentation
Everything you need to know about using and customizing SaaS Template Core for your business.
Installation
How to set up SaaS Template Core on your local machine.
Prerequisites
- Node.js 18.0 or newer
- PostgreSQL database
- Stripe account for payments
- Git for version control
Step 1: Clone the repository
git clone https://github.com/yourusername/saas-template-core.git
Step 2: Install dependencies
cd saas-template-core
npm install
npm install
Step 3: Set up environment variables
Create a .env.local
file in the root directory with the following variables:
# Database
DATABASE_URL="postgresql://postgres:password@localhost:5432/saas-template-core"
# Authentication
NEXTAUTH_SECRET="your-secret-here"
NEXTAUTH_URL="http://localhost:3000"
# Stripe
STRIPE_SECRET_KEY="sk_test_your_test_key"
STRIPE_WEBHOOK_SECRET="whsec_your_webhook_secret"
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_your_publishable_key"
# Google Analytics
NEXT_PUBLIC_GA_MEASUREMENT_ID="G-MOCK-GA4-ID"
# App URL
NEXT_PUBLIC_APP_URL="http://localhost:3000"
DATABASE_URL="postgresql://postgres:password@localhost:5432/saas-template-core"
# Authentication
NEXTAUTH_SECRET="your-secret-here"
NEXTAUTH_URL="http://localhost:3000"
# Stripe
STRIPE_SECRET_KEY="sk_test_your_test_key"
STRIPE_WEBHOOK_SECRET="whsec_your_webhook_secret"
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_your_publishable_key"
# Google Analytics
NEXT_PUBLIC_GA_MEASUREMENT_ID="G-MOCK-GA4-ID"
# App URL
NEXT_PUBLIC_APP_URL="http://localhost:3000"
Step 4: Set up the database
npx prisma migrate dev
Step 5: Start the development server
npm run dev
Project Structure
Understanding the organization of the SaaS Template Core codebase.
Directory Structure
/app - Next.js App Router pages and API routes
/components - Reusable UI components
/hooks - Custom React hooks
/lib - Utility functions and configurations
/prisma - Database schema and migrations
/public - Static assets
/styles - Global styles and Tailwind configuration
/types - TypeScript type definitions
/components - Reusable UI components
/hooks - Custom React hooks
/lib - Utility functions and configurations
/prisma - Database schema and migrations
/public - Static assets
/styles - Global styles and Tailwind configuration
/types - TypeScript type definitions
Key Files
app/layout.tsx
- Root layout with providerslib/auth.ts
- NextAuth.js configurationlib/db.ts
- Prisma client setuplib/stripe.ts
- Stripe integrationprisma/schema.prisma
- Database schemacomponents/ui/*
- UI componentsapp/api/*
- API routes
API Reference
Detailed documentation of the API endpoints.
Explore the available API endpoints and learn how to integrate with them.
View API DocsComponent Library
UI components used throughout the template.
Browse the component library and learn how to use each component.
View ComponentsTutorials
Step-by-step guides for common tasks.
Learn how to implement common features and customizations.
View TutorialsNeed Help?
If you can't find what you're looking for in the documentation, reach out to our support team or community.