challange29102025/docs/ANLEITUNG.md
2025-10-31 11:08:46 +01:00

2.0 KiB

Setup Anleitung

Quick Start Guide für das OMS

Voraussetzungen

  • Node.js 18+
  • npm
  • Docker (optional)

Installation

Variante 1: Docker (empfohlen)

docker compose up

Das war's!

Variante 2: Lokal

# Dependencies installieren
npm run install:all

# In zwei separaten Terminals:
npm run dev              # Backend (Terminal 1)
npm run dev:frontend     # Frontend (Terminal 2)

API Testen

Mit Browser

  1. Frontend öffnen: http://localhost:3980
  2. Formular ausfüllen
  3. Bestellung abschicken

Mit curl

curl -X POST http://localhost:3990/orders \
  -H "Content-Type: application/json" \
  -d '{
    "customerId": "DW001",
    "customerName": "Lui Denkwerk", 
    "customerEmail": "lui@test.de",
    "items": [{
      "productId": "TISCH1",
      "quantity": 1,
      "price": 200.80
    }],
    "shippingAddress": {
      "street": "Hauptstr. 1",
      "city": "Grevenbroich",
      "postalCode": "41515",
      "country": "DE"
    }
  }'

Tests ausführen

npm test

Production Build

npm run build
npm start

Troubleshooting

Port schon belegt

Backend läuft auf Port 3990 Frontend auf 3980

Ändern in:

  • backend/src/server.ts -> PORT Konstante
  • frontend/vite.config.ts -> proxy config

DB Fehler

Die SQLite DB wird automatisch unter ./data/orders.db erstellt. Falls Probleme: rm -rf data/ und neu starten

Docker Probleme

docker compose down
docker compose build --no-cache
docker compose up

Wichtige Hinweise

  • SQLite DB wird beim ersten Start automatisch angelegt
  • Events werden in der Console geloggt (Simulation)
  • Backend Port ist 3990
  • Frontend Proxy leitet /orders requests an Backend weiter
  • In Production PostgreSQL statt SQLite verwenden

Nächste Schritte

Für Production:

  1. PostgreSQL Setup
  2. Environment Variables (.env)
  3. JWT Auth implementieren
  4. Message Queue für Events
  5. Monitoring Setup
  6. CI/CD Pipeline