Easy-to-setup, fully-featured, and customizable NextJS Boilerplate
This page was last updated on: 31st May 2025
DO NOT upgrade any dependencies in your package.json for the core stack dependencies (Clerk, Stripe, Supabase, etc.), unless you have a specific reason to and are following the official migration guides from each service. Upgrading packages without proper migration can break your authentication, payments, database connections, and other critical functionality. The current versions in the boilerplate are tested and stable together.
Repo: https://github.com/ObaidUr-Rahmaan/titan
All of the above services (except GetFernand) have generous free tiers.
Even as your product grows, the cost remains minimal (averaging $300-400/month with 10,000+ DAUs for 80%+ profit margin).
These 3rd party services abstract away significant infrastructure work in key areas (payments, authentication, database, etc.), letting you focus solely on building your product.
For niche industries like healthcare, additional compliance might be required. Supabase offers HIPAA-compliant databases for $599/month.
See this Article for more information on Supabase’s SOC2 and HIPAA compliance if you’re considering building a healthcare app.
Prerequisites
Install the latest stable version of Node.js (If you already have Node.js installed, this will override it):
Verify Node.js is installed:
Should return something like v24.x.y
(at the time of writing: 24.1.0)
Install Bun: We recommend using Bun for significantly faster development experience - including 10x faster dependency installation, 2-4x faster builds, and practically instant dev server startup.
Should return something like 1.x.y
(at the time of writing: 1.2.15)
Create a new empty GitHub repository for your project
Have the SSH repository URL ready (e.g., git@github.com:username/repo-name.git
)
Make sure it’s the SSH URL, not the HTTPS URL!
Install the Supabase CLI to interact with Supabase:
Gather your Development API keys from the following services:
If you have your own agency and you’re building for a client, you’ll need to create all the below accounts for them using your own agency company email account and then transfer ownership to them later when the contract ends.
See the Account Management Guide for more information on how to do this.
Clerk (Authentication)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
and CLERK_SECRET_KEY
from the ‘API Keys’ section..env
file later)We’ll get to the CLERK_WEBHOOK_SECRET
when we’re testing the app locally and deploying to production. Leave it blank for now.
Stripe (Payments)
STRIPE_SECRET_KEY
and NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
from the ‘API Keys’ section (‘Developers’ -> ‘API Keys’)NEXT_PUBLIC_STRIPE_PRICE_ID
.env
file later)The Customer Portal allows your users to manage their billing, update payment methods, view invoices, and cancel subscriptions without you having to build these features from scratch.
We’ll get to the STRIPE_WEBHOOK_SECRET
when we’re testing the app locally and deploying to production. Leave it blank for now.
PLUNK_API_KEY
from Project Settings > API Keys.env
file later)NEXT_PUBLIC_SUPABASE_URL
and NEXT_PUBLIC_SUPABASE_ANON_KEY
from the ‘Connect’ modal on the main Project Dashboard page (click on the ‘Connect’ button) and then go to the ‘App Frameworks’ tabSUPABASE_SERVICE_ROLE_KEY
from the Project Settings
> API Keys
tabDATABASE_URL
(with pgbouncer) and DIRECT_URL
(without pgbouncer) from the same ‘Connect’ modal under the ‘ORMs’ tab.env
file later)Setup via CLI
You’ll be given the option add your API keys during the setup process, or manually later in your .env
file.
Done! Your project is now set up:
Make sure to add all of the above API keys to your .env
file before you start local development.
Now GO BACK to the MVP Development Guide and continue to step ‘Requirements & Documentation’ and continue until step Setup Local Development Tools & Build MVP
Once you’ve completed the initial editor setup, you can go back to the Titan Guide and continue from step ”
Developing your app locally
When we run the app later, all requests will be forwarded to ngrok and then to your local app. ngrok is necessary for the auth and payments webhooks to work.
It’s also best to use either incognito (to prevent any extensions from interfering with the app) or a new browser profile OR Sizzy (Paid), as it allows extensive testing across different devices.
brew install ngrok
ngrok http 3000
.env
file to the ngrok URL.This will be your local development URL (e.g. https://1234567890.ngrok-free.app
)
The reason we need this is to expose our localhost to the public internet, so that we can setup Clerk and Stripe webhooks (which will both send requests to our app in order for us to store those details in our database).
We need to also have the webhooks configured for both Clerk and Stripe so we can test the authentication and payments flows locally.
For Clerk:
Configure
-> Webhooks
-> + Add Endpoint
Endpoint URL
to https://[your-ngrok-url]/api/auth/webhook
Events
to user.created
and user.updated
Create
CLERK_WEBHOOK_SECRET
in your .env
file.For Stripe:
stripe listen --forward-to [your-ngrok-url]/api/payments/webhook
in a new terminal (outside of Cursor)STRIPE_WEBHOOK_SECRET
in your .env
file.Important: When returning to work on your project
Each time you restart ngrok, it generates a new URL. You must:
FRONTEND_URL
in your .env
file with the new ngrok URLCLERK_WEBHOOK_SECRET
in your .env
file.stripe listen --forward-to [the-new-ngrok-url]/api/payments/webhook
in a new terminal (outside of Cursor) and copy the webhook secret in the terminal and update the STRIPE_WEBHOOK_SECRET
in your .env
file..env
fileFailing to update these will cause authentication and payment webhooks to fail silently!
Your app requires several components to be set up in the correct order:
First, set up your Database - See the Database Guide for setting up all your tables
Next, configure Authentication - See the Authentication Guide to set up Clerk authentication
Next, set up Payments - See the Payments Guide to configure Stripe payments and Dispute prevention with ByeDispute / Chargeblast
Next, set up Emails - See the Email Guide to configure Plunk emails
Next, set up User Analytics - See the Analytics Guide to configure DataFast (Optional for now as this is paid only)
Next, set up User Feedback - See the Feedback Guide to configure UserJot
Finally, set up Customer Support - See the Customer Support Guide to configure GetFernand
You must follow this order because your payments system depends on authenticated users, which in turn depend on properly configured database tables.
Done. Your app will now be able to receive webhooks from both Clerk and Stripe.
Remember to always use the ngrok url when testing locally (not localhost:3000)
Building the Product
At this point, you should have a clean and beautiful landing page that explains the product and what it does (perhaps with a waitlist setup with Clerk)
But it’s up to you to now add the main functionality of your product (perhaps a Dashboard that users get redirected to after signing up, and all other relevant pages)
We’ve got a dedicated guide page related to building clean and beautiful UIs very quickly: Rapid UI Prototyping
See the ‘The v0 + Cursor Workflow (Recommended)’ section
Deploying the App to Production
You’ll need to purchase a domain before deploying to production. Services like Clerk and Stripe require a verified domain for production environments. Purchase a domain from providers like Namecheap, Porkbun, GoDaddy, or Google Domains before proceeding with production deployment.
When you’re ready to deploy your application to production, follow our comprehensive deployment guide:
The guide covers everything you need for a successful production deployment:
Setup Analytics
Track your site visitors and get insights on how they interact with your site.
index.html
fileGather User Feedback