# Testing Guide ## Quick Verification ```bash # 1. Start server bun run dev # 2. Health check curl http://localhost:3000/health # 3. Open browser open http://localhost:3000 ``` ## API Endpoints | Endpoint | Method | Purpose | |----------|--------|---------| | `/health` | GET | Server status | | `/api/check/:name` | GET | Name availability | | `/api/deploy` | POST | Start deployment | | `/api/status/:id` | GET | SSE progress stream | | `/api/stack/:name` | DELETE | Delete stack and cleanup | ## Test Checklist ### Backend | Test | Command | Expected | |------|---------|----------| | Server starts | `bun run dev` | "starting on http://0.0.0.0:3000" | | Health endpoint | `curl localhost:3000/health` | `{"status":"healthy"...}` | | TypeScript | `bun run typecheck` | No errors | | Dokploy connection | Check `/api/check/test-name` | Returns availability | ### Frontend | Test | Action | Expected | |------|--------|----------| | Page loads | Open localhost:3000 | Dark theme, centered content | | Typewriter | Wait 2s | "Choose Your Stack Name" animates | | Language switch | Click 🇲🇦 | Arabic text, RTL layout | | Name validation | Type "ab" | Error: too short | | Reserved name | Type "admin" | Error: reserved | | Valid name | Type "my-stack" | "✓ Name is available!" | ### Deployment Flow | Step | Indicator | |------|-----------| | Submit form | Progress bar appears | | SSE updates | Log entries animate in | | Success | Typewriter: "Deployment Complete" | | Error | Typewriter: "Deployment Failed" | ## Infrastructure | Service | URL | Purpose | |---------|-----|---------| | Dokploy | https://app.flexinit.nl | Container orchestration | | Traefik | 144.76.116.169 | SSL termination | | Stacks | *.ai.flexinit.nl | Deployed AI assistants | ## Full Deployment Test ```bash # 1. Generate unique name NAME="test-$(date +%s | tail -c 5)" # 2. Check availability curl -s http://localhost:3000/api/check/$NAME # 3. Deploy curl -s -X POST http://localhost:3000/api/deploy \ -H "Content-Type: application/json" \ -d "{\"name\": \"$NAME\"}" # 4. Monitor SSE (wait ~2-3 min) curl -N http://localhost:3000/api/status/ # 5. Verify stack accessible curl -s https://$NAME.ai.flexinit.nl # 6. Cleanup curl -s -X DELETE http://localhost:3000/api/stack/$NAME ``` ## Cleanup Commands ```bash # Delete specific stack curl -s -X DELETE http://localhost:3000/api/stack/my-stack # List all projects (direct Dokploy) source .env && curl -s -H "x-api-key: $DOKPLOY_API_TOKEN" \ "$DOKPLOY_URL/api/project.all" | jq '.[].name' ``` ## Common Issues | Issue | Solution | |-------|----------| | CSS not loading | Check `/style.css` returns CSS, not HTML | | 401 on Dokploy | Regenerate API token in Dokploy dashboard | | Typewriter not running | Check browser console for JS errors | | RTL not working | Verify `dir="rtl"` on `` element | | Health check timeout | Container startup can take 1-2 min, timeout is 3 min | | SSL cert errors | Health check treats SSL errors as "alive" during provisioning | | SSE disconnects | idleTimeout set to 255s (max), long deployments should complete |