The application needs the following environment variables to run:
PostgreSQL connection string. Format: postgresql://username:password@host:port/database
Options:
- Local PostgreSQL: If you have PostgreSQL installed locally:
DATABASE_URL=postgresql://postgres:password@localhost:5432/pr_reviewer - Cloud Database: Use services like:
- Neon (free tier available)
- Supabase (free tier available)
- Railway (free tier available)
- ElephantSQL (free tier available)
Get your API key from: https://platform.openai.com/api-keys
A Personal Access Token from GitLab with api scope.
Get it from: https://gitlab.com/-/profile/personal_access_tokens
Note: The api scope covers all necessary permissions including Merge Requests, Repository access, and Comments.
Server port. Defaults to 5000 if not set.
Must be at least 32 characters. The server exits on startup if this is missing or too short when NODE_ENV=production.
Comma-separated browser origins allowed to call the API with cookies (CORS), e.g. https://your-app.vercel.app. Copy variable names from .env.example.
-
Create a
.envfile in the project root:DATABASE_URL=postgresql://user:password@localhost:5432/pr_reviewer OPENAI_API_KEY=your_openai_api_key_here PORT=5000
-
Install a package to load .env files:
npm install dotenv
-
Update
server/index.tsto load .env file (add at the top):import 'dotenv/config';
$env:DATABASE_URL="postgresql://user:password@localhost:5432/pr_reviewer"
$env:OPENAI_API_KEY="your_openai_api_key_here"
$env:PORT="5000"
npm run devset DATABASE_URL=postgresql://user:password@localhost:5432/pr_reviewer
set OPENAI_API_KEY=your_openai_api_key_here
set PORT=5000
npm run devAfter setting DATABASE_URL, you need to create the database schema:
npm run db:pushThis will create all the required tables in your database.
npm run devThe server will start on port 5000 (or the port specified in PORT environment variable).
Access the application at: http://localhost:5000
- Make sure you've set the DATABASE_URL environment variable
- Check that the connection string is correct
- Verify PostgreSQL is running (if using local database)
- Check that the database exists
- Verify username, password, host, and port are correct
- Verify your OPENAI_API_KEY is correct
- Check that you have API credits available
- Ensure the API key has the necessary permissions