Skip to main content
Noteverse uses environment variables to configure various services including API endpoints, authentication, database connections, and file uploads.

Setup

Create a .env.local file in the root directory of your project with the required environment variables.
NEXT_PUBLIC_API_URL=http://localhost:3000/api
NEXT_PUBLIC_SOCKET_URL=http://localhost:3000
NEXT_PUBLIC_UPLOAD_URL=https://your-upload-endpoint.com
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-secret-key-here
DATABASE_URL=postgresql://user:password@localhost:5432/noteverse
Never commit your .env.local file to version control. Add it to your .gitignore file to prevent accidental exposure of sensitive credentials.

Required Variables

Public API Configuration

These variables are prefixed with NEXT_PUBLIC_ and are exposed to the browser.
NEXT_PUBLIC_API_URL
string
required
The base URL for your API endpoints. This is used for making API requests from the client-side.Development: http://localhost:3000/apiProduction: https://your-domain.com/api
NEXT_PUBLIC_SOCKET_URL
string
required
The URL for the Socket.IO server that handles real-time collaboration features.Development: http://localhost:3000Production: https://your-domain.com
NEXT_PUBLIC_UPLOAD_URL
string
required
The endpoint URL for file uploads. Noteverse uses Vercel Blob for edge-compatible blob storage.Example: https://your-storage-endpoint.vercel-storage.com

Authentication (NextAuth.js)

NEXTAUTH_URL
string
required
The canonical URL of your site. This is used by NextAuth.js for redirects and callbacks.Development: http://localhost:3000Production: https://your-domain.com
NEXTAUTH_SECRET
string
required
A random string used to encrypt tokens, sign cookies, and generate cryptographic keys. Generate a secure secret using:
openssl rand -base64 32
Keep this secret secure and never expose it publicly. Changing this value will invalidate all existing sessions.

Database

DATABASE_URL
string
required
PostgreSQL connection string for Prisma ORM. This should include the username, password, host, port, and database name.Format: postgresql://USER:PASSWORD@HOST:PORT/DATABASE?schema=publicExample: postgresql://noteverse_user:password123@localhost:5432/noteverse_db

Optional Variables

Google OAuth (Optional)

If you want to enable Google authentication, add these variables:
GOOGLE_CID
string
Google OAuth Client ID. Obtain this from the Google Cloud Console.
GOOGLE_CS
string
Google OAuth Client Secret. Keep this confidential.

Environment-Specific Configuration

Development

NEXT_PUBLIC_API_URL=http://localhost:3000/api
NEXT_PUBLIC_SOCKET_URL=http://localhost:3000
NEXT_PUBLIC_UPLOAD_URL=http://localhost:3000/api/upload
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=development-secret-change-in-production
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/noteverse_dev

Production

NEXT_PUBLIC_API_URL=https://noteverse.example.com/api
NEXT_PUBLIC_SOCKET_URL=https://noteverse.example.com
NEXT_PUBLIC_UPLOAD_URL=https://blob.vercel-storage.com/noteverse
NEXTAUTH_URL=https://noteverse.example.com
NEXTAUTH_SECRET=<generated-secret-key>
DATABASE_URL=postgresql://user:[email protected]:5432/noteverse_prod
For production deployments on Vercel, set these environment variables in your project settings under Settings > Environment Variables.

Verification

After setting up your environment variables, verify they are loaded correctly:
# Check if variables are loaded (development)
npm run dev
The application should start without errors. If you see warnings about missing environment variables, double-check your .env.local file.

Troubleshooting

If environment variables are not being picked up:
  1. Ensure the .env.local file is in the root directory
  2. Restart your development server after changing environment variables
  3. Verify there are no typos in variable names
  4. Check that NEXT_PUBLIC_ prefix is used for client-side variables

Next Steps

Authentication Setup

Configure NextAuth.js for user authentication

Database Setup

Set up PostgreSQL and Prisma ORM

Build docs developers (and LLMs) love