Installation
Complete guide to installing, configuring, and deploying OutRiskAI locally or in production.
This guide provides step-by-step instructions for cloning, configuring, migrating, and running OutRiskAI on your local machine or server.
OutRiskAI requires Node.js 20+, pnpm, PostgreSQL 15+ (with pgvector), and a Google Gemini API Key.
System Prerequisites
| Dependency | Minimum Version | Notes |
|---|---|---|
| Node.js | v20.0.0 or higher | Recommended: Node LTS |
| pnpm | v9.0.0 or higher | Primary package manager |
| PostgreSQL | v15.0 or higher | Must support pgvector extension |
| Docker & Docker Compose | Latest | Optional, for local containerized Postgres |
| Google Gemini API Key | — | Required for AI clause analysis (gemini-2.5-flash) |
Step-by-Step Installation
1. Clone the Repository
git clone https://github.com/ssingularitytech/OutRiskAI.git
cd OutRiskAI/app2. Install Project Dependencies
pnpm install3. Environment Configuration
Copy the example environment file and configure your variables:
cp .env.example .envKey Environment Variables
# Application Settings
NEXT_PUBLIC_APP_NAME="OutRiskAI"
NEXT_PUBLIC_APP_URL="http://localhost:3000"
NEXT_PUBLIC_APP_ENV="development"
# Database Connection (PostgreSQL)
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/outriskai?schema=public"
# NextAuth.js Authentication
NEXTAUTH_SECRET="your-generated-nextauth-secret"
NEXTAUTH_URL="http://localhost:3000"
GOOGLE_CLIENT_ID="your-google-oauth-client-id"
GOOGLE_CLIENT_SECRET="your-google-oauth-client-secret"
# AI Service Keys
GOOGLE_API_KEY="your-gemini-api-key"
NEXT_API_KEY="your-internal-api-key"
# DigitalOcean Spaces / S3 Object Storage (Contract Files)
DO_SPACES_ACCESS_KEY="your-access-key"
DO_SPACES_SECRET_KEY="your-secret-key"
DO_SPACES_ENDPOINT="https://nyc3.digitaloceanspaces.com"
DO_SPACES_NAME="outriskai-storage"Generating Secure Secrets
Use OpenSSL to generate random 256-bit secrets:
# NextAuth Secret
openssl rand -base64 32
# Internal API Key
openssl rand -base64 64 | sha256sum | awk '{print $1}'4. Database Setup & Migrations
If using Docker Compose for your local database, start Postgres from the project root:
# Start PostgreSQL container
docker-compose up -d postgresDeploy Prisma database migrations:
# Run migrations
pnpm prisma migrate dev
# Generate Prisma Client
pnpm prisma generateSeed the database with initial categories and administrative data:
pnpm exec node prisma/seed.js5. Start the Development Server
pnpm devThe application will launch at http://localhost:3000.
Operational Verification
Verify your installation by running tests or building the production bundle:
# Run unit & integration tests
pnpm test
# Build production application
pnpm app:buildCommon Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
Port 3000 in use | Another process is bound to 3000 | Run PORT=3001 pnpm dev |
pgvector extension missing | PostgreSQL lacks vector plugin | Run CREATE EXTENSION IF NOT EXISTS vector; in Postgres |
Prisma migration drift | Local DB schema mismatch | Run pnpm prisma migrate reset (Caution: wipes local DB) |