Development
Getting Started

Getting Started

Prerequisites

  • Node.js 20+ (LTS recommended)
  • pnpm 9+ (package manager)
  • PostgreSQL 16+ (local or Neon for dev)

Environment Variables

Copy .env.example to .env.local and fill in:

# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/envara
 
# Auth (Clerk)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...
CLERK_WEBHOOK_SECRET=whsec_...
 
# AI
ANTHROPIC_API_KEY=sk-ant-...
 
# Payments (Stripe)
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
 
# Email (Resend)
RESEND_API_KEY=re_...
 
# Storage (GCS)
GCS_BUCKET=envara-dev
GCS_PROJECT_ID=...
GOOGLE_APPLICATION_CREDENTIALS=./gcs-key.json
 
# App
NEXT_PUBLIC_APP_URL=http://localhost:3000

Database Setup

# Push schema to database (development)
pnpm db:push
 
# Generate migration files (when ready for production)
pnpm db:generate
 
# Run migrations
pnpm db:migrate
 
# Open Drizzle Studio (database GUI)
pnpm db:studio

Running Locally

# Development server with hot reload
pnpm dev
 
# Type checking
pnpm typecheck
 
# Linting
pnpm lint
 
# Run all checks (typecheck + lint + test)
pnpm check

Third-Party Setup

Clerk

  1. Create a Clerk application at clerk.com (opens in a new tab)
  2. Enable Google OAuth and Microsoft OAuth in the social connections settings
  3. Configure the webhook endpoint: {APP_URL}/api/webhooks/clerk
  4. Copy keys to .env.local

Stripe

  1. Create a Stripe account at stripe.com (opens in a new tab)
  2. Create products and prices matching the tier structure
  3. Configure the webhook endpoint: {APP_URL}/api/webhooks/stripe
  4. Use Stripe CLI for local webhook testing: stripe listen --forward-to localhost:3000/api/webhooks/stripe

Resend

  1. Create a Resend account at resend.com (opens in a new tab)
  2. Verify the envara.ai domain
  3. Copy the API key to .env.local