Get the AI Starter Kit running on your machine in 5 minutes. This guide will walk you through the fastest path to a working application.
- Prerequisites
- Automated Setup (Recommended)
- Manual Installation Steps
- Verification
- What's Next?
- Troubleshooting Quick Setup
Before you begin, make sure you have the following installed:
-
✅ Node.js 18.x or later (Download here)
node --version # Should be 18.x or higher -
✅ pnpm (recommended) or npm
# Install pnpm globally if you don't have it npm install -g pnpm # Verify installation pnpm --version
- Git for version control
- VS Code or your preferred code editor
- openssl for generating secrets (comes pre-installed on macOS/Linux)
The easiest way to get started is with our automated setup script. It handles everything for you!
# Clone the repository
git clone https://github.com/robertguss/ai-starter-kit.git
cd ai-starter-kit
# Run the setup script
./setup.shWhat the setup script does:
- ✅ Checks prerequisites (Node.js 18+, pnpm)
- ✅ Installs pnpm automatically if missing
- ✅ Installs all dependencies
- ✅ Guides you through Convex authentication (browser login)
- ✅ Configures all environment variables automatically
- ✅ Starts the development servers
Windows Users: Run
bash setup.shin Git Bash or WSL.
After the script completes, your dev server will be running at http://localhost:3000!
If you prefer to set things up manually, or if the automated setup doesn't work for your environment, follow these steps:
git clone https://github.com/robertguss/ai-starter-kit.git
cd ai-starter-kitOr if you've already downloaded it:
cd ai-starter-kitpnpm installThis will install all required packages (~2-3 minutes depending on your internet speed).
Run the following command to set up your Convex backend:
npx convex devWhat happens next:
-
You'll be prompted to log in or create a Convex account (free)
- Opens a browser window for authentication
- Sign up with GitHub, Google, or email
-
Choose to create a new project or link an existing one
- For first-time users, select "Create a new project"
- Give it a name (e.g., "ai-starter-kit-dev")
-
Convex will:
- Create a
.env.localfile withNEXT_PUBLIC_CONVEX_URL - Start the Convex development server
- Begin watching for changes in your
convex/directory
- Create a
-
Important: After Convex creates your
.env.localfile, you need to addNEXT_PUBLIC_CONVEX_SITE_URL:- Open
.env.localin your editor - Add:
NEXT_PUBLIC_CONVEX_SITE_URL=https://YOUR-DEPLOYMENT-NAME.convex.site - Replace
YOUR-DEPLOYMENT-NAMEwith your actual deployment name (same as inNEXT_PUBLIC_CONVEX_URL, but with.siteinstead of.cloud)
Warning: Do NOT set this to
http://localhost:3000- this will cause infinite loops and 500 errors! - Open
Leave this terminal running! The Convex dev server needs to stay active.
Open a new terminal window (keep the Convex dev server running in the first one) and run:
# Generate and set a secure auth secret
npx convex env set BETTER_AUTH_SECRET $(openssl rand -base64 32)
# Set your local development URL
npx convex env set SITE_URL http://localhost:3000What these do:
BETTER_AUTH_SECRET: Encryption key for session tokens and hashesSITE_URL: Base URL for authentication callbacks and redirects
In your second terminal (or a third if you prefer), run:
pnpm run devThis starts both:
- Next.js frontend on
http://localhost:3000 - Convex backend (if not already running)
-
Open your browser to http://localhost:3000
- You should see the landing page
-
Create an account:
- Navigate to
/signupor click "Sign Up" - Enter an email and password (no email verification required)
- Submit the form
- Navigate to
-
Log in:
- Navigate to
/loginor click "Log In" - Use the credentials you just created
- You should be redirected to
/dashboard
- Navigate to
-
Verify Convex connection:
- Open the Convex Dashboard: https://dashboard.convex.dev
- Or run:
npx convex dashboard - You should see your project and the tables created by Better Auth
-
Run tests (optional but recommended):
# First, generate Convex types npx convex codegen # Run tests pnpm run test:once
If you can sign up, log in, and see the dashboard, you're all set!
Now that you have the starter kit running, here are some suggested next steps:
- Check out the sample charts and data
- Navigate through the sidebar menu
- Try the dark mode toggle
-
Auth Components:
components/login-form.tsxandcomponents/signup-form.tsx- Form handling and validation
- Better Auth integration
-
Protected Routes:
middleware.ts- See how route protection works
- Setup Guide - Detailed configuration options
- Architecture Overview - System design and patterns
- Development Guide - How to add features
- Database Guide - Schema and data modeling
Try adding a new page:
# Create a new page
mkdir -p app/hello
echo 'export default function Hello() { return <h1>Hello, World!</h1> }' > app/hello/page.tsx
# Visit http://localhost:3000/helloCreate a new file convex/greetings.ts:
import { v } from "convex/values";
import { query } from "./_generated/server";
export const sayHello = query({
args: { name: v.string() },
returns: v.string(),
handler: async (ctx, args) => {
return `Hello, ${args.name}!`;
},
});Then in your React components, call it with:
import { useQuery } from "convex/react";
import { api } from "@/convex/_generated/api";
const greeting = useQuery(api.greetings.sayHello, { name: "World" });Solution:
- Make sure you're connected to the internet
- Check that port 3210 isn't already in use
- Try:
npx convex dev --admin-key <key>if you have credentials
Solution:
- Make sure
.env.localexists in the project root - Run
npx convex devagain - it auto-generates this file - Restart your Next.js dev server after the file is created
Solution:
- Verify environment variables are set:
npx convex env list
- You should see
BETTER_AUTH_SECRETandSITE_URL - Make sure
SITE_URLmatches your development URL (usuallyhttp://localhost:3000)
Cause: NEXT_PUBLIC_CONVEX_SITE_URL is set to localhost:3000 instead of your Convex site URL, causing an infinite loop.
Solution:
- Open
.env.local - Find
NEXT_PUBLIC_CONVEX_SITE_URL - Change it from
http://localhost:3000tohttps://YOUR-DEPLOYMENT.convex.site - Restart your dev server
The .convex.site URL is your Convex HTTP endpoint - it should match your deployment name from NEXT_PUBLIC_CONVEX_URL but with .site instead of .cloud.
Solution:
- Stop other processes on port 3000, or
- Run Next.js on a different port:
pnpm run dev:frontend -- -p 3001
- Update
SITE_URLaccordingly:npx convex env set SITE_URL http://localhost:3001
Solution:
- Run Convex codegen first:
npx convex codegen
- This generates TypeScript types needed for tests
Solution:
- Try clearing the cache:
pnpm store prune pnpm install --force
- Or use npm instead:
npm install
- Check the Troubleshooting Guide for more solutions
- Open an issue on GitHub
- Review the Convex documentation
- Node.js 18+ installed
- pnpm installed
- Project cloned
- Dependencies installed (
pnpm install) - Convex initialized (
npx convex dev) -
NEXT_PUBLIC_CONVEX_SITE_URLset correctly in.env.local(must end in.convex.site) - Convex environment variables set (BETTER_AUTH_SECRET, SITE_URL)
- Dev server running (
pnpm run dev) - Can access http://localhost:3000
- Can sign up and log in
- Can access dashboard
Next: Detailed Setup Guide →