Files
lumina-nextjs-template/.claude/commands/setup.md
2025-12-23 04:19:57 +01:00

3.2 KiB

Projekt Setup Assistent

Du hilfst beim initialen Setup eines neuen Lumina-Projekts.

Setup Checkliste

1. Dependencies installieren

# Mit pnpm (empfohlen)
pnpm install

# Oder mit npm
npm install

2. Environment Variables konfigurieren

# Beispiel-Datei kopieren
cp .env.example .env.local

Bearbeite .env.local:

# Supabase (erforderlich)
NEXT_PUBLIC_SUPABASE_URL=https://YOUR_PROJECT.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key

# Optional
DATABASE_URL=postgresql://user:pass@host:5432/db
REDIS_URL=redis://localhost:6379

3. Supabase Projekt erstellen

  1. Gehe zu supabase.com
  2. Erstelle ein neues Projekt
  3. Kopiere URL und Keys aus Project Settings > API
  4. Füge sie in .env.local ein

4. Datenbank initialisieren

Falls du SQL Migrationen hast:

# Via Supabase CLI
npx supabase db push

# Oder via Dashboard
# - Gehe zu SQL Editor
# - Führe deine Migrations aus

5. Development Server starten

pnpm dev

Öffne http://localhost:3000

Projekt Struktur anlegen

Empfohlene Ordner

# UI Components
mkdir -p components/ui
mkdir -p components/forms
mkdir -p components/layout

# Features
mkdir -p components/features

# API Helpers
mkdir -p lib/api
mkdir -p lib/hooks

# Types
mkdir -p types

Basis-Files erstellen

// types/index.ts
export interface User {
  id: string;
  email: string;
  name?: string;
  avatar_url?: string;
  created_at: string;
}

// lib/hooks/useUser.ts
'use client';
import { useAuth } from '@/contexts/AuthContext';
export function useUser() {
  const { user, loading } = useAuth();
  return { user, loading };
}

TypeScript Types aus Supabase generieren

# Supabase CLI installieren
pnpm add -D supabase

# Login
npx supabase login

# Types generieren
npx supabase gen types typescript --project-id YOUR_PROJECT_ID > lib/database.types.ts

Verwendung:

import { Database } from '@/lib/database.types';

type User = Database['public']['Tables']['users']['Row'];
type NewUser = Database['public']['Tables']['users']['Insert'];

Git Setup

# Falls noch nicht initialisiert
git init

# Initial Commit
git add .
git commit -m "Initial setup"

# Remote hinzufügen (Gitea)
git remote add origin https://gitea.example.com/org/repo.git
git push -u origin main

Nächste Schritte

Nach dem Setup kannst du:

  1. Auth einrichten - /supabase-auth
  2. Datenbank Schema erstellen - /supabase-db
  3. UI Components bauen - /component
  4. API Routes erstellen - /api

Häufige Probleme

"Module not found"

# Cache löschen
rm -rf .next node_modules
pnpm install

Supabase Connection Error

  • URL und Keys prüfen
  • Supabase Projekt ist aktiv (nicht pausiert)
  • Anon Key hat Lese-Rechte

TypeScript Errors

# Type Check
pnpm run lint
npx tsc --noEmit

Frage den Benutzer: Was möchtest du als nächstes einrichten?