---
name: kanban_cpp_backend
lang: go
domain: tools
version: 0.1.0
description: "Backend HTTP del kanban_cpp v2: sirve dev/issues y dev/flows con parser MD bidireccional + SQLite cache + fsnotify watcher + SSE"
tags: [service, kanban, go, sqlite, sse]
uses_functions:
  - parse_issue_md_go_infra
  - write_issue_md_go_infra
  - scan_issues_dir_go_infra
  - scan_flows_dir_go_infra
  - watch_dir_fsnotify_go_infra
uses_types:
  - issue_go_infra
  - flow_go_infra
  - fs_event_go_infra
framework: ""
entry_point: "main.go"
dir_path: "apps/kanban_cpp/backend"
repo_url: "https://gitea.organic-machine.com/dataforge/kanban_cpp"
service:
  port: 8487
  health_endpoint: /api/health
  health_timeout_s: 3
  systemd_unit: null
  systemd_scope: null
  restart_policy: none
  runtime: manual
  pc_targets:
    - home-wsl
  is_local_only: true
e2e_checks:
  - id: build
    cmd: "cd apps/kanban_cpp/backend && CGO_ENABLED=1 go build -o kanban_cpp_backend ."
    timeout_s: 180
  - id: tests
    cmd: "cd apps/kanban_cpp/backend && CGO_ENABLED=1 go test -count=1 ./..."
    timeout_s: 60
  - id: smoke_health
    cmd: "cd apps/kanban_cpp/backend && ./kanban_cpp_backend --port 18487 --db /tmp/kanban_cpp_e2e.db --registry /home/lucas/fn_registry &\nsleep 2\ncurl -fsS http://127.0.0.1:18487/api/health\npkill -f kanban_cpp_backend || true"
    timeout_s: 30
---

# kanban_cpp_backend

Servicio HTTP local que sirve `dev/issues/` y `dev/flows/` al frontend C++ ImGui (`apps/kanban_cpp/`).

## Endpoints

- `GET  /api/health` — counts + version.
- `GET  /api/issues?status=&priority=&scope=&domain=&tag=&completed=` — lista.
- `GET  /api/issues/{id}` — detalle + body.
- `PATCH /api/issues/{id}` — reescribe frontmatter en disco. Body intacto.
- `GET  /api/flows` — lista.
- `GET  /api/flows/{id}` — detalle.
- `GET  /api/meta` — enums (statuses, priorities, scopes, types).
- `GET  /api/sse` — stream cambios (incl. mods externas en disco).

## Run

```bash
cd apps/kanban_cpp/backend
CGO_ENABLED=1 go build -o kanban_cpp_backend .
./kanban_cpp_backend --port 8487 --registry /home/lucas/fn_registry
```

El binario auto-detecta el root del registry buscando `registry.db` hacia arriba si no se pasa `--registry`.

## Esquema

Ver `migrations/001_init.sql`. SQLite WAL. Las filas se upsertean en cada ingest/watch event.
