Skip to main content
Biovity requires specific environment variables to function properly. This guide covers all required and optional variables you need to configure.

Database configuration

Biovity uses PostgreSQL as its database, typically hosted on Supabase.
DATABASE_URL
string
required
PostgreSQL connection string for your database.Format: postgresql://user:password@host:5432/databaseExample:
DATABASE_URL="postgresql://postgres:mypassword@db.example.supabase.co:5432/postgres"

Authentication

Biovity uses Better Auth for authentication. These variables are required for the auth system to work.
BETTER_AUTH_SECRET
string
required
Secret key used to sign and verify authentication tokens. Must be a cryptographically secure random string.Generate with:
openssl rand -base64 32
Example:
BETTER_AUTH_SECRET="your-generated-secret-here"
BETTER_AUTH_URL
string
required
The base URL where your Better Auth API is accessible. This should match your application’s URL.Development:
BETTER_AUTH_URL="http://localhost:3000"
Production:
BETTER_AUTH_URL="https://yourdomain.com"
Never commit your BETTER_AUTH_SECRET to version control. Generate a new secret for each environment (development, staging, production).

Client-side variables

These variables are prefixed with NEXT_PUBLIC_ and are exposed to the browser. Only include non-sensitive information.
NEXT_PUBLIC_APP_URL
string
required
The public URL of your application. Used for client-side redirects and API calls.Development:
NEXT_PUBLIC_APP_URL="http://localhost:3000"
Production:
NEXT_PUBLIC_APP_URL="https://yourdomain.com"
NEXT_PUBLIC_SITE_URL
string
required
The canonical URL of your site. Used for SEO and social sharing.Example:
NEXT_PUBLIC_SITE_URL="https://biovity.cl"

Optional variables

NODE_ENV
string
default:"development"
The environment mode for Node.js. Automatically set by most deployment platforms.Values: development, production, testExample:
NODE_ENV=production

Setting up your environment

1

Copy the example file

Create your local environment file from the example:
cp .env.example .env.local
2

Generate authentication secret

Generate a secure secret for Better Auth:
openssl rand -base64 32
Copy the output and set it as BETTER_AUTH_SECRET in your .env.local file.
3

Configure database URL

Add your PostgreSQL connection string to DATABASE_URL. If using Supabase, you can find this in your project settings under “Database” > “Connection string”.
4

Set application URLs

Configure BETTER_AUTH_URL, NEXT_PUBLIC_APP_URL, and NEXT_PUBLIC_SITE_URL to match your deployment environment.

Deployment platforms

When deploying to platforms like Vercel, add these environment variables in your project settings:
  1. Navigate to your project settings
  2. Go to “Environment Variables”
  3. Add each variable with the appropriate value for your environment
  4. Select which environments (Production, Preview, Development) should use each variable
Most platforms automatically set NODE_ENV based on the deployment environment. You typically don’t need to set this manually.

Build docs developers (and LLMs) love