Next 16 starter kit based on Next.js, Auth.js and Drizzle designed to accelerate the development of web-based (SaaS) applications.
Get started in about 30 minutes by following these steps.
-
Unpack the Archive
-
Switch to the project's root directory
cd monorepo-next-drizzle-authjs-
Install Bun if not already installed (See https://bun.sh/ for instructions)
-
Install the package dependencies of the whole monorepo
bun install- Copy the sample configurations
cp apps/dashboard/.env.example apps/dashboard/.env
cp apps/marketing/.env.example apps/marketing/.env
cp apps/public-api/.env.example apps/public-api/.env
cp packages/database/.env.example packages/database/.env- 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- Update database
packages/database/.envwith your credentials.
DATABASE_URL=postgresql://postgres:password@localhost:5432/database?schema=public- Create the database
psql -U postgres -c "CREATE DATABASE database;"- Apply the database migrations.
bun run --filter database push- Update also the dashboard
apps/dashboard/.envwith your credentials.
DATABASE_URL=postgresql://postgres:password@localhost:5432/database?schema=public- 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 screenand 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 dashboard
apps/dashboard/.envwith the created credentials.
AUTH_GOOGLE_CLIENT_ID=
AUTH_GOOGLE_CLIENT_SECRET=- 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
Authenticationin 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 dashboard
apps/dashboard/.envwith the created secret.
AUTH_MICROSOFT_ENTRA_ID_CLIENT_ID=
AUTH_MICROSOFT_ENTRA_ID_CLIENT_SECRET=- 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 dashboard
apps/dashboard/.envwith the IDs and credentials.
NEXT_PUBLIC_BILLING_PRICE_PRO_MONTH_ID=
NEXT_PUBLIC_BILLING_PRICE_PRO_YEAR_ID=
NEXT_PUBLIC_BILLING_PRICE_LIFETIME_ID=
NEXT_PUBLIC_BILLING_PRICE_ENTERPRISE_MONTH_ID=
NEXT_PUBLIC_BILLING_PRICE_ENTERPRISE_YEAR_ID=
BILLING_STRIPE_SECRET_KEY=
BILLING_STRIPE_WEBHOOK_SECRET=The starter kit supports Nodemailer (SMTP) and Resend.
- Choose an SMTP provider in
packages/email/provider/index.ts. - Update dashboard
apps/dashboard/.envwith SMTP credentials.
EMAIL_FROM=
# Provider: NodeMailer
EMAIL_NODEMAILER_URL=
# Provider: Postmark
EMAIL_POSTMARK_SERVER_TOKEN=
# Provider: Resend
EMAIL_RESEND_API_KEY=
# Provider: SendGrid
EMAIL_SENDGRID_API_KEY=For Gmail you need an app-specific password and set it up like this
EMAIL_NODEMAILER_URL=smtp://myemail@gmail.com:suyz yeba qtgv xrnp@smtp.gmail.com:465We recommend Resend for the ease of use.
SMTP provider is mandatory for credentials login.
- Start the dashboard application
bun run --filter dashboard dev- Navigate to http://localhost:3000
You’re all set to start!
- Start the marketing application
bun run --filter marketing dev- Navigate to http://localhost:3001
You’re all set to start!
- Start the public API application
bun run --filter public-api dev- Navigate to http://localhost:3002
You’re all set to start!
The database is probably not set up.
In the monorepo version npm is no longer supported. It's all Bun now. The problem is that npm, yarn and pnpm have different workspace syntax and package hoisting patterns. Supporting all package managers is not possible in a monorepo setup and Bun is the fastest one.