CTO 79191c3810
All checks were successful
Deploy to VPS / deploy (push) Successful in 1m10s
fix: replace pdf-parse with direct pdfjs-dist to fix DOMMatrix error in production
pdf-parse v2 depends on @napi-rs/canvas (native module) which fails in
Next.js standalone Docker builds — native binaries aren't traced/copied
to the standalone output, causing DOMMatrix is not defined at runtime.

Replaced pdf-parse entirely with pdfjs-dist legacy build which works
natively in Node.js without canvas or DOM API dependencies:

- New src/lib/pdf.ts: extractTextFromPdf() using pdfjs-dist/legacy/build
- Worker file explicitly imported so Next.js file tracer includes it
- Updated all call sites: documents, norms/parse, contracts
- Removed pdf-parse from dependencies, added pdfjs-dist directly
- Changed serverExternalPackages from pdf-parse to pdfjs-dist

Verified: build succeeds, both pdf.mjs and pdf.worker.mjs present in
.next/standalone, text extraction works in standalone context.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-10 21:19:20 +00:00

StageAI

WebApp for stage law attorneys (Bühnenrecht). Built with Next.js, PostgreSQL, Meilisearch, and AI-powered contract analysis.

Prerequisites

  • Docker & Docker Compose
  • Node.js 20+ (for local development)
  • Git

Quick Start (Docker)

# Clone the repo
git clone https://mgit.msbls.de/Remmer/StageAI.git
cd StageAI

# Set up environment
cp .env.example .env
# Edit .env with your API keys and secrets

# Start all services
docker compose up -d

# Run database migrations
docker compose exec app npx drizzle-kit push

The app will be available at http://localhost:3000.

Environment Variables

Variable Description Required
DATABASE_URL PostgreSQL connection string Yes
NEXTAUTH_URL App URL for authentication Yes
NEXTAUTH_SECRET Random secret for session encryption Yes
AI_PROVIDER anthropic or openai Yes
ANTHROPIC_API_KEY Anthropic API key If using Anthropic
OPENAI_API_KEY OpenAI API key If using OpenAI
MEILISEARCH_URL Meilisearch URL Yes
MEILISEARCH_API_KEY Meilisearch master key Yes

Local Development

npm install
npm run dev

Database Migrations

Migrations are in the drizzle/ directory, managed by Drizzle Kit.

# Generate a new migration after schema changes
npx drizzle-kit generate

# Apply migrations
npx drizzle-kit push

Deployment (VPS)

A deployment script is included for the production VPS:

# On the VPS (remmer@100.81.230.53):
cd /home/remmer/StageAI
./deploy.sh

This pulls the latest code from Gitea and rebuilds the app container. PostgreSQL and Meilisearch containers are kept running.

Services

Service Port Description
App (Next.js) 3000 Main application
PostgreSQL 5432 Database
Meilisearch 7700 Full-text search engine

Repository

Source code: https://mgit.msbls.de/Remmer/StageAI

Description
LegalAI / StageAI - WebApp für Bühnenrecht-Anwälte
Readme 408 KiB
Languages
TypeScript 98.6%
JavaScript 0.6%
Shell 0.4%
CSS 0.2%
Dockerfile 0.2%