Skip to main content
Biovity uses environment variables to configure database connections, authentication, and other settings. Follow these steps to set up your local environment.

Create environment file

1

Copy the example file

Biovity includes an .env.example file with all required variables. Copy it to create your local environment file:
cp .env.example .env.local
Next.js automatically loads .env.local for local development. This file should never be committed to version control.
2

Configure database connection

Update the DATABASE_URL with your PostgreSQL credentials:
.env.local
# Database (PostgreSQL - Supabase)
DATABASE_URL="postgresql://user:password@host:5432/database"
Replace:
  • user - Your PostgreSQL username
  • password - Your PostgreSQL password
  • host - Database host (use localhost for local development)
  • 5432 - PostgreSQL port (default is 5432)
  • database - Your database name
3

Generate authentication secret

Better Auth requires a secret key for signing tokens. Generate one using OpenSSL:
openssl rand -base64 32
Copy the output and add it to your .env.local:
.env.local
# Better Auth (REQUIRED)
BETTER_AUTH_SECRET="your-generated-secret-here"
BETTER_AUTH_URL="http://localhost:3000"
Never share or commit your BETTER_AUTH_SECRET. Generate a new one for each environment.
4

Configure public URLs

Set the public-facing URLs for your application:
.env.local
# Client-side (exposed to browser - safe to expose)
NEXT_PUBLIC_APP_URL="http://localhost:3000"
NEXT_PUBLIC_SITE_URL="https://biovity.cl"
Variables prefixed with NEXT_PUBLIC_ are exposed to the browser. Only use this prefix for non-sensitive values.
5

Set development mode (optional)

Optionally, set the Node environment:
.env.local
# Optional
NODE_ENV=development

Complete environment file

Your final .env.local should look like this:
.env.local
# Database (PostgreSQL - Supabase)
DATABASE_URL="postgresql://user:password@host:5432/database"

# Better Auth (REQUIRED)
# Generate with: openssl rand -base64 32
BETTER_AUTH_SECRET="your-secret-here"
BETTER_AUTH_URL="http://localhost:3000"

# Client-side (exposed to browser - safe to expose)
NEXT_PUBLIC_APP_URL="http://localhost:3000"
NEXT_PUBLIC_SITE_URL="https://biovity.cl"

# Optional
NODE_ENV=development

Environment variables reference

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string
BETTER_AUTH_SECRETYesSecret key for authentication tokens
BETTER_AUTH_URLYesBase URL for authentication callbacks
NEXT_PUBLIC_APP_URLYesPublic application URL
NEXT_PUBLIC_SITE_URLYesProduction site URL
NODE_ENVNoNode environment (development/production)

Next steps

After configuring your environment, proceed to database setup to initialize your PostgreSQL database.

Build docs developers (and LLMs) love