Quickstart
Get started in about 30 minutes by following these steps.
Pre-requisites
Make sure you have the following installed on your machine.
- Node.js 20 or higher
- pnpm 9.12 or higher
- Git (e.g. via GitHub Desktop)
- VS Code or equivalent
Installation
-
Unpack the archive
-
Switch to the project's root directory:
cd monorepo-next-prisma-authjs
- Install the package dependencies for the whole monorepo:
pnpm i
Environment variables
Copy the sample configurations:
cp apps/dashboard/.env.example apps/dashboard/.env
cp apps/marketing/.env.example apps/marketing/.env
cp packages/database/.env.example packages/database/.env
Database
PostgreSQL
- Install PostgreSQL via Homebrew, Chocolatey or download it from the website:
brew install postgresql
- Add an initial user:
sudo -u postgres psql
CREATE USER postgres WITH PASSWORD 'password';
ALTER USER postgres WITH SUPERUSER;
\q
Connection string
- Update database
packages/database/.env
with your credentials:
DATABASE_URL=postgresql://postgres:password@localhost:5432/database?schema=public
- Apply the database migrations:
pnpm --filter database migrate dev
- Update also the dashboard
apps/dashboard/.env
with your credentials.
DATABASE_URL=postgresql://postgres:password@localhost:5432/database?schema=public
Authentication
Auth secret
Technically you can skip this step, but we recommend to generate a new AUTH_SECRET
in apps/dashboard/.env
.
For this simply run:
npx auth secret
or alternatively you can run:
openssl rand -base64 32
Google login (optional)
- Visit the Google Cloud Console.
- Create an account if you don't have one already.
- Navigate to APIs or click here
- Configure the
OAuth consent screen
and add yourself as test user. - Click on
Credentials
, create new OAuth credentials and save those credentials. - Add the Authorized JavaScript origin to the credential settings:
http://localhost:3000
- Add the Authorized redirect URI to the credential settings:
http://localhost:3000/api/auth/callback/google
- Update
apps/dashboard/.env
with the created credentials:
AUTH_GOOGLE_CLIENT_ID=
AUTH_GOOGLE_CLIENT_SECRET=
Microsoft login (optional)
- Visit the Azure Portal.
- Create an account if you don't have one already.
- Navigate to your Entra ID (Active Directory).
- Register a new application with platform web.
- Click on
Authentication
in the menu and add the redirect URIs
http://localhost:3000
http://localhost:3000/api/auth/callback/microsoft-entra-id
- Under
Certificates & Secrets
, create a new client secret. - Update
apps/dashboard/.env
with the created secret:
AUTH_MICROSOFT_ENTRA_ID_CLIENT_ID=
AUTH_MICROSOFT_ENTRA_ID_CLIENT_SECRET=
Billing
Stripe
- Visit the Stripe Dashboard.
- Create an account if you don't have one already.
- Activate test mode.
- Activate the customer billing portal.
- Create a product.
- Create a price for the product.
- Navigate to developer section and copy the API credentials.
- Update
apps/dashboard/.env
with the IDs and credentials:
NEXT_PUBLIC_BILLING_STRIPE_PUBLISHABLE_KEY=
BILLING_STRIPE_SECRET_KEY=
BILLING_STRIPE_WEBHOOK_SECRET=
BILLING_PRO_PRODUCT_ID=
BILLING_PRO_PRODUCT_PRICE_ID=
Billing unit
You can specify the billing unit as per_seat
or per_organization
. The difference is that per seat you bill for every user in the organization and per_organization you bill for the whole organization regardless of user seats.
BILLING_UNIT=per_seat # per_seat | per_organization
We recommend to leave it at per_seat
if you are not sure.
Emails
Mailer
The starter kit supports NodeMailer (SMTP) and Resend.
- Choose an SMTP provider (Gmail for testing is fine).
- Update
apps/dashboard/.env
with SMTP credentials.
EMAIL_FROM=
EMAIL_MAILER=NodeMailer # NodeMailer (default) | Resend
# NodeMailer
EMAIL_NODEMAILER_URL=
# Resend
EMAIL_RESEND_API_KEY=
For Gmail you need an app-specific password and set it up like the following URL:
EMAIL_NODEMAILER_URL=smtp://myemail@gmail.com:suyz yeba qtgv xrnp@smtp.gmail.com:465
Applications
Dashboard application
To only start the dashboard application, run:
pnpm --filter dashboard dev
Navigate to http://localhost:3000 in your browser.
Marketing application
To only start the marketing application, run:
pnpm --filter marketing dev
Navigate to http://localhost:3001 in your browser.
All applications
To start all applications under apps
, run the command:
pnpm run dev
Dashboard: http://localhost:3000
Marketing: http://localhost:3001
Prisma Studio: http://localhost:3004
React Email Preview: http://localhost:3003
Requirements Check: (No URL)
Preferred command if your machine can handle it. All apps will run in parallel. Note that in the Turborepo task UI there is no way to set an order yet, but you can navigate with the up/down arrow keys.