{"id":50881470,"url":"https://github.com/lovanto/daedalus-be","last_synced_at":"2026-06-15T13:03:09.768Z","repository":{"id":363033943,"uuid":"1260160560","full_name":"lovanto/daedalus-be","owner":"lovanto","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-07T04:38:57.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-07T06:21:03.487Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lovanto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-05T08:02:39.000Z","updated_at":"2026-06-07T04:39:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lovanto/daedalus-be","commit_stats":null,"previous_names":["lovanto/daedalus-be"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/lovanto/daedalus-be","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovanto%2Fdaedalus-be","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovanto%2Fdaedalus-be/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovanto%2Fdaedalus-be/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovanto%2Fdaedalus-be/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lovanto","download_url":"https://codeload.github.com/lovanto/daedalus-be/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovanto%2Fdaedalus-be/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34363557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-15T13:03:08.766Z","updated_at":"2026-06-15T13:03:09.750Z","avatar_url":"https://github.com/lovanto.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Daedalus API\n\nGo 1.25 · Chi · pgx/v5 · JWT — REST API for the Agent Development Lifecycle (ADLC) platform.\n\n## Overview\n\nThe API is the single entry point for the frontend. It handles authentication, all ADLC phase data, and proxies AI assist requests to the Python AI layer. The Python service is never called directly by the frontend.\n\nAll responses follow a consistent envelope:\n\n```json\n{ \"data\": ..., \"error\": null }\n{ \"data\": null, \"error\": \"message\" }\n```\n\n## Tech stack\n\n| Dependency | Version |\n|---|---|\n| Go | 1.25 |\n| chi | v5.1.0 |\n| pgx | v5.6.0 |\n| golang-jwt | v5.2.1 |\n| swaggo/swag | v1.16.6 |\n| godotenv | v1.5.1 |\n\n## Project layout\n\n```\nbackend/api/\n├── main.go              # Entry point — router setup, graceful shutdown\n├── config/\n│   └── config.go        # Env-based config loading\n├── db/\n│   └── db.go            # pgx connection pool\n├── handlers/            # HTTP handlers (one file per domain)\n│   ├── auth.go          # register, login, /me\n│   ├── agents.go        # agent CRUD + dashboard summary\n│   ├── phases.go        # phase list \u0026 add\n│   ├── definitions.go   # Define phase data\n│   ├── builds.go        # Build phase data\n│   ├── context.go       # Context snapshots\n│   ├── evals.go         # Eval runs \u0026 cases\n│   ├── observations.go  # Observe phase data\n│   ├── tune.go          # Tune cycles\n│   ├── ai_proxy.go      # Proxy to Python AI service\n│   ├── export_import.go # Agent JSON export/import\n│   └── health.go        # /health\n├── middleware/\n│   ├── auth.go          # JWT Bearer verification\n│   ├── cors.go          # CORS policy\n│   ├── logger.go        # Structured request logging\n│   ├── rate_limit.go    # Per-IP rate limiting\n│   └── request_id.go    # x-request-id propagation\n├── models/              # Domain structs (no ORM)\n├── services/\n│   └── agent_service.go # Gate B logic, confidence score\n├── utils/\n│   ├── response.go      # JSON response helpers\n│   ├── pagination.go    # Cursor/offset pagination\n│   └── ownership.go     # Agent ownership checks\n└── docs/                # Generated Swagger spec (do not edit manually)\n```\n\n## Configuration\n\nCopy `.env.example` from the repo root, or set these environment variables:\n\n```env\nDATABASE_URL=postgres://daedalus:daedalus@localhost:5432/daedalus\nJWT_SECRET=change-me-in-production\nGO_API_PORT=3010\nPYTHON_AI_URL=http://localhost:8001\nGO_ENV=development   # set to \"production\" for JSON logs\n```\n\n## Running locally\n\n```bash\ncd backend/api\n\n# Download dependencies\ngo mod download\n\n# Start the server\ngo run .\n```\n\nThe server logs all registered routes on startup. Swagger UI is available at:\n\n```\nhttp://localhost:3010/swagger/index.html\n```\n\n## API routes\n\n### Auth\n\n```\nPOST   /api/auth/register\nPOST   /api/auth/login\nGET    /api/auth/me              (JWT required)\n```\n\n### Agents\n\n```\nGET    /api/agents/              (JWT required)\nPOST   /api/agents/\nPOST   /api/agents/import\nGET    /api/agents/{id}\nPATCH  /api/agents/{id}\nDELETE /api/agents/{id}\nGET    /api/agents/{id}/export\n```\n\n### ADLC Phase data (all require JWT)\n\n```\nGET/POST  /api/agents/{id}/phases\nGET/POST  /api/agents/{id}/definitions\nGET/POST  /api/agents/{id}/builds\nGET/POST  /api/agents/{id}/context\nGET/POST  /api/agents/{id}/evals\nGET/POST  /api/agents/{id}/eval-cases\nGET/POST  /api/agents/{id}/observations\nGET/POST  /api/agents/{id}/tune-cycles\n```\n\n### AI proxy (all require JWT)\n\n```\nPOST  /api/agents/{id}/ai/assist/define\nPOST  /api/agents/{id}/ai/assist/system-prompt\nPOST  /api/agents/{id}/ai/suggest-eval-cases\nPOST  /api/agents/{id}/ai/classify-failure\nPOST  /api/agents/{id}/ai/run-eval-case\nPOST  /api/agents/{id}/ai/analyze-patterns\nPOST  /api/agents/{id}/ai/check-scope-drift\nPOST  /api/agents/{id}/ai/suggest-tune-fix\nGET   /api/ai/health\n```\n\n### Dashboard\n\n```\nGET  /api/dashboard/summary      (JWT required)\n```\n\n## Authentication\n\nJWT Bearer tokens — 7-day expiry. Include in every authenticated request:\n\n```\nAuthorization: Bearer \u003ctoken\u003e\n```\n\n## Key business rules\n\n- **Confidence score** — rolling average of the last 3 eval scores.\n- **Gate B** — three consecutive evals all \u003e= `confidence_threshold` unlocks deploy.\n- DB migrations are immutable — never edit applied files; add new ones instead.\n\n## Regenerating Swagger docs\n\n```bash\ngo install github.com/swaggo/swag/cmd/swag@latest\nswag init\n```\n\nRe-run after any handler change that modifies `@Summary`, `@Router`, or `@Param` annotations.\n\n## Docker\n\n```bash\ndocker build -t daedalus-api .\ndocker run -p 8000:8000 --env-file .env daedalus-api\n```\n\nOr via the root `docker-compose.yml`:\n\n```bash\ndocker-compose up api\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovanto%2Fdaedalus-be","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flovanto%2Fdaedalus-be","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovanto%2Fdaedalus-be/lists"}