Zum Hauptinhalt springen

Development Setup

AI-Generated Content

This documentation page was initially generated by AI to bootstrap the documentation structure. Content may be incomplete or contain inaccuracies. We welcome contributions to improve it.

This guide will help you set up a local development environment for DELEGATOR.

Prerequisites​

Before you begin, ensure you have:

  • Node.js 20.x or later
  • Bun (recommended) or npm/yarn
  • Docker and Docker Compose
  • Git

Getting the Code​

Clone the repository:

git clone https://github.com/DeutscheModelUnitedNations/munify-delegator.git
cd munify-delegator

Installation​

Install dependencies using Bun:

bun install

Or with npm:

npm install

Database Setup​

DELEGATOR uses PostgreSQL. Start the database:

docker compose up -d postgres

Run database migrations:

bun run prisma migrate dev

Seed with sample data (optional):

bun run prisma db seed

Authentication Setup​

DELEGATOR requires an OIDC provider.

Local Development​

Use the included mock provider:

docker compose up -d mock-oidc

Production-like Setup​

Configure your .env file:

OIDC_ISSUER=https://your-provider.com
OIDC_CLIENT_ID=your-client-id
OIDC_CLIENT_SECRET=your-client-secret

Recommended providers:

  • ZITADEL
  • Pocket-ID
  • Logto

Environment Configuration​

Create your .env file:

cp .env.example .env

Key variables:

VariableDescription
DATABASE_URLPostgreSQL connection string
OIDC_ISSUERAuthentication provider URL
OIDC_CLIENT_IDOAuth client ID
OIDC_CLIENT_SECRETOAuth client secret
SESSION_SECRETSession encryption key

Running the Development Server​

Start the development server:

bun run dev

The application will be available at http://localhost:5173.

Tech Stack​

DELEGATOR is built with:

  • Frontend: Svelte 5, SvelteKit
  • Backend: Elysia
  • Database: PostgreSQL with Prisma ORM
  • Auth: OIDC

Running Tests​

Run the test suite:

bun test

Common Issues​

Database Connection​

If you can't connect to the database:

  1. Ensure Docker is running
  2. Check DATABASE_URL format
  3. Verify PostgreSQL container is healthy

Auth Issues​

If authentication fails:

  1. Check OIDC configuration
  2. Verify redirect URLs match
  3. Check provider logs

Next Steps​