Quick Start with NextSaaS
In this chapter, we'll guide you through setting up NextSaaS on your machine. It's a straightforward process, and you'll have your own local instance of NextSaaS running in no time.
Download the NextSaaS repository
Once you've purchased NextSaaS, you'll receive a link to access your account. You can download the NextSaaS repostiory from either the Dashboard or the GitHub link (available with the Boost Plan
).
Option 1:
Simply click on Download NextSaaS.zip
Option 2: (Requires GitHub setup, available with the Boost Plan
)
git clone https://github.com/xjasonsong/NextSaaS-Boilerplate
Installation
Install Node.js (if you haven't already)
If you haven't installed Node.js yet, you can follow the instructions here (opens in a new tab).
Install Node Modules
Navigate to the downloaded NextSaaS repostiory:
cd NextSaaS-main
npm install
Configure Environment Variables
Next.js supports environment variables out of the box. You can set defaults in .env (for all environments), .env.development (for development), and .env.production (for production).
By default, files matching .env* are ignored by Git, except for .env.example
, which provides an example of environment variables for NextSaaS.
For now, let's rename it to .env
to get started quickly. In future tutorials, we'll cover setting up environment variables for production.
Environment variables in NextSaaS are typed by @t3-oss/env-nextjs
. Refer to the definition in src/env.mjs
.
Create Tables (First Run Only)
To set up the required tables, run the following command:
npx prisma db push
Run
To start NextSaaS, simply run:
npm run dev
Congratulations! Your NextSaaS instance is now running at http://localhost:3000/ (opens in a new tab).