API Documentation

API Documentation

Base URL

The API base URL is: http://localhost:3000/api/v1

Authentication

Most endpoints require authentication using a JWT token. Include it in the Authorization header:

Authorization: Bearer <your-jwt-token>

Endpoints

Authentication

Login with GitHub

POST /auth/github

Response:

{
  "access_token": "jwt_token_here",
  "user": {
    "id": "user_id",
    "email": "user@example.com"
  }
}

Projects

List Projects

GET /projects

Create Project

POST /projects
Content-Type: application/json

{
  "name": "Project Name",
  "description": "Project Description",
  "githubUrl": "https://github.com/user/repo"
}

Virtual Machines

List VMs

GET /vms

Create VM

POST /vms
Content-Type: application/json

{
  "name": "vm-name",
  "projectId": "project-id",
  "specifications": {
    "cpu": 2,
    "memory": 4096,
    "disk": 20
  }
}

Error Handling

The API uses standard HTTP status codes and returns errors in this format:

{
  "statusCode": 400,
  "message": "Error message here",
  "error": "Bad Request"
}

Rate Limiting

API requests are limited to:

  • 100 requests per minute for authenticated users
  • 20 requests per minute for unauthenticated users

Websocket Events

Connect to websocket at: ws://localhost:3000/events

Event Types

  • vm.status: VM status updates
  • project.update: Project changes
  • metrics.update: System metrics updates