Installation
Complete step-by-step installation process
This guide walks you through the complete installation process, from cloning the repository to running your SaaS application locally.
Want to get started fast?
Check out the Quick Start guide for a streamlined 15-minute setup that gets you running immediately.
Prerequisites
- Node.js 18+ installed
- Git installed
- A code editor (VS Code recommended)
- Basic familiarity with command line/terminal
Installation Steps
Clone the Repository
Open your terminal and clone the repository to your local machine:
1# Clone the repository2git clone [your-repository-url] my-saas-app3 4# Navigate into the project directory5cd my-saas-app[your-repository-url] with the actual URL of your repository. If you received this as a template, use your own repository URL.Install Dependencies
Install all required dependencies using npm:
1# Install dependencies2npm installThis will install all the packages defined in package.json, including:
- Next.js framework
- React and React DOM
- TypeScript and type definitions
- Tailwind CSS for styling
- Prisma ORM for database
- Auth.js for authentication
- And many other dependencies...
Installation Time
Set Up the Database
The project uses a dual database schema system:
- SQLite for local development (zero configuration)
- PostgreSQL for production
For local development, run the database setup command:
1# Set up SQLite database for local development2npm run db:devThis command will:
- Generate the Prisma client based on the schema
- Create a local SQLite database file (
prisma/dev.db) - Apply all database migrations
Automatic Setup
npm install. If the database file already exists, this step may not be necessary.Create Environment Variables
Create a .env.local file in the project root with the minimum required configuration:
1# Database (SQLite for local development)2DATABASE_URL="file:./dev.db"3 4# Auth.js Configuration5# Generate a secret with: openssl rand -base64 326AUTH_SECRET=your_random_secret_here7 8# App URL (change port if using a different one)9AUTH_URL=http://localhost:3000Generate a secure secret:
1# On macOS/Linux (or Git Bash on Windows)2openssl rand -base64 323 4# Or use the online generator5# https://generate-secret.vercel.app/32Copy the generated string and paste it as the value for AUTH_SECRET.
.env.local file to Git! It should already be in .gitignore by default.Verify Installation
Start the development server to verify everything is working:
1# Start the development server2npm run devYou should see output similar to:
1> next dev2 3 ⲠNext.js 16.x.x4 - Local: http://localhost:30005 - Network: http://192.168.x.x:30006 7 â Starting...8 â Ready in 2.4sOpen your browser and navigate to http://localhost:3000. You should see the landing page.
Run Verification Commands
To ensure everything is properly configured, run these verification commands:
1# Check for linting issues2npm run lint3 4# Check TypeScript types5npm run typecheck6 7# Run unit tests8npm run test:runAll commands should complete successfully without errors.
Project Structure Overview
After installation, your project structure will look like this:
Key directories:
prisma/- Database schema and migrationssrc/app/- Next.js App Router pagessrc/components/- React componentssrc/lib/- Utility functions and configurationstests/- Unit and E2E tests
Common Installation Issues
Node.js version errors
If you see errors about Node.js version:
1# Check your Node.js version2node --version3 4# Should be v18.x.x or higher5# If not, download from https://nodejs.orgPort 3000 already in use
If port 3000 is already being used:
1# Use a different port2PORT=3001 npm run dev3 4# Then update AUTH_URL in .env.local:5AUTH_URL=http://localhost:3001Database migration fails
If database setup fails:
1# Delete the database file and try again2rm prisma/dev.db3npm run db:devNext Steps
Now that your application is installed and running: