Installation
Self-hosted installation guide for Cortex.
Prerequisites
- Node.js 18 or later
- PostgreSQL 14+ (with pgvector extension)
- Qdrant (vector database)
- OpenAI API key (for embeddings)
Quick Start
# Clone the repository
git clone https://github.com/cortex-labs/cortex.git
cd cortex
# Install dependencies
npm install
# Set up environment
cp .env.example .env
# Edit .env with your configuration
# Run database migrations
npm run db:generate
npm run db:migrate
# Start development server
npm run dev
Open http://localhost:4040 in your browser.
Environment Variables
# Database (PostgreSQL with pgvector)
DATABASE_URL=postgresql://user:password@localhost:5432/cortex
# Vector DB (Qdrant)
QDRANT_URL=http://localhost:6333
# Authentication
AUTH_SECRET=your-random-secret-here
AUTH_URL=http://localhost:4040
AUTH_GITHUB_ID=your-github-client-id
AUTH_GITHUB_SECRET=your-github-client-secret
# AI/Embeddings
OPENAI_API_KEY=sk-your-openai-key
# App
NEXT_PUBLIC_APP_URL=http://localhost:4040
NODE_ENV=development
Database Setup
Neon (Recommended)
- Create a Neon account
- Create a new project
- Enable pgvector:
CREATE EXTENSION IF NOT EXISTS vector; - Copy the connection string to
DATABASE_URL
Local PostgreSQL
# Install pgvector
brew install pgvector
# Create database
createdb cortex
# Enable extension
psql cortex -c "CREATE EXTENSION IF NOT EXISTS vector;"
Qdrant Setup
# Docker (recommended)
docker run -p 6333:6333 qdrant/qdrant
# Or with persistent storage
docker run -p 6333:6333 -v qdrant_data:/qdrant/storage qdrant/qdrant
Demo Credentials
After setup, use these to log in:
- Email: demo@cortex.dev
- Password: cortex123