Getting Started
1. Installation
git clone https://github.com/eCondorDigital/exercise-engine.gitcd exercise-enginenpm install2. Configure environment variables
cp .env.example .envEdit .env:
HTTP_PORT=4000TCP_PORT=4001TCP_HOST=0.0.0.0API_KEY=sk_default_dev_key_change_in_productionTTS_SERVICE_URL=http://tts-service:80003. Generate your first API Key
Option A: Use the default key
The API_KEY variable in your .env already works:
sk_default_dev_key_change_in_production⚠️ Change it in production.
Option B: Generate a new key via API
Start the server:
npm run start:devThen call the admin endpoint:
curl -X POST http://localhost:4000/api/v1/admin/keys \ -H "Content-Type: application/json" \ -d '{"name": "my-app-frontend"}'Response:
{ "key": "sk_a1b2c3d4e5f6...", "message": "Save this key securely. It will not be shown again."}Save the key immediately. It will never be shown again.
Option C: Generate manually
node -e "console.log('sk_' + require('crypto').randomBytes(24).toString('hex'))"Then set it in your .env:
API_KEY=your_generated_key4. List active API keys
curl http://localhost:4000/api/v1/admin/keysResponse:
[ { "keyPreview": "sk_a1b2c...xyz9", "name": "my-app-frontend", "createdAt": "2026-05-04T13:00:00.000Z", "lastUsedAt": "2026-05-04T13:05:00.000Z", "isActive": true }]5. Evaluate an exercise
curl -X POST http://localhost:4000/api/v1/exercises/evaluate \ -H "x-api-key: sk_your_api_key" \ -H "Content-Type: application/json" \ -d '{ "exerciseId": "ex_001", "area": "listening", "type": "multiple_choice", "answer": "B", "correctAnswer": "B", "difficulty": 2 }'Response:
{ "correct": true, "score": 10, "feedback": "Correct!", "metadata": { "area": "listening", "type": "multiple_choice" }}6. Explore API Docs
Open your browser at:
http://localhost:4000/api/docsYou’ll see the Swagger UI with:
- All endpoints documented
- Request/response examples
- “Authorize” button to add your API key
- Interactive testing (Try it out)
7. Run with Docker
docker compose up -d --buildBoth services (NestJS + TTS) run together.
Next steps
- API Reference — Complete endpoint documentation
- Exercise Types — Supported exercise types
- Grid Engines — Word Search and Crossword generation