177 lines
3.2 KiB
Markdown
177 lines
3.2 KiB
Markdown
# Projekt Setup Assistent
|
|
|
|
Du hilfst beim initialen Setup eines neuen Lumina-Projekts.
|
|
|
|
## Setup Checkliste
|
|
|
|
### 1. Dependencies installieren
|
|
|
|
```bash
|
|
# Mit pnpm (empfohlen)
|
|
pnpm install
|
|
|
|
# Oder mit npm
|
|
npm install
|
|
```
|
|
|
|
### 2. Environment Variables konfigurieren
|
|
|
|
```bash
|
|
# Beispiel-Datei kopieren
|
|
cp .env.example .env.local
|
|
```
|
|
|
|
Bearbeite `.env.local`:
|
|
|
|
```env
|
|
# 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](https://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:
|
|
|
|
```bash
|
|
# Via Supabase CLI
|
|
npx supabase db push
|
|
|
|
# Oder via Dashboard
|
|
# - Gehe zu SQL Editor
|
|
# - Führe deine Migrations aus
|
|
```
|
|
|
|
### 5. Development Server starten
|
|
|
|
```bash
|
|
pnpm dev
|
|
```
|
|
|
|
Öffne [http://localhost:3000](http://localhost:3000)
|
|
|
|
## Projekt Struktur anlegen
|
|
|
|
### Empfohlene Ordner
|
|
|
|
```bash
|
|
# 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
|
|
|
|
```typescript
|
|
// 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
|
|
|
|
```bash
|
|
# 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:
|
|
|
|
```typescript
|
|
import { Database } from '@/lib/database.types';
|
|
|
|
type User = Database['public']['Tables']['users']['Row'];
|
|
type NewUser = Database['public']['Tables']['users']['Insert'];
|
|
```
|
|
|
|
## Git Setup
|
|
|
|
```bash
|
|
# 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"
|
|
```bash
|
|
# 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
|
|
```bash
|
|
# Type Check
|
|
pnpm run lint
|
|
npx tsc --noEmit
|
|
```
|
|
|
|
---
|
|
|
|
Frage den Benutzer: Was möchtest du als nächstes einrichten?
|