Hi!
Thanks for purchasing the Forj Boilerplate from me! This guide will help you set it up, customise the database, and troubleshoot any issues you may encounter. Let’s get started!
If you have any questions, issues, feature suggestions, etc., feel free to reach out to me on [Twitter]
Follow along to get the app up and running in 5-10 minutes!
Clone The Repo From GitHub
- Clone the boilerplate repo from GitHub with a new project name (e.g.
new-project-name
)
git clone git@github.com:timohuennebeck/nextjs-boilerplate.git new-project-name
- Upon installing the repo, move into the new project (e.g.
new-project-name
)
cd new-project-name
- Remove the existing remote origin
git remote remove origin
-
Create a [new GitHub repo]
-
Include the remote URL to the new GitHub repo
git remote add origin https://github.com/username/new-repo.git
- Push the code
git push -u origin main
Install dependencies
npm install
Rename .env.example to .env.local
You should have a .env.example
file in the root of the codebase. Let’s rename it to .env.local
.
You should now have a .env.local
file with the variables below. Don’t worry, we’ll go through each of them and where to find them / set them up later throughout this guide.
NEXT_PUBLIC_STRIPE_SECRET_KEy=
NEXT_PUBLIC_STRIPE_WEBHOOK_SECRET=
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEy=
NEXT_PUBLIC_RESEND_EMAIL_API_KEy=
NEXT_PUBLIC_EMAIL_LOGO_BASE_URL=
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEy=
NEXT_PUBLIC_SITE_URL=
You can now continue with the rest of this guide to set up things such as the database, stripe, resend (emails), etc. to get the app running!
Project File Structure
Here’s a quick overview of the codebase structure to get you familiar with the boilerplate before we start setting it up!
- middleware.ts
- api
- ...
- helper
- ...
- admin.ts
- client.ts
/src/middleware.ts
handles middleware (e.g. authentication, etc.)./src/app/api/
handles API calls (eachroute.ts
is one API endpoint)./src/lib/
handles logic (e.g. stripe functions, supabase functions, etc.)./src/lib/email
contains email templates that are sent to users./src/lib/helper
contains helper functions (e.g. format dates, handle supabase errors, etc.)./src/services/
contains Supabase client and admin configurations, and centralises database interactions and queries.