Need a custom feature? We can help!
Authentication Setup
Overview
StartupFast comes with prebuilt authentication using ClerkJS bound to your Supabase User schema. The one thing you need to enable authentication is to fill the correct environment variables in your .env.local
.
NOTE: Since authentication relies on the User database table, you will need to set up your DB too if you want to enable it. Follow this guide.
Setup
- Create a ClerkJS account.
- Get your API keys from the Clerk dashboard.
- Add them to your
.env.local
file.
1# Clerk authentication keys (get these from https://dashboard.clerk.dev) 2NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY= 3CLERK_SECRET_KEY=
You are good to go; your app now has authentication.
Protected Routes, Custom Middleware Configuration
Your application relies on middleware to ensure some paths (e.g., /dashboard
) are reachable only by authenticated users. To customize this behavior, you can open the middleware.ts
file in the root of your application:
1const isProtectedRoute = createRouteMatcher([ 2 "/dashboard(.*)", 3 "/todos-client(.*)", 4 "/todos-server(.*)", 5]);
If any route matches the route matcher, it will require authentication. Modify this const
to add or remove custom paths.