DocumentationAPI Reference
Getting started

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

DependencyMinimum VersionNotes
Node.jsv20.0.0 or higherRecommended: Node LTS
pnpmv9.0.0 or higherPrimary package manager
PostgreSQLv15.0 or higherMust support pgvector extension
Docker & Docker ComposeLatestOptional, 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/app

2. Install Project Dependencies

pnpm install

3. Environment Configuration

Copy the example environment file and configure your variables:

cp .env.example .env

Key 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 postgres

Deploy Prisma database migrations:

# Run migrations
pnpm prisma migrate dev

# Generate Prisma Client
pnpm prisma generate

Seed the database with initial categories and administrative data:

pnpm exec node prisma/seed.js

5. Start the Development Server

pnpm dev

The 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:build

Common Troubleshooting

IssueCauseSolution
Port 3000 in useAnother process is bound to 3000Run PORT=3001 pnpm dev
pgvector extension missingPostgreSQL lacks vector pluginRun CREATE EXTENSION IF NOT EXISTS vector; in Postgres
Prisma migration driftLocal DB schema mismatchRun pnpm prisma migrate reset (Caution: wipes local DB)

Next Steps

On this page