ysskrishna logoysskrishna
FastAPI Nextjs Clerk Starter

FastAPI Nextjs Clerk Starter

FastAPI + Nextjs app with Clerk authentication.

Gallery image 1
Gallery image 2
Gallery image 3
Gallery image 4
Gallery image 5
Gallery image 6
Gallery image 7

Next.js plus FastAPI with Clerk: sign-in in the browser, JWT-checked APIs on the server

This project shows Clerk handling sign-up and sign-in in a Next.js client, then passing Clerk-issued JWTs to a FastAPI backend that exposes public and protected routes. The dashboard demonstrates fetching a token, calling both kinds of endpoints, and handling unauthorized errors, with light/dark UI and route protection as described in the README.

When it is useful

You want a minimal full-stack reference for BFF-style patterns with a hosted auth vendor, you are onboarding a team to split client and Python API repos, or you need a Docker Compose layout to run both sides together. You supply the Clerk project and env files for client and backend.

What you can do

  • Complete the Clerk flows in the web app and see personalized responses when the API accepts your token.
  • Inspect how JWT verification is wired on the FastAPI side versus open routes.
  • Run the stack with Docker Compose and extend either client or backend using the nested READMEs linked from the main GitHub repository.

Limits

  • This is a demonstration template, not a finished product; billing, roles, and audits are yours to add.
  • Security posture depends on your secrets handling, HTTPS, and Clerk settings; the repo documents wiring, not penetration-test results.
  • Anything beyond the documented features (caching, multi-region, orgs) is custom work.

Frequently asked questions

How does auth work across the stack?

Clerk handles sign-up and sign-in in the Next.js client. The client sends Clerk-issued JWTs to FastAPI, which exposes public and protected routes and verifies tokens (PyJWT).

What does the dashboard demonstrate?

Fetching a Clerk JWT, calling public and protected backend endpoints, showing personalized responses, and handling unauthorized errors. The UI includes light/dark themes with system preference detection and route protection.

How do I run it locally?

Create a Clerk project, fill backend/.env and client/.env from the samples (JWKS URL, issuer, publishable key, secret key), then run docker-compose up --build. Frontend is at localhost:3000 and backend at localhost:8081.

Is this a finished product?

No. It is a demonstration template. Billing, roles, and audits are yours to add, and security posture depends on your secrets handling, HTTPS, and Clerk settings.

Continue exploring

ProductFastAPI Clerk Starter

FastAPI Clerk Starter

FastAPI starter with Clerk auth. Secure & scalable!
Auth & Security
Backend & APIs
Starter Kits & Boilerplates
FastAPI
BlogCover image for How Microservices Verify JWTs Without Calling the Auth Service

How Microservices Verify JWTs Without Calling the Auth Service

Auth & Security
Backend & APIs
+1
8 min read
ProductFastAPI Supabase Starter

FastAPI Supabase Starter

FastAPI backend starter that validates Supabase JWTs and exposes protected user routes.
Auth & Security
Backend & APIs
Starter Kits & Boilerplates
FastAPI
ProductNextjs Supabase Starter

Nextjs Supabase Starter

Next.js + Supabase starter with auth, protected routes, dashboard, and light/dark UI.
Auth & Security
Starter Kits & Boilerplates
Next.js
Supabase
ProductExpress FastAPI Protobuf

Express FastAPI Protobuf

Reference architecture for Vue.js, Express, and FastAPI using Protocol Buffers for efficient binary serialization
Backend & APIs
Starter Kits & Boilerplates
Vue
Express
BlogCover image for Encoding, Encryption, and Hashing: The Difference Everyone Should Know

Encoding, Encryption, and Hashing: The Difference Everyone Should Know

Auth & Security
3 min read