98 lines
2.5 KiB
Markdown
98 lines
2.5 KiB
Markdown
# Appwrite Neu-Einrichtung - Schritt für Schritt
|
|
|
|
## Schritt 1: Neues Projekt in Appwrite erstellen
|
|
|
|
1. **Gehe zu Appwrite Dashboard:**
|
|
- Falls du cloud.appwrite.io nutzt: https://cloud.appwrite.io
|
|
- Falls du webklar.com nutzt: https://appwrite.webklar.com
|
|
|
|
2. **Erstelle ein neues Projekt:**
|
|
- Klicke auf "Create Project"
|
|
- Name: `EmailSorter` (oder ein anderer Name)
|
|
- Kopiere die **Project ID** (wird angezeigt)
|
|
|
|
## Schritt 2: API Key erstellen
|
|
|
|
1. **Gehe zu Settings → API Credentials**
|
|
2. **Klicke auf "Create API Key"**
|
|
3. **Konfiguration:**
|
|
- Name: `EmailSorter Backend`
|
|
- Scopes: Wähle **alle Berechtigungen** (Full Access)
|
|
- Expiration: Optional (oder leer lassen für kein Ablaufdatum)
|
|
4. **Kopiere den API Key** (wird nur einmal angezeigt!)
|
|
|
|
## Schritt 3: Datenbank erstellen
|
|
|
|
1. **Gehe zu Databases**
|
|
2. **Klicke auf "Create Database"**
|
|
3. **Konfiguration:**
|
|
- Database ID: `email_sorter_db` (oder ein anderer Name)
|
|
- Name: `EmailSorter Database`
|
|
4. **Kopiere die Database ID**
|
|
|
|
## Schritt 4: .env Dateien aktualisieren
|
|
|
|
### server/.env aktualisieren:
|
|
|
|
```env
|
|
APPWRITE_ENDPOINT=https://appwrite.webklar.com/v1
|
|
# ODER falls cloud.appwrite.io:
|
|
# APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
|
|
|
|
APPWRITE_PROJECT_ID=DEINE_NEW_PROJECT_ID_HIER
|
|
APPWRITE_API_KEY=DEIN_NEW_API_KEY_HIER
|
|
APPWRITE_DATABASE_ID=email_sorter_db
|
|
```
|
|
|
|
### client/.env aktualisieren:
|
|
|
|
```env
|
|
VITE_APPWRITE_ENDPOINT=https://appwrite.webklar.com/v1
|
|
# ODER falls cloud.appwrite.io:
|
|
# VITE_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
|
|
|
|
VITE_APPWRITE_PROJECT_ID=DEINE_NEW_PROJECT_ID_HIER
|
|
```
|
|
|
|
## Schritt 5: Bootstrap ausführen
|
|
|
|
Nachdem du die .env Dateien aktualisiert hast:
|
|
|
|
```powershell
|
|
cd server
|
|
npm run bootstrap:v2
|
|
```
|
|
|
|
Dies erstellt automatisch alle benötigten Collections:
|
|
- `products`
|
|
- `questions`
|
|
- `submissions`
|
|
- `answers`
|
|
- `orders`
|
|
- `email_accounts`
|
|
- `email_stats`
|
|
- `subscriptions`
|
|
- `user_preferences`
|
|
- `email_digests`
|
|
|
|
## Schritt 6: Verifizierung
|
|
|
|
Nach erfolgreichem Bootstrap solltest du sehen:
|
|
- ✓ Database created/exists
|
|
- ✓ Alle Collections wurden erstellt
|
|
- ✓ Alle Attribute wurden hinzugefügt
|
|
|
|
## Troubleshooting
|
|
|
|
**Fehler: "Project not found"**
|
|
- Prüfe, ob die PROJECT_ID korrekt ist
|
|
- Prüfe, ob du den richtigen Endpoint verwendest
|
|
|
|
**Fehler: "Unauthorized"**
|
|
- Prüfe, ob der API_KEY korrekt ist
|
|
- Stelle sicher, dass der API Key alle Berechtigungen hat
|
|
|
|
**Fehler: "Database not found"**
|
|
- Stelle sicher, dass die DATABASE_ID korrekt ist
|
|
- Das Bootstrap-Skript erstellt die Datenbank automatisch, wenn sie nicht existiert
|