> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markup.freddiephilpot.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment Variables

> Environment configuration reference for Markup.

# Environment Variables

Markup uses environment variables for database connectivity, authentication, and application configuration.

Create a `.env.local` file in the project root.

***

# Full Example

```dotenv theme={null}
# PostgreSQL / Prisma
DATABASE_URL=postgresql://markup:password@localhost:5432/markup

# WorkOS AuthKit
WORKOS_CLIENT_ID=client_xxxxxxxxx
WORKOS_API_KEY=sk_test_xxxxxxxxx
WORKOS_COOKIE_PASSWORD=replace_with_secure_random_string
NEXT_PUBLIC_WORKOS_REDIRECT_URI=http://localhost:3000/api/auth/callback
```

***

# Database Variables

## DATABASE\_URL

PostgreSQL connection string used by Prisma.

Example:

```dotenv theme={null}
DATABASE_URL=postgresql://username:password@localhost:5432/markup
```

### Format

```txt theme={null}
postgresql://USER:PASSWORD@HOST:PORT/DATABASE
```

### Example Providers

#### Local PostgreSQL

```dotenv theme={null}
DATABASE_URL=postgresql://postgres:password@localhost:5432/markup
```

#### Docker PostgreSQL

```dotenv theme={null}
DATABASE_URL=postgresql://markup:markup_password@db:5432/markup
```

#### Supabase

```dotenv theme={null}
DATABASE_URL=postgresql://postgres:[PASSWORD]@db.[PROJECT].supabase.co:5432/postgres
```

#### Neon

```dotenv theme={null}
DATABASE_URL=postgresql://user:password@ep-example.eu-central-1.aws.neon.tech/markup?sslmode=require
```

***

# WorkOS Variables

## WORKOS\_CLIENT\_ID

Client ID for your WorkOS application.

Example:

```dotenv theme={null}
WORKOS_CLIENT_ID=client_123456789
```

***

## WORKOS\_API\_KEY

Secret API key from the WorkOS dashboard.

Example:

```dotenv theme={null}
WORKOS_API_KEY=sk_test_123456789
```

Keep this value private.

***

## WORKOS\_COOKIE\_PASSWORD

Encryption secret used for session cookies.

Generate a secure value:

```bash theme={null}
openssl rand -base64 32
```

Example:

```dotenv theme={null}
WORKOS_COOKIE_PASSWORD=long_secure_random_string
```

***

## NEXT\_PUBLIC\_WORKOS\_REDIRECT\_URI

Authentication callback URL.

### Local Development

```dotenv theme={null}
NEXT_PUBLIC_WORKOS_REDIRECT_URI=http://localhost:3000/api/auth/callback
```

### Production Example

```dotenv theme={null}
NEXT_PUBLIC_WORKOS_REDIRECT_URI=https://yourdomain.com/api/auth/callback
```

***

# Local Development Example

```dotenv theme={null}
DATABASE_URL=postgresql://markup:password@localhost:5432/markup

WORKOS_CLIENT_ID=client_xxxxx
WORKOS_API_KEY=sk_test_xxxxx
WORKOS_COOKIE_PASSWORD=super_secure_random_string
NEXT_PUBLIC_WORKOS_REDIRECT_URI=http://localhost:3000/api/auth/callback
```

***

# Docker Example

```dotenv theme={null}
DATABASE_URL=postgresql://markup:markup_password@db:5432/markup

WORKOS_CLIENT_ID=client_xxxxx
WORKOS_API_KEY=sk_test_xxxxx
WORKOS_COOKIE_PASSWORD=super_secure_random_string
NEXT_PUBLIC_WORKOS_REDIRECT_URI=http://localhost:3000/api/auth/callback
```

***

# Production Recommendations

* Never commit `.env.local`
* Use strong random secrets
* Store secrets in your hosting provider
* Rotate API keys periodically
* Restrict database network access
* Enable SSL for production PostgreSQL connections

***

# Common Issues

## Prisma Cannot Connect to Database

Check:

* PostgreSQL is running
* Database credentials are correct
* Port is accessible
* SSL settings are configured correctly

***

## WorkOS Redirect Errors

Ensure the callback URL matches exactly:

```txt theme={null}
/api/auth/callback
```

Also verify the redirect URI is configured in the WorkOS dashboard.

***

# Ignoring Environment Files

Add environment files to `.gitignore`:

```gitignore theme={null}
.env
.env.local
.env.production
```
