Three steps to production: Set up shadcn/ui, initialize Convex, add a component. You’ll have a working app in minutes.
Prerequisites
Before you begin, make sure you have:- Node.js 18+ installed on your machine
- A React project (Next.js, Vite, TanStack Start, or React Router)
- Basic familiarity with React and TypeScript
Step 1: Set up shadcn/ui
Convex UI components are built on shadcn/ui. Choose your framework and follow the official setup guide:Next.js
Recommended for full-stack apps with SSR
Vite
Fast development for SPAs and client-side apps
TanStack Start
Modern routing with React Router foundation
Already using shadcn/ui? Skip to Step 2. Convex UI works with your existing setup.
- Configure Tailwind CSS
- Set up your
components.jsonconfig file - Install base UI dependencies
- Create your component directory structure
Step 2: Initialize Convex
Install Convex and initialize your project:No account required for local development. Convex runs entirely on your machine until you’re ready to deploy.
convex dev command will:
Generate environment variables
Adds
NEXT_PUBLIC_CONVEX_URL (or VITE_CONVEX_URL) to your .env.local fileWhat gets created
After initialization, your project will have:Step 3: Add your first component
Now you can add any Convex UI component. Let’s start with realtime chat:- Next.js
- React (Vite)
- TanStack Start
Frontend
components/realtime-chat.tsxcomponents/chat-message.tsxhooks/use-realtime-chat.tsx
Backend
convex/schema.ts(messages table)convex/messages.ts(queries & mutations)
Step 4: Use the component
Import and use the chat component in your app:- Next.js
- React (Vite)
- TanStack Start
app/page.tsx
Open multiple browser windows to see messages sync in realtime!
Add authentication
For a more complete app, add password-based authentication:- Next.js
- React (Vite)
- TanStack Start
- ✅ Login form with email/password
- ✅ Signup with validation
- ✅ Password reset flow
- ✅ Protected route middleware
- ✅ User session management
- ✅ Convex Auth configuration
Configure email provider
For password reset emails, configure Resend in the Convex dashboard:Get a Resend API key
Sign up at resend.com and create an API key
What’s next?
Explore components
Browse all available components including file uploads, cursors, and presence
Customize styling
Modify Tailwind classes or update your theme in
components.jsonExtend backend functions
Learn how to write custom queries and mutations in Convex
Deploy to production
Push your app live with
npx convex deployTroubleshooting
Components not installing correctly
Components not installing correctly
Try deleting your
components.json file and running the shadcn/ui init command again for your framework. This resets your configuration to the latest defaults.Convex dev server not starting
Convex dev server not starting
Make sure you have Node.js 18+ installed:If you’re behind a firewall, you may need to configure proxy settings. Check the Convex troubleshooting guide.
TypeScript errors in generated files
TypeScript errors in generated files
Restart your TypeScript server in VS Code:
- Press
Cmd/Ctrl + Shift + P - Type “TypeScript: Restart TS Server”
- Press Enter
_generated folder updates automatically when convex dev is running.Environment variables not working
Environment variables not working
Make sure your Vite, TanStack, React Router:Restart your dev server after changing environment variables.
.env.local file has the correct variable names:Next.js:Still having issues? Check the FAQ or visit the Convex Discord for help.