This is the monorepo for BärGPT. You'll find here the frontend, backend, admin-panel and maintenance-mode code.
- BärGPT Dev Documentation
- Framework: React 18 with TypeScript
- Build Tool: Vite
- Routing: React Router
- Styling: Tailwind CSS
- State Management: Zustand
- Authentication: Supabase Auth
- AI Integration: Vercel AI SDK (@ai-sdk/react)
- Document Generation: @mohtasham/md-to-docx, @react-pdf/renderer
- File Uploads and Drag & Drop: react-dropzone, react-dnd
- Markdown: react-markdown with remark-gfm
- Monitoring: Sentry
- Testing: Playwright (E2E), Vitest (Unit), @axe-core/playwright (Accessibility)
- Framework: Hono (lightweight Node.js web framework)
- Runtime: Node.js with TypeScript
- Database: PostgreSQL via Supabase
- LLM Provider: Mistral AI
- AI SDK: Vercel AI SDK with multiple providers (@ai-sdk/azure, @ai-sdk/mistral, @ai-sdk/openai)
- Embeddings: Mistral AI
- Document Processing:
- Gotenberg (PDF conversion)
- mammoth (DOCX parsing)
- xlsx (Excel parsing)
- @opendocsg/pdf2md (PDF to Markdown)
- Observability:
- Langfuse (LLM tracing and monitoring)
- Sentry (error tracking)
- OpenTelemetry (instrumentation)
- Testing: Vitest, Supertest
- Framework: React 18 with TypeScript
- Build Tool: Vite
- UI Components: shadcn/ui (Radix UI primitives)
- Data Tables: TanStack Table (@tanstack/react-table)
- Styling: Tailwind CSS with tailwindcss-animate
- State Management: Zustand
- Authentication: Supabase Auth
- Icons: Lucide React
- Testing: Playwright (E2E), @axe-core/playwright (Accessibility)
- API Rate Limting: Bottleneck, Redis
- Framework: React 18 with TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS
- Testing: Playwright (E2E)
- Database Schema (
libs/db-schema): Shared TypeScript types generated from Supabase - ESLint Config (
libs/eslint): Shared linting rules - Prettier Config (
libs/prettier): Shared formatting rules - TypeScript Config (
libs/typescript-config): Shared TypeScript configurations
- Monorepo Tool: Turborepo
- Package Manager: npm 11.4.2
- Node Version: 22.14.0
- Database & Auth: Supabase (PostgreSQL + Auth + Storage + Realtime)
- Deployment: Vercel (frontend apps), self-hosted options available (backend)
- Containerization: Docker (backend)
- Node.js: Version 22.14.0 (specified in
.nvmrc)- Install via:
nvm install && nvm use
- Install via:
- Supabase CLI: Version specified in
.tool-versions- Install: https://supabase.com/docs/guides/cli
- Docker (optional): For running backend in container or local Supabase
You'll need accounts and API keys for:
- Mistral AI: API key from https://console.mistral.ai/
- Gotenberg: URL and credentials for Gotenberg service (PDF conversion)
- Sentry: DSN from https://sentry.io/ (for error monitoring)
- Redis: Connection string (for the API rate limiting queue)
- Langfuse: Keys from https://langfuse.com/ (for LLM observability)
- Matomo: Analytics URL and site ID (for usage tracking)
# Clone repository
git clone https://github.com/technologiestiftung/baergpt.git
cd baergpt
# Install Node.js version
nvm install && nvm use
# Install dependencies
npm ci
# Install Turborepo globally (optional)
npm install turbo --global
# Install Playwright browsers (for E2E tests)
npx playwright install --with-depscd apps/backend
supabase startThis starts local Supabase services:
- API URL: http://localhost:54321
- Studio (Database UI): http://localhost:54323
- Mailpit (Email Testing): http://localhost:54324
anon key, service_role key, and JWT secret.
- Open Supabase Studio: http://localhost:54323/project/default/database/publications
- Enable the following tables on the Source:
document_folders,documents
This enables real-time subscriptions for these tables.
cd apps/backend
cp .env.sample .envEdit .env and fill in the required values. See .env.sample for all available configuration options.
cd apps/backend
npm run db:resetThis resets the database, generates TypeScript types into libs/db-schema/index.ts, and seeds with initial data.
cd apps/frontend
cp .env.sample .envEdit .env and fill in the required values. See .env.sample for all available configuration options.
cd apps/admin-panel
cp .env.sample .envEdit .env and fill in the required values. See .env.sample for all available configuration options.
No environment configuration needed. This is a static page displayed during maintenance.
Using Turborepo (recommended):
# Run all dev servers
turbo dev
# Run specific apps
turbo dev --filter=frontend --filter=backend
turbo dev --filter=baergpt-frontendIndividual apps:
# Backend (http://localhost:3100)
cd apps/backend && npm run dev
# Frontend (http://localhost:5173)
cd apps/frontend && npm run dev
# Admin Panel (http://localhost:5174)
cd apps/admin-panel && npm run dev
# Maintenance Mode (http://localhost:5175)
cd apps/maintenance-mode && npm run devBackend in a container (Docker Compose):
Runs the built backend image (the exact artifact deployed to Cloud Foundry) to validate the container locally. Not for daily coding (use turbo dev for hot reload).
Requires Supabase running first — supabase start from apps/backend. Then, from the repo root:
docker compose up --build # backend container → http://localhost:3000
docker compose down # stop and remove the container when doneSupabase stays on the CLI; the container reaches it via host.docker.internal. No hot reload — re-run with --build to pick up code changes.
Run all tests from root:
turbo test # All unit tests
turbo test:e2e # All E2E testsRun tests per application:
# Backend (Unit/Integration)
cd apps/backend
npm run test
npm run test:watch # Watch mode
# Frontend (E2E requires Supabase + backend running)
cd apps/frontend
npm run test # Unit tests
npm run test:e2e # E2E tests
npm run test:a11y # Accessibility tests
# Admin Panel
cd apps/admin-panel
npm run test:e2e
# Maintenance Mode
cd apps/maintenance-mode
npm run test:e2e# From root
turbo lint:check # Check linting
turbo lint:write # Fix linting issues
npm run prettier:write # Check formatting
npm run prettier:check # Fix formatting issues
turbo check-types # Type check all packages# Build all apps
turbo build
# Build specific app
cd apps/[app-name]
npm run build
# Backend with Sentry source maps
cd apps/backend
npm run build:prodBuild output locations:
- Frontend:
apps/frontend/dist - Backend:
apps/backend/dist - Admin Panel:
apps/admin-panel/dist - Maintenance Mode:
apps/maintenance-mode/dist
All database commands should be run from apps/backend:
cd apps/backend
# Reset database to initial migration state
npm run db:reset
# Regenerate TypeScript types after schema changes
npm run db:typegen
# Seed database only
npm run db:localseed
# Lint database for common issues
npm run lint:db
# Create new migration
supabase migration new your_migration_name
# Apply all migrations
supabase db resetFor production deployments with self-hosted Supabase, see:
- Guide:
infra/README.md - Uses: Ansible, 1Password CLI, Docker Compose
- Cloud Provider: STACKIT (configurable)
Port Conflicts
Change ports in respective .env files:
- Backend:
PORTinapps/backend/.env - Frontend/Admin Panel:
VITE_PORTin.env
Database Issues
cd apps/backend
supabase db reset
npm run db:typegenModule Not Found
npm ci # from rootSupabase Connection Failed
cd apps/backend
supabase status # Check if runningEmail Confirmation in Development View test emails at: http://localhost:54324 (Mailpit)
TypeScript Errors After Schema Changes
cd apps/backend
npm run db:typegenBuild Errors
# Clear caches and rebuild from root
rm -rf node_modules apps/*/node_modules libs/*/node_modules
npm ci
turbo buildbaergpt/
├── apps/
│ ├── frontend/ # Main user-facing React app
│ ├── backend/ # Hono API + Supabase migrations
│ ├── admin-panel/ # Admin management interface
│ └── maintenance-mode/ # Maintenance page
├── libs/
│ ├── db-schema/ # Generated Supabase types
│ ├── eslint/ # Shared ESLint config
│ ├── prettier/ # Shared Prettier config
│ └── typescript-config/ # Shared TS configs
├── docs/
│ └── adr/ # Architecture Decision Records
├── .nvmrc # Node version
├── turbo.json # Turborepo configuration
└── package.json # Root workspace config
Before you create a pull request, write an issue so we can discuss your changes.
|
Made by
|
A project by
|
Supported by
|