This is a Convex project created with npm create convex.
After the initial setup (<2 minutes) you'll have a working full-stack app using:
- Convex as your backend (database, server logic)
- React as your frontend (web page interactivity)
- Next.js for optimized web hosting and page routing
- Tailwind for building great looking accessible UI
- Clerk for authentication
If you just cloned this codebase and didn't use npm create convex, run:
npm install
npm run dev
If you're reading this README on GitHub and want to use this template, run:
npm create convex@latest -- -t nextjs-clerk
Then:
- Open your app. There should be a "Claim your application" button from Clerk in the bottom right of your app.
- Follow the steps to claim your application and link it to this app.
- Follow step 3 in the Convex Clerk onboarding guide to create a Convex JWT template.
- Uncomment the Clerk provider in
convex/auth.config.ts - Paste the Issuer URL as
CLERK_JWT_ISSUER_DOMAINto your dev deployment environment variable settings on the Convex dashboard (see docs)
If you want to sync Clerk user data via webhooks, check out this example repo.
This project uses Tinybird for analytics tracking. You can run Tinybird locally using Docker or use Tinybird Cloud for production.
-
Start Tinybird locally:
npm run tinybird:start
This will start a Tinybird instance in Docker on
http://localhost:7181. -
Get your local Tinybird token:
- Visit
http://localhost:7181in your browser - Sign up or log in to get your admin token
- Copy the token from the dashboard
- Visit
-
Deploy Tinybird pipes and datasources:
npm run tinybird:deploy
This will deploy all the Tinybird resources (datasources, pipes, materializations) to your local instance.
-
Set environment variables: Create a
.env.localfile in the root directory with:TINYBIRD_HOST=http://localhost:7181 TINYBIRD_TOKEN=your_local_tinybird_token
-
Verify Tinybird is running:
npm run tinybird:status
-
Create a Tinybird account:
- Go to https://www.tinybird.co
- Sign up for an account
- Create a new workspace
-
Get your Tinybird token:
- Go to your Tinybird workspace settings
- Navigate to "Tokens" section
- Create a new token with read and write permissions
- Copy the token
-
Deploy Tinybird resources:
- Install Tinybird CLI:
curl https://tinybird.co | sh - Authenticate:
tb auth - Deploy:
tb deploy - Or use the GitHub Actions workflow (see
tinybird/.github/workflows/)
- Install Tinybird CLI:
-
Set environment variables in your hosting platform:
- For Vercel: Go to Project Settings → Environment Variables
- Add:
TINYBIRD_HOST=https://api.tinybird.co TINYBIRD_TOKEN=your_tinybird_cloud_token
Required environment variables for Tinybird:
TINYBIRD_HOST: The Tinybird API host- Local:
http://localhost:7181 - Production:
https://api.tinybird.co
- Local:
TINYBIRD_TOKEN: Your Tinybird API token- Get from Tinybird dashboard (local or cloud)
Note: If Tinybird is not configured, the application will still work, but analytics will return empty data. Link tracking will be logged but not stored in Tinybird.
npm run tinybird:start- Start Tinybird Docker containernpm run tinybird:stop- Stop Tinybird Docker containernpm run tinybird:down- Stop and remove Tinybird Docker containernpm run tinybird:logs- View Tinybird logsnpm run tinybird:status- Check Tinybird container statusnpm run tinybird:deploy- Deploy Tinybird resources (local)
To learn more about developing your project with Convex, check out:
- The Tour of Convex for a thorough introduction to Convex principles.
- The rest of Convex docs to learn about all Convex features.
- Stack for in-depth articles on advanced topics.
Join thousands of developers building full-stack apps with Convex:
- Join the Convex Discord community to get help in real-time.
- Follow Convex on GitHub, star and contribute to the open-source implementation of Convex.