Set Up Environment Variables and the Database
Install dependencies
Run all commands from the repository root:
pnpm install
This also runs nuxt prepare in apps/web, which generates the types.
Setup environment variables
Copy apps/web/.env.example to apps/web/.env and fill in the values. The Nuxt CLI reads this file in development and during the build.
cp apps/web/.env.example apps/web/.env
Every layer declares its environment variables as Zod schemas in the runtimeConfig of its nuxt.config.ts. When a required value is missing, the server refuses to start and lists the missing values (error NUXT_E8014). At runtime only the type, whether a value is required and enum values are checked, not refinements like .min() or .url().
Required environment variables:
NUXT_BETTER_AUTH_SECRET- Secret for better-auth, at least 32 random characters (e.g.openssl rand -base64 32)NUXT_PRIVATE_DATABASE_URL- PostgreSQL connection stringNUXT_PUBLIC_BASE_URL- Your app URL (e.g.,http://localhost:9009for local dev). better-auth uses it as its base URL.NUXT_PRIVATE_POLAR_ACCESS_TOKEN- Polar access tokenNUXT_PRIVATE_EMAIL_CONTACT- Address that receives contact form submissionsNUXT_PRIVATE_FROM_EMAIL- Sender address of all emails
Optional:
NUXT_PRIVATE_POLAR_ORGANIZATION_ID- Your Polar organization IDNUXT_PRIVATE_POLAR_SERVER-sandbox(default) orproduction- OAuth credentials for social login (Google, GitHub), see Authentication
- Email provider settings, see Emails
- Storage settings, see Images
process.env in app code. Add new values as Zod schemas to the nuxt.config.ts of the layer that owns them and to apps/web/.env.example, then read them with useRuntimeConfig().Create database schema
Apply the database migrations:
pnpm db:migrate
The migrations are part of the repository. Run pnpm db:generate only after you change a schema file, see Database.
Start the development server
Start the development server for the web app:
pnpm dev
You can now access your app at http://localhost:9009.
Polar
Nuxt Starter Kit uses Polar to accept payments, see Payments for more information.
This starter kit is designed to support subscriptions (free & Pro) and lifetime deals. You should configure three products in Polar:
- Pro Plan (yearly subscription)
- Pro Plan (monthly subscription)
- Lifetime Deal (one-time payment)
apps/web/layers/payment layer and other parts of the codebase.Installation
Clone the Nuxt Starter Kit repository after your purchase, or create your own repository from the GitHub template, and check the prerequisites first.
Pull Updates
Add the kit repository as a Git remote, fetch the latest changes and merge them into your project on a separate branch, so you can test them first.