mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-18 06:29:40 +02:00
refactor: restructure
monorepo with apps/ and services/ directories
This commit is contained in:
parent
25824ed0ac
commit
ff80aeec1f
4062 changed files with 2592 additions and 1278 deletions
213
apps/uload/docs/features/pocketbase/POCKETBASE-DEV-SETUP-PLAN.md
Normal file
213
apps/uload/docs/features/pocketbase/POCKETBASE-DEV-SETUP-PLAN.md
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
# PocketBase Development Setup - Implementierungsplan
|
||||
|
||||
## 🎯 Ziel
|
||||
Vollständige Trennung von Development und Production Datenbanken, ähnlich wie bei Redis.
|
||||
|
||||
## 📋 Aktuelle Situation
|
||||
|
||||
### Probleme:
|
||||
- ❌ Beide Umgebungen nutzen Production DB (`https://pb.ulo.ad`)
|
||||
- ❌ Gefahr von Testdaten in Production
|
||||
- ❌ Keine lokale Entwicklungsumgebung
|
||||
- ❌ Hardcoded Production URLs im Code
|
||||
- ❌ Inkonsistente Environment-Variable-Nutzung
|
||||
|
||||
### Vorhandene Ressourcen:
|
||||
- ✅ PocketBase Binary bereits in `backend/` vorhanden
|
||||
- ✅ `npm run backend` Script existiert
|
||||
- ✅ Lokale DB-Dateien in `backend/pb_data/`
|
||||
- ✅ Schema-Migrations in `backend/pb_migrations/`
|
||||
|
||||
## 🛠 Implementierungsplan
|
||||
|
||||
### Phase 1: Lokale PocketBase einrichten (15 Min)
|
||||
|
||||
1. **PocketBase starten**
|
||||
```bash
|
||||
cd backend
|
||||
./pocketbase serve
|
||||
```
|
||||
- Läuft auf http://localhost:8090
|
||||
- Admin UI: http://localhost:8090/_/
|
||||
|
||||
2. **Admin Account erstellen**
|
||||
- Beim ersten Start wird Admin-Account angelegt
|
||||
- Credentials sicher speichern
|
||||
|
||||
3. **Schema von Production kopieren**
|
||||
```bash
|
||||
# Export von Production (manuell über Admin UI)
|
||||
# Import in lokale Instanz
|
||||
```
|
||||
|
||||
### Phase 2: Environment Variables korrigieren (10 Min)
|
||||
|
||||
1. **.env.development anpassen**
|
||||
```env
|
||||
# PocketBase Configuration (Local Development)
|
||||
PUBLIC_POCKETBASE_URL=http://localhost:8090
|
||||
POCKETBASE_URL=http://localhost:8090
|
||||
|
||||
# PocketBase Admin (for local development)
|
||||
POCKETBASE_ADMIN_EMAIL=admin@localhost
|
||||
POCKETBASE_ADMIN_PASSWORD=localdevpassword123
|
||||
```
|
||||
|
||||
2. **.env.production erstellen**
|
||||
```env
|
||||
# PocketBase Configuration (Production)
|
||||
PUBLIC_POCKETBASE_URL=https://pb.ulo.ad
|
||||
POCKETBASE_URL=https://pb.ulo.ad
|
||||
```
|
||||
|
||||
### Phase 3: Code-Anpassungen (20 Min)
|
||||
|
||||
1. **src/lib/pocketbase.ts**
|
||||
```typescript
|
||||
import { dev } from '$app/environment';
|
||||
|
||||
// Automatic environment detection
|
||||
const POCKETBASE_URL = import.meta.env.PUBLIC_POCKETBASE_URL ||
|
||||
(dev ? 'http://localhost:8090' : 'https://pb.ulo.ad');
|
||||
```
|
||||
|
||||
2. **Hardcoded URLs entfernen**
|
||||
- `src/routes/p/[username]/+page.server.ts:16`
|
||||
- `src/lib/scripts/update-links-collection.js:6`
|
||||
- `src/routes/api/verify/+server.ts:15`
|
||||
|
||||
3. **CSP Headers anpassen**
|
||||
- `src/hooks.server.ts` - Dynamische CSP basierend auf Environment
|
||||
|
||||
### Phase 4: Daten-Migration (30 Min)
|
||||
|
||||
1. **Test-Daten erstellen**
|
||||
```bash
|
||||
# Script für Sample-Daten
|
||||
npm run seed:dev
|
||||
```
|
||||
|
||||
2. **Production Snapshot (optional)**
|
||||
- Export wichtiger Test-Links
|
||||
- Anonymisierte User-Daten
|
||||
- Keine echten Produktionsdaten!
|
||||
|
||||
3. **Migrations synchronisieren**
|
||||
```bash
|
||||
# Alle Migrations lokal ausführen
|
||||
cd backend
|
||||
./pocketbase migrate up
|
||||
```
|
||||
|
||||
### Phase 5: Development Workflow (10 Min)
|
||||
|
||||
1. **Start-Scripts optimieren**
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"dev": "npm run dev:frontend",
|
||||
"dev:frontend": "vite dev",
|
||||
"dev:backend": "cd backend && ./pocketbase serve",
|
||||
"dev:all": "concurrently \"npm:dev:backend\" \"npm:dev:frontend\"",
|
||||
"dev:setup": "npm run dev:backend:setup && npm run dev:seed"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. **Docker Alternative (optional)**
|
||||
```yaml
|
||||
# docker-compose.dev.yml
|
||||
services:
|
||||
pocketbase:
|
||||
image: ghcr.io/pocketbase/pocketbase:latest
|
||||
ports:
|
||||
- "8090:8090"
|
||||
volumes:
|
||||
- ./backend/pb_data:/pb_data
|
||||
```
|
||||
|
||||
### Phase 6: Testing & Validation (15 Min)
|
||||
|
||||
1. **Connection Tests**
|
||||
- Verify localhost:8090 responds
|
||||
- Check Admin UI access
|
||||
- Test API endpoints
|
||||
|
||||
2. **Feature Tests**
|
||||
- Create link
|
||||
- Register user
|
||||
- Authentication flow
|
||||
- Stripe webhooks (mit lokaler URL)
|
||||
|
||||
3. **Data Isolation**
|
||||
- Verify no production data access
|
||||
- Check environment variables
|
||||
- Test fallback mechanisms
|
||||
|
||||
## 🚀 Quick Start (Nach Implementierung)
|
||||
|
||||
```bash
|
||||
# 1. Backend starten
|
||||
npm run dev:backend
|
||||
|
||||
# 2. In neuem Terminal: Frontend starten
|
||||
npm run dev:frontend
|
||||
|
||||
# Oder alles zusammen:
|
||||
npm run dev:all
|
||||
```
|
||||
|
||||
## ⚠️ Wichtige Überlegungen
|
||||
|
||||
### Daten-Synchronisation
|
||||
- **NICHT** Production-Daten lokal spiegeln
|
||||
- Nur Schema/Structure synchronisieren
|
||||
- Test-Daten separat verwalten
|
||||
|
||||
### Secrets Management
|
||||
- Lokale Admin-Credentials nur für Dev
|
||||
- Keine Production-Secrets in .env.development
|
||||
- Stripe Test-Keys für lokale Entwicklung
|
||||
|
||||
### Backup Strategy
|
||||
- Lokale DB regelmäßig committen? (ohne sensible Daten)
|
||||
- Schema-Änderungen als Migrations tracken
|
||||
- Production Backups separat
|
||||
|
||||
## 📊 Vergleich: Vorher vs Nachher
|
||||
|
||||
| Aspekt | Vorher | Nachher |
|
||||
|--------|---------|---------|
|
||||
| Dev Database | Production (pb.ulo.ad) | Lokal (localhost:8090) |
|
||||
| Test-Daten | In Production! | Isoliert lokal |
|
||||
| Performance | Netzwerk-Latenz | Instant (lokal) |
|
||||
| Sicherheit | Risiko für Prod-Daten | Vollständig getrennt |
|
||||
| Offline-Arbeit | Nicht möglich | Voll funktionsfähig |
|
||||
|
||||
## 🔄 Migration Checkliste
|
||||
|
||||
- [ ] Lokale PocketBase starten
|
||||
- [ ] Admin Account erstellen
|
||||
- [ ] Schema importieren
|
||||
- [ ] Environment Variables anpassen
|
||||
- [ ] Code von hardcoded URLs befreien
|
||||
- [ ] Test-Daten erstellen
|
||||
- [ ] Alle Features lokal testen
|
||||
- [ ] Team-Dokumentation aktualisieren
|
||||
- [ ] CI/CD Pipeline anpassen
|
||||
|
||||
## 🎉 Vorteile nach Implementierung
|
||||
|
||||
1. **Sicherer** - Keine Produktionsdaten-Gefährdung
|
||||
2. **Schneller** - Lokale DB ohne Netzwerk-Latenz
|
||||
3. **Flexibler** - Experimente ohne Konsequenzen
|
||||
4. **Offline-fähig** - Arbeiten ohne Internet
|
||||
5. **Team-freundlich** - Jeder hat eigene DB
|
||||
|
||||
## 📚 Nächste Schritte
|
||||
|
||||
1. Entscheidung treffen: Sofort umsetzen oder planen?
|
||||
2. Team informieren über Änderungen
|
||||
3. Migration durchführen
|
||||
4. Dokumentation für Team erstellen
|
||||
5. CI/CD anpassen für neue Struktur
|
||||
122
apps/uload/docs/features/pocketbase/POCKETBASE-MANUAL-SETUP.md
Normal file
122
apps/uload/docs/features/pocketbase/POCKETBASE-MANUAL-SETUP.md
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
# PocketBase Collections - Manuelle Einrichtung
|
||||
|
||||
Da der Schema-Import nicht funktioniert (veraltetes Format), musst du die Collections manuell erstellen.
|
||||
|
||||
## 🎯 Admin Login
|
||||
|
||||
1. Gehe zu: http://localhost:8090/_/
|
||||
2. Login mit:
|
||||
- Email: `till.schneider@memoro.ai`
|
||||
- Password: `p0ck3t-RAJ`
|
||||
|
||||
## 📦 Collections erstellen
|
||||
|
||||
### 1. Links Collection
|
||||
|
||||
**Collections → New collection → Base collection**
|
||||
|
||||
**Name:** `links`
|
||||
|
||||
**Fields hinzufügen (+ New field):**
|
||||
|
||||
| Field Name | Type | Required | Options |
|
||||
|------------|------|----------|---------|
|
||||
| `short_code` | text | ✅ | Unique: ✅, Min: 3, Max: 50 |
|
||||
| `original_url` | url | ✅ | - |
|
||||
| `title` | text | ❌ | Max: 200 |
|
||||
| `description` | text | ❌ | Max: 500 |
|
||||
| `user_id` | relation | ❌ | Collection: users, Max select: 1, Cascade delete: ✅ |
|
||||
| `is_active` | bool | ❌ | - |
|
||||
| `password` | text | ❌ | - |
|
||||
| `max_clicks` | number | ❌ | Min: 0 |
|
||||
| `expires_at` | date | ❌ | - |
|
||||
| `click_count` | number | ❌ | - |
|
||||
| `tags` | json | ❌ | - |
|
||||
|
||||
**API Rules:**
|
||||
- List/View rule: `` (leer = public)
|
||||
- Create rule: `@request.auth.id != ""`
|
||||
- Update rule: `@request.auth.id = user_id`
|
||||
- Delete rule: `@request.auth.id = user_id`
|
||||
|
||||
### 2. Clicks Collection
|
||||
|
||||
**Collections → New collection → Base collection**
|
||||
|
||||
**Name:** `clicks`
|
||||
|
||||
**Fields:**
|
||||
|
||||
| Field Name | Type | Required | Options |
|
||||
|------------|------|----------|---------|
|
||||
| `link_id` | relation | ✅ | Collection: links, Max select: 1, Cascade delete: ✅ |
|
||||
| `ip_hash` | text | ❌ | - |
|
||||
| `user_agent` | text | ❌ | - |
|
||||
| `referer` | text | ❌ | - |
|
||||
| `browser` | text | ❌ | - |
|
||||
| `device_type` | text | ❌ | - |
|
||||
| `os` | text | ❌ | - |
|
||||
| `country` | text | ❌ | - |
|
||||
| `city` | text | ❌ | - |
|
||||
| `clicked_at` | date | ❌ | - |
|
||||
|
||||
**API Rules:**
|
||||
- List/View rule: `` (leer = public)
|
||||
- Create rule: `` (leer = public)
|
||||
- Update rule: `null` (keine Updates erlaubt)
|
||||
- Delete rule: `@request.auth.id = link_id.user_id`
|
||||
|
||||
### 3. Accounts Collection (Optional)
|
||||
|
||||
**Collections → New collection → Base collection**
|
||||
|
||||
**Name:** `accounts`
|
||||
|
||||
**Fields:**
|
||||
|
||||
| Field Name | Type | Required | Options |
|
||||
|------------|------|----------|---------|
|
||||
| `name` | text | ✅ | - |
|
||||
| `owner` | relation | ✅ | Collection: users, Max select: 1 |
|
||||
| `members` | relation | ❌ | Collection: users, Multiple: ✅ |
|
||||
| `isActive` | bool | ❌ | - |
|
||||
| `planType` | select | ❌ | Values: free, team, enterprise |
|
||||
| `settings` | json | ❌ | - |
|
||||
|
||||
## ✅ Nach dem Erstellen
|
||||
|
||||
1. **Speichern** nicht vergessen (Save button oben rechts)
|
||||
|
||||
2. **Test-Daten laden:**
|
||||
```bash
|
||||
node scripts/seed-local-db.js
|
||||
```
|
||||
|
||||
3. **App testen:**
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## 🎉 Fertig!
|
||||
|
||||
Deine lokale PocketBase ist jetzt bereit mit:
|
||||
- Admin Account ✅
|
||||
- Collections ✅
|
||||
- Test-Daten (nach Seed-Script)
|
||||
|
||||
## 📝 Test-URLs
|
||||
|
||||
Nach dem Seed-Script:
|
||||
- http://localhost:5173/test1 - Normaler Link
|
||||
- http://localhost:5173/test2 - Link mit Click-Limit
|
||||
- http://localhost:5173/protected - Passwort: `secret123`
|
||||
|
||||
## 🔍 Troubleshooting
|
||||
|
||||
**"Collection not found" Fehler?**
|
||||
- Stelle sicher, dass alle Collections erstellt und gespeichert wurden
|
||||
- Name muss exakt sein (case-sensitive)
|
||||
|
||||
**"Invalid relation" Fehler?**
|
||||
- Erst Links Collection erstellen, dann Clicks
|
||||
- Users Collection existiert bereits (Standard Auth)
|
||||
233
apps/uload/docs/features/pocketbase/pocketbase-local-setup.md
Normal file
233
apps/uload/docs/features/pocketbase/pocketbase-local-setup.md
Normal file
|
|
@ -0,0 +1,233 @@
|
|||
# PocketBase Local Development Setup
|
||||
|
||||
## ✅ Was wurde implementiert
|
||||
|
||||
### 1. Environment Separation
|
||||
- **Development**: `http://localhost:8090` (lokal)
|
||||
- **Production**: `https://pb.ulo.ad` (Coolify)
|
||||
- Automatische Umgebungserkennung basierend auf `dev` Flag
|
||||
|
||||
### 2. Code-Änderungen
|
||||
- ✅ `.env.development` - Lokale PocketBase URL
|
||||
- ✅ `.env.production` - Production PocketBase URL
|
||||
- ✅ `src/lib/pocketbase.ts` - Dynamische URL-Auswahl
|
||||
- ✅ `src/routes/p/[username]/+page.server.ts` - Environment-basierte URL
|
||||
- ✅ `src/lib/scripts/update-links-collection.js` - Flexible URL
|
||||
- ✅ `src/routes/api/verify/+server.ts` - Dynamische Redirect URL
|
||||
- ✅ `src/hooks.server.ts` - CSP Headers für beide Umgebungen
|
||||
|
||||
### 3. Sicherheit
|
||||
- Keine hardcoded Production URLs mehr
|
||||
- Vollständige Trennung von Dev/Prod Daten
|
||||
- Lokale Entwicklung ohne Internetverbindung möglich
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### 1. PocketBase starten
|
||||
|
||||
```bash
|
||||
# Terminal 1: Backend
|
||||
cd backend
|
||||
./pocketbase serve
|
||||
|
||||
# Läuft auf http://localhost:8090
|
||||
# Admin UI: http://localhost:8090/_/
|
||||
```
|
||||
|
||||
### 2. Admin Account erstellen
|
||||
|
||||
1. Öffne http://localhost:8090/_/
|
||||
2. Erstelle Admin Account (nur beim ersten Mal)
|
||||
3. Merke dir die Credentials
|
||||
|
||||
### 3. Schema importieren
|
||||
|
||||
**Option A: Manuell über UI**
|
||||
1. Login als Admin
|
||||
2. Settings → Import/Export
|
||||
3. Load from JSON → `backend/pb_schema.json`
|
||||
4. Review → Confirm
|
||||
|
||||
**Option B: Automatisch (wenn Collections existieren)**
|
||||
```bash
|
||||
# Schema ist bereits in backend/pb_migrations/
|
||||
cd backend
|
||||
./pocketbase migrate up
|
||||
```
|
||||
|
||||
### 4. Test-Daten erstellen
|
||||
|
||||
```bash
|
||||
# Seed Script ausführen
|
||||
node scripts/seed-local-db.js
|
||||
```
|
||||
|
||||
Erstellt:
|
||||
- 2 Test-User (test@localhost, demo@localhost)
|
||||
- 4 Test-Links (normal, protected, expired, limited)
|
||||
- Sample Click-Daten
|
||||
|
||||
### 5. App starten
|
||||
|
||||
```bash
|
||||
# Terminal 2: Frontend
|
||||
npm run dev
|
||||
|
||||
# Oder alles zusammen:
|
||||
npm run dev:all
|
||||
```
|
||||
|
||||
## 📝 Test-Credentials
|
||||
|
||||
### Users
|
||||
```
|
||||
Email: test@localhost
|
||||
Password: test123456
|
||||
|
||||
Email: demo@localhost
|
||||
Password: demo123456
|
||||
```
|
||||
|
||||
### Links
|
||||
- `http://localhost:5173/test1` - Normaler Link
|
||||
- `http://localhost:5173/test2` - Mit Click-Limit (100)
|
||||
- `http://localhost:5173/protected` - Password: `secret123`
|
||||
- `http://localhost:5173/expired` - Abgelaufener Link
|
||||
|
||||
### Admin
|
||||
```
|
||||
URL: http://localhost:8090/_/
|
||||
Email: [deine Admin Email]
|
||||
Password: [dein Admin Password]
|
||||
```
|
||||
|
||||
## 🔍 Verification
|
||||
|
||||
### 1. Environment Check
|
||||
```bash
|
||||
# In Browser Console sollte stehen:
|
||||
🔧 PocketBase URL: http://localhost:8090
|
||||
🔧 Environment: development
|
||||
🔧 Dev mode: true
|
||||
```
|
||||
|
||||
### 2. API Health
|
||||
```bash
|
||||
curl http://localhost:5173/health
|
||||
# sollte zeigen: "pocketbase": "running"
|
||||
```
|
||||
|
||||
### 3. Feature Tests
|
||||
- [ ] User Registration
|
||||
- [ ] Login/Logout
|
||||
- [ ] Link erstellen
|
||||
- [ ] Link redirect
|
||||
- [ ] Password-geschützte Links
|
||||
- [ ] Click-Tracking
|
||||
|
||||
## 🛠 Troubleshooting
|
||||
|
||||
### PocketBase startet nicht
|
||||
|
||||
```bash
|
||||
# Port bereits belegt?
|
||||
lsof -i :8090
|
||||
|
||||
# Process beenden
|
||||
kill -9 [PID]
|
||||
|
||||
# Neu starten
|
||||
cd backend && ./pocketbase serve
|
||||
```
|
||||
|
||||
### "Collection not found" Fehler
|
||||
|
||||
1. Schema importieren (siehe oben)
|
||||
2. Oder Collections manuell erstellen:
|
||||
- users (auth)
|
||||
- links
|
||||
- clicks
|
||||
- accounts
|
||||
|
||||
### Environment Variables nicht geladen
|
||||
|
||||
```bash
|
||||
# .env.development muss existieren
|
||||
cat .env.development
|
||||
|
||||
# Sollte enthalten:
|
||||
PUBLIC_POCKETBASE_URL=http://localhost:8090
|
||||
```
|
||||
|
||||
### CORS Fehler
|
||||
|
||||
PocketBase erlaubt standardmäßig alle Origins in Development.
|
||||
Falls Probleme: Admin UI → Settings → API Rules
|
||||
|
||||
## 📊 Development vs Production
|
||||
|
||||
| Aspekt | Development | Production |
|
||||
|--------|------------|------------|
|
||||
| PocketBase URL | http://localhost:8090 | https://pb.ulo.ad |
|
||||
| Datenbank | Lokal (SQLite) | Cloud (Coolify) |
|
||||
| Auth | Test-Accounts | Echte User |
|
||||
| Stripe | Test-Keys | Live-Keys |
|
||||
| Redis | localhost:6379 | Coolify Redis |
|
||||
| SSL | Nein (HTTP) | Ja (HTTPS) |
|
||||
| CSP | Relaxed | Strict |
|
||||
|
||||
## 🔄 Daten-Synchronisation
|
||||
|
||||
### Schema Updates von Production holen
|
||||
|
||||
```bash
|
||||
# 1. Export aus Production (Admin UI)
|
||||
# 2. Speichern als backend/pb_schema.json
|
||||
# 3. Lokal importieren
|
||||
```
|
||||
|
||||
### Migrations erstellen
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
./pocketbase migrate create "add_new_field"
|
||||
# Edit migration file
|
||||
./pocketbase migrate up
|
||||
```
|
||||
|
||||
## 🎯 Best Practices
|
||||
|
||||
1. **Niemals Production-Daten lokal speichern**
|
||||
2. **Separate Test-Accounts verwenden**
|
||||
3. **Schema-Änderungen als Migrations tracken**
|
||||
4. **Regelmäßig lokale DB zurücksetzen**
|
||||
|
||||
```bash
|
||||
# Lokale DB reset
|
||||
rm backend/pb_data/*.db
|
||||
cd backend && ./pocketbase serve
|
||||
# Schema neu importieren
|
||||
```
|
||||
|
||||
## 🚢 Deployment
|
||||
|
||||
Beim Deployment nach Production:
|
||||
1. Environment wird automatisch erkannt
|
||||
2. Production URLs werden verwendet
|
||||
3. Keine Code-Änderungen nötig!
|
||||
|
||||
```bash
|
||||
# Build für Production
|
||||
npm run build
|
||||
|
||||
# Preview Production Build lokal
|
||||
npm run preview
|
||||
# Nutzt automatisch Production-Config!
|
||||
```
|
||||
|
||||
## 📚 Weitere Ressourcen
|
||||
|
||||
- [PocketBase Docs](https://pocketbase.io/docs/)
|
||||
- [Admin UI Guide](https://pocketbase.io/docs/admin-ui/)
|
||||
- [API Rules](https://pocketbase.io/docs/api-rules-and-filters/)
|
||||
- [Migrations](https://pocketbase.io/docs/migrations/)
|
||||
124
apps/uload/docs/features/pocketbase/pocketbase-setup.md
Normal file
124
apps/uload/docs/features/pocketbase/pocketbase-setup.md
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
# Pocketbase Setup
|
||||
|
||||
## Installation
|
||||
|
||||
### 1. Pocketbase SDK installieren
|
||||
|
||||
```bash
|
||||
npm install pocketbase
|
||||
```
|
||||
|
||||
### 2. Pocketbase Backend herunterladen
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
./download-pocketbase.sh
|
||||
```
|
||||
|
||||
Das Script lädt automatisch die richtige Version für deine Plattform herunter (macOS ARM64/AMD64).
|
||||
|
||||
### 3. MCP Server für Claude Code einrichten
|
||||
|
||||
```bash
|
||||
# MCP Server Repository klonen
|
||||
mkdir -p mcp-servers && cd mcp-servers
|
||||
git clone https://github.com/mrwyndham/pocketbase-mcp.git
|
||||
|
||||
# Dependencies installieren und bauen
|
||||
cd pocketbase-mcp
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
Der MCP Server ermöglicht Claude Code direkte Interaktion mit Pocketbase (Collections erstellen, Records verwalten, etc.).
|
||||
|
||||
## Server starten
|
||||
|
||||
### Einzeln starten
|
||||
|
||||
```bash
|
||||
# Backend
|
||||
npm run backend
|
||||
|
||||
# Frontend
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Beide gleichzeitig starten
|
||||
|
||||
```bash
|
||||
npm run dev:all
|
||||
```
|
||||
|
||||
## Admin-Account erstellen
|
||||
|
||||
### Über Terminal (empfohlen)
|
||||
|
||||
```bash
|
||||
/app/pocketbase superuser create till.schneider@memoro.ai p0ck3t-RA1N
|
||||
```
|
||||
|
||||
|
||||
### Über Web-Interface
|
||||
|
||||
1. Pocketbase starten: `npm run backend`
|
||||
2. Browser öffnen: http://127.0.0.1:8090/_/
|
||||
3. Admin-Account über das Setup-Formular erstellen
|
||||
|
||||
## Zugriff
|
||||
|
||||
- **Pocketbase Admin Panel**: http://127.0.0.1:8090/_/
|
||||
- **API Endpoint**: http://127.0.0.1:8090/api/
|
||||
- **Frontend (SvelteKit)**: http://localhost:5173
|
||||
|
||||
## Projekt-Struktur
|
||||
|
||||
```
|
||||
uload/
|
||||
├── backend/ # Pocketbase Backend
|
||||
│ ├── pocketbase # Pocketbase Binary
|
||||
│ ├── pb_data/ # Datenbank & Uploads
|
||||
│ └── pb_migrations/ # Datenbank-Migrationen
|
||||
├── mcp-servers/ # MCP Server für Claude Code
|
||||
│ └── pocketbase-mcp/ # Pocketbase MCP Integration
|
||||
│ └── build/ # Gebauter MCP Server
|
||||
├── src/
|
||||
│ └── lib/
|
||||
│ └── pocketbase.ts # Pocketbase Client-Konfiguration
|
||||
├── docs/ # Dokumentation
|
||||
└── .mcp.json # MCP Konfiguration (in .gitignore)
|
||||
```
|
||||
|
||||
## MCP Server Konfiguration
|
||||
|
||||
Die `.mcp.json` Datei wird automatisch erstellt und enthält:
|
||||
|
||||
- Pfad zum MCP Server
|
||||
- Pocketbase URL (http://127.0.0.1:8090)
|
||||
- Admin-Zugangsdaten
|
||||
|
||||
**Wichtig**: Die `.mcp.json` ist in `.gitignore` aufgeführt, da sie sensible Daten enthält.
|
||||
|
||||
### Claude Code neu starten
|
||||
|
||||
Nach der MCP-Einrichtung muss Claude Code neu gestartet werden:
|
||||
|
||||
```bash
|
||||
cd /Users/tillschneider/Documents/__00__Code/uload
|
||||
claude
|
||||
```
|
||||
|
||||
Überprüfe die MCP-Integration mit:
|
||||
|
||||
```
|
||||
/mcp
|
||||
```
|
||||
|
||||
## Pocketbase Client verwenden
|
||||
|
||||
```typescript
|
||||
import { pb } from '$lib/pocketbase';
|
||||
|
||||
// Beispiel: Records abrufen
|
||||
const records = await pb.collection('links').getFullList();
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue