> ## Documentation Index
> Fetch the complete documentation index at: https://guide.oxom.de/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup

> Voraussetzungen, Environment-Variablen und lokale Installation für technische Evaluation.

So bringst du die Workspace-Anwendung lokal oder auf eigener Infrastruktur zum Laufen.

## Voraussetzungen

Du brauchst Accounts für die folgenden Dienste — alle haben kostenlose Tarife.

### Erforderlich

<CardGroup cols={3}>
  <Card title="Clerk" icon="key">
    Authentifizierung. Erstelle eine Application, aktiviere E-Mail/Passwort-Login und kopiere die API-Keys.
  </Card>

  <Card title="Supabase" icon="database">
    Datenbank (Postgres + Row Level Security). Du brauchst URL, Anon-Key und Service-Role-Key.
  </Card>

  <Card title="Liveblocks" icon="users">
    Echtzeit für Docs. Erstelle ein Projekt und kopiere Public- und Secret-Key.
  </Card>
</CardGroup>

<Note>
  `CLERK_JWT_KEY_BASE64` verifiziert Clerk-JWTs in den Supabase-RLS-Policies. Siehe den [Clerk + Supabase Guide](https://clerk.com/docs/integrations/databases/supabase).
</Note>

### Optional

* **[Dub](https://dub.co)** — Link-Shortening. Registriere eine OAuth-App unter `app.dub.co/oauth` mit Redirect-URI `https://deine-domain.de/api/integrations/dub/callback`. Jeder Workspace verbindet sein eigenes Dub-Konto per OAuth — kein globaler API-Key nötig.
* **Cloudflare R2 / S3-kompatibler Speicher** — für Drive. Optional als globaler Fallback-Bucket per Env-Vars, oder pro Workspace via BYOK in den Einstellungen. [Mehr dazu →](/self-hosting/storage)

## Environment-Variablen

Kopiere `.env.example` zu `.env.local` und fülle deine Werte ein.

```bash theme={null}
# ── Auth (Clerk) ──────────────────────────────────────────────
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_...
CLERK_SECRET_KEY=sk_...
CLERK_JWT_KEY_BASE64=            # base64-kodierter PEM-Public-Key für Supabase RLS

# ── Datenbank (Supabase) ──────────────────────────────────────
SUPABASE_URL=https://xxx.supabase.co
SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=
ENCRYPTION_KEY=                  # 32-Byte Hex-String — verschlüsselt BYOK-Credentials

# ── Echtzeit (Liveblocks) ─────────────────────────────────────
NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY=pk_...
LIVEBLOCKS_SECRET_KEY=sk_...

# ── Link-Shortening (Dub — optional) ──────────────────────────
DUB_CLIENT_ID=
DUB_CLIENT_SECRET=

# ── Drive Fallback-Storage (optional — sonst BYOK pro Workspace) ──
R2_ACCOUNT_ID=
R2_ACCESS_KEY_ID=
R2_SECRET_ACCESS_KEY=
R2_BUCKET_NAME=
R2_PUBLIC_BASE_URL=

# ── Branding ──────────────────────────────────────────────────
NEXT_PUBLIC_BRAND_NAME=plattform

# ── App-URL ───────────────────────────────────────────────────
NEXT_PUBLIC_APP_URL=http://localhost:3000
```

Den `ENCRYPTION_KEY` generierst du mit:

```bash theme={null}
openssl rand -hex 32
```

<Warning>
  Der `ENCRYPTION_KEY` verschlüsselt die BYOK-Credentials deiner Workspaces (AES-256-GCM). Ändere ihn nach dem ersten Speichern nicht mehr — sonst sind gespeicherte Credentials nicht mehr lesbar.
</Warning>

## Installation

<Steps>
  <Step title="Repository klonen">
    ```bash theme={null}
    git clone https://github.com/oxom-de/plattform.git
    cd plattform
    ```
  </Step>

  <Step title="Abhängigkeiten installieren">
    ```bash theme={null}
    pnpm install
    ```
  </Step>

  <Step title="Environment einrichten">
    ```bash theme={null}
    cp .env.example .env.local
    # → Werte eintragen
    ```
  </Step>

  <Step title="Datenbank-Migrationen anwenden">
    Wende die SQL-Dateien aus `supabase/migrations/` auf dein Supabase-Projekt an.
  </Step>

  <Step title="Dev-Server starten">
    ```bash theme={null}
    pnpm dev
    ```

    Die App läuft auf [http://localhost:3000](http://localhost:3000).
  </Step>
</Steps>

## Nächste Schritte

* [Drive-Storage mit BYOK einrichten →](/self-hosting/storage)
* [Branding anpassen →](/self-hosting/branding)
