Skip to main content

Environment Variables Overview

The Nurse Handoff Helper uses environment variables to securely store API keys and configuration settings. The application requires separate environment variables for the frontend (Vite) and backend (Node.js server).
All sensitive API keys are stored in environment variables and are never exposed to the browser or committed to version control.

Create Your .env File

Copy the example environment file to create your own:
cp .env.example .env
Then edit the .env file with your actual credentials.

Required Environment Variables

Server Configuration

PORT
number
default:"3001"
The port number for the Express backend server.
PORT=3001

Anthropic API (Required)

ANTHROPIC_API_KEY
string
required
Your Anthropic API key for Claude AI integration. This is used for:
  • Analyzing handoff images
  • Summarizing patient records
  • Extracting structured patient data
The application uses Claude Sonnet 4 (claude-sonnet-4-20250514) for all AI operations.
ANTHROPIC_API_KEY=your_anthropic_api_key_here
Get your API key from the Anthropic Console

Supabase Configuration (Frontend)

VITE_SUPABASE_URL
string
required
Your Supabase project URL. Used by the frontend Vite application.
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY
string
required
Your Supabase anonymous/public key. Safe to use in the browser with Row Level Security (RLS) enabled.
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key

Supabase Configuration (Backend)

SUPABASE_URL
string
required
Your Supabase project URL for backend operations.
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY
string
required
Your Supabase anonymous key for general backend operations.
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_KEY
string
required
Your Supabase service role key with admin privileges. Required for:
  • Creating nurse authentication accounts
  • Admin-level database operations
  • Managing user accounts
SUPABASE_SERVICE_KEY=your_supabase_service_role_key
The service role key bypasses Row Level Security. Keep it secret and never expose it to the frontend or commit it to version control.

Complete .env Example

Here’s a complete example of the .env file:
# Server Configuration
PORT=3001

# AI Provider API Key (Server-side only - SAFE and secure)
# Get your Anthropic API key from: https://console.anthropic.com/
ANTHROPIC_API_KEY=sk-ant-api03-xxxxx

# Supabase Configuration (Frontend - Vite)
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

# Supabase Configuration (Backend)
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
SUPABASE_SERVICE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Security Best Practices

Never Commit Secrets

The .env file is included in .gitignore. Never commit it to version control.

Use Different Keys

Use different Supabase projects for development, staging, and production.

Rotate Keys

Regularly rotate your API keys and service role keys.

Limit Permissions

Use RLS policies in Supabase to limit what the anon key can access.

Verify Configuration

You can verify your environment configuration is correct by checking the health endpoint:
# Start the server
npm run server

# In another terminal, check the health endpoint
curl http://localhost:3001/api/health
You should see a response indicating which services are available:
{
  "status": "ok",
  "availableProviders": {
    "claude": true,
    "supabase": true
  }
}

Troubleshooting

If you see this error:
Missing Supabase environment variables. Check your .env file.
Make sure you’ve set both VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY in your .env file.
If API requests fail with:
Claude API is not configured. Please add ANTHROPIC_API_KEY to .env file.
Verify that your ANTHROPIC_API_KEY is correctly set and valid.
This error appears when trying to create nurse accounts without the service role key. Add SUPABASE_SERVICE_KEY to your .env file.

Next Steps

After configuring your environment:
  1. Set up your Supabase database - see Supabase Setup
  2. Create nurse accounts - see Nurse Accounts
  3. Start the application with npm start

Build docs developers (and LLMs) love