Getting Started
Set up Unstack Pro and get your development environment running
Getting Started
Get up and running in 10 minutes. Auth is already configured - you just need to connect the services.
No auth UI setup required. Just connect Convex, Resend, and Autumn, then start building.
What You're Setting Up
You're not configuring auth - that's already done. You're just:
- Connecting to Convex (database)
- Connecting to Resend (emails - required for sign-in)
- Connecting to Autumn (billing - optional, required only if you want organization billing)
- Setting a secret key for cryptographic operations
That's it. Then you have a fully working app with auth, organizations, and admin.
Prerequisites
Before you begin, make sure you have the following installed:
- Node.js 22+: Download here
- npm, pnpm, yarn, or bun: Package manager of your choice
- Git: Download here
Installation
Clone the Repository
git clone https://github.com/unstack-pro/nextjs-convex.git # Purchasing will provide access to the private repo
cd nextjs-convexInstall Dependencies
npm installpnpm installyarn installbun installSet Up Convex
-
Create a Convex account at convex.dev
-
Install Convex CLI (if not already installed):
npm install -g convex -
Initialize Convex in your project:
npx convex devThis will:
- Create a new Convex deployment
- Generate your deployment URL
- Start the Convex dev server
-
Note your Convex URLs - you'll need these for environment variables:
CONVEX_DEPLOYMENTNEXT_PUBLIC_CONVEX_URLNEXT_PUBLIC_CONVEX_SITE_URL
Configure Environment Variables
-
Copy the example environment file:
cp .env.example .env.local -
Fill in your environment variables. See the Environment Variables page for detailed explanations.
Minimum required variables (all are required for the app to function):
BETTER_AUTH_SECRET="your-generated-secret" BETTER_AUTH_URL="http://localhost:3000" RESEND_API_KEY="re_your_resend_api_key" EMAIL_FROM="Your App <no-reply@yourdomain.com>" AUTUMN_API_KEY="am_sk_your_autumn_key" NEXT_PUBLIC_APP_URL="http://localhost:3000" CONVEX_DEPLOYMENT="dev:your-deployment-name" NEXT_PUBLIC_CONVEX_URL="https://your-deployment.convex.cloud" NEXT_PUBLIC_CONVEX_SITE_URL="https://your-deployment.convex.site" PASSKEY_RP_ID="localhost" NEXT_PUBLIC_APP_NAME="Your App Name" -
Set up Convex environment variables:
# Authentication npx convex env set BETTER_AUTH_SECRET "your-generated-secret" npx convex env set BETTER_AUTH_URL "http://localhost:3000" # Email npx convex env set RESEND_API_KEY "re_your_resend_api_key" npx convex env set EMAIL_FROM "Your App <no-reply@yourdomain.com>" # Payments (optional - only if using billing) npx convex env set AUTUMN_API_KEY "am_sk_your_autumn_key" # Application npx convex env set NEXT_PUBLIC_APP_URL "http://localhost:3000" npx convex env set NEXT_PUBLIC_APP_NAME "Your App Name" # Passkeys npx convex env set PASSKEY_RP_ID "localhost"
Generate Authentication Secret
Generate a secure random secret for Better Auth:
openssl rand -base64 32node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"Use this value for BETTER_AUTH_SECRET in both .env.local and Convex environment.
Set Up Email (Required)
Email verification is required for users to sign in. You'll need a Resend account:
- Sign up at resend.com
- Get your API key
- Add to
.env.localand Convex:RESEND_API_KEY="RESEND API KEY" EMAIL_FROM="Unstack Pro <no-reply@auth.unstack.pro>"
Email verification is required for sign-in. Without Resend configured, users cannot complete registration.
Start Development Server
npm run devpnpm devyarn devbun devYour app should now be running at http://localhost:3000! 🎉
Verify Installation
After starting the development server, you should:
- Visit the homepage: Navigate to
http://localhost:3000 - Register an account: Click "Register" and create a test account
- Check Convex dashboard: Log into your Convex dashboard to see data being created
- Explore features: Try logging in, creating an organization, etc.
Next Steps
Now that you have Unstack Pro running locally, here are some recommended next steps:
- 📖 Learn about Authentication - Understand the auth system
- 🏢 Explore Organizations - Multi-tenant features
- 🔧 Review Environment Variables - Complete configuration
- 🏗️ Study Project Structure - Understand the codebase
- 🚀 Plan Deployment - Get ready for production
Common Issues
Convex Connection Issues
Make sure your Convex dev server is running:
npx convex devEnvironment Variable Not Found
Double-check that:
.env.localexists in the root directory- All required variables are set
- Convex environment variables are configured via
npx convex env setor their dashboard
Authentication Errors
Ensure:
BETTER_AUTH_SECRETis set in both.env.localand ConvexBETTER_AUTH_URLmatches your development URL- Convex deployment is running
Never commit your .env.local file to version control. It contains sensitive secrets.
Development Tips
- Hot Reload: Changes to your code will automatically reload
- Convex Dashboard: Monitor your database in real-time at dashboard.convex.dev
- Better Auth: Uses secure httpOnly cookies for session management
- Type Safety: Full TypeScript support throughout the project
Need help? Check out the other documentation pages or review the code examples in the project.