Quick Start
Get CORTEX running locally and make your first API call.
Prerequisites
- Node.js 20+
- pnpm 8+
- Docker & Docker Compose
- Git
Step 1: Clone & Install
git clone https://dev.azure.com/cortex/cortex-platform/_git/cortex-platform
cd cortex-platform
pnpm install
Step 2: Start Infrastructure
# Start PostgreSQL and Redis
docker-compose -f infra/docker/docker-compose.yml up -d
# Navigate to core service
cd apps/core
# Apply database migrations
pnpm db:migrate:deploy
# Seed initial data (system roles, permissions)
pnpm db:seed
Step 3: Configure Environment
Create .env file in apps/core:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/cortex?schema=public"
JWT_SECRET="your-super-secret-jwt-key-min-32-chars"
JWT_REFRESH_SECRET="your-super-secret-refresh-key-min-32-chars"
Step 4: Start the API
# Start in development mode
pnpm dev
The API is now running at http://localhost:8091.
Step 5: Make Your First API Call
Check Health
curl http://localhost:8091/health
Response:
{
"status": "ok",
"service": "cortex-core",
"version": "0.1.0",
"timestamp": "2024-01-15T10:30:00.000Z",
"environment": "development"
}
Register a User
curl -X POST http://localhost:8091/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "admin@mycompany.com",
"password": "SecureP@ss123",
"firstName": "Admin",
"lastName": "User",
"tenantId": "<your-tenant-id>"
}'
Login
curl -X POST http://localhost:8091/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "admin@mycompany.com",
"password": "SecureP@ss123"
}'
Response:
{
"accessToken": "eyJhbGciOiJIUzI1NiIs...",
"refreshToken": "eyJhbGciOiJIUzI1NiIs...",
"user": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"email": "admin@mycompany.com",
"firstName": "Admin",
"lastName": "User"
}
}
Access a Protected Endpoint
curl http://localhost:8091/auth/me \
-H "Authorization: Bearer <your-access-token>"
Step 6: Explore the API
Visit the interactive API documentation:
- Scalar UI: http://localhost:8091/api-docs
- Swagger UI: http://localhost:8091/api-docs/swagger
Next Steps
- Environment Setup — Configure all environment variables
- Authentication Guide — Deep dive into auth flows
- Multi-Tenancy Guide — Understand the tenant model