Skip to content

Add FastAPI backend, auth, AI chat, and fix Docker healthcheck - #11

Open
sanjay289 wants to merge 9 commits into
ed-donner:mainfrom
sanjay289:main
Open

Add FastAPI backend, auth, AI chat, and fix Docker healthcheck#11
sanjay289 wants to merge 9 commits into
ed-donner:mainfrom
sanjay289:main

Conversation

@sanjay289

@sanjay289 sanjay289 commented Aug 10, 2026

Copy link
Copy Markdown

Implements the backend, auth, and AI chat for the Kanban MVP described in AGENTS.md/docs/PLAN.md, plus a Docker healthcheck fix and a code review of the whole repo.

Summary

  • Docker: fix the Compose healthcheck, which ran curl against the final image even though it isn't installed there (python3.12-bookworm-slim) \u2014 swapped to Python's urllib, which is already present. Added the Dockerfile, start/stop scripts (Mac/Linux/PowerShell), and supporting .dockerignore/.env.example.
  • Backend (backend/app/): FastAPI app \u2014 hardcoded-credential login with in-memory sessions, SQLite-backed board/column/card CRUD (created and seeded on first run), an OpenRouter client, and a /api/chat endpoint that can read and rewrite the board via structured outputs, with validation that rejects malformed board updates. Covered by pytest across auth, board routes, static routing, AI client errors, and chat.
  • Frontend: wires the existing Kanban UI to the real backend \u2014 login flow (AuthGate, /login), a fetch-based API client with 401 handling, and an AI chat sidebar (ChatSidebar) that applies board updates from the assistant immediately.
  • Docs: docs/DATABASE.md / docs/schema.json document the SQLite schema; docs/PLAN.md tracks progress/decisions; docs/review.md is a code review of the repo (backend, frontend, Docker config) noting the healthcheck fix and a few lower-severity follow-ups.

Test plan

  • Backend: uv run pytest (auth, board CRUD, chat, static routing, AI error paths)
  • Frontend: npm run test:unit (component/lib unit tests) and npm run test:e2e (Playwright, login/board/chat flows)
  • docker compose up --build \u2014 confirmed docker compose ps / docker inspect report STATUS: healthy
  • curl http://localhost:8000/api/health from the host returns {"status":"ok"}

sanjay289 and others added 6 commits August 10, 2026 23:41
The compose healthcheck ran curl, which isn't installed in the
python3.12-bookworm-slim final image, so the container reported
unhealthy even when the app was fine. Switched it to Python's
urllib, which is already present, and verified via docker compose
up --build that the container now reports healthy.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Multi-stage Dockerfile (Node build stage for the frontend, uv-based
Python stage for the backend), plus start/stop scripts for
Mac/Linux/PowerShell and the supporting .dockerignore/.env.example/
.gitignore entries needed to build and run the container.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Implements the full backend for the Kanban app:

- app/main.py: FastAPI app, health check, static file serving
  (NextStaticFiles resolves Next's static-export routing quirks)
- app/auth.py: hardcoded-credential login, in-memory session tokens
- app/db.py: SQLite schema + seeding, created on first run
- app/board.py: board/column/card CRUD backed by SQLite
- app/ai.py: OpenRouter client (plain + structured completions)
- app/chat.py: AI chat endpoint that can read and rewrite the board,
  with validation to reject malformed board updates

Covered by pytest across auth, board routes, static routing, AI
client error handling, and chat (backend/tests/).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- lib/auth.ts + /login page + AuthGate: hardcoded login against
  the backend, session check on load, redirect to /login when
  unauthenticated
- lib/api.ts: fetch client for the board/card/column endpoints,
  raising UnauthorizedError on 401
- KanbanBoard now loads/mutates the board through the API instead
  of local-only state, with optimistic updates reconciled against
  the server response (or a full refetch on error)
- next.config.ts: static export for production, dev-mode rewrite of
  /api/* to the local backend (output: "export" disallows rewrites)
- Playwright/vitest config and specs updated for the auth-gated,
  server-persisted board

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Collapsible sidebar (ChatSidebar) that sends messages to
POST /api/chat and replaces the board state with any AI-driven
update in the response, so card/column changes made via chat show
up immediately without a manual refresh.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
docs/DATABASE.md and docs/schema.json record the SQLite schema
(users/boards/columns/cards) and the reasoning behind it. docs/PLAN.md
is updated with progress, decisions, and verification notes accumulated
while building the backend, auth, board API, and AI chat.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sanjay289 sanjay289 changed the title Fix Docker healthcheck (curl missing in final image) + add code review Add FastAPI backend, auth, AI chat, and fix Docker healthcheck Aug 10, 2026
Runs on push/PR to main:
- backend: uv sync + pytest (real-OpenRouter tests self-skip without
  OPENROUTER_API_KEY, verified locally by running the suite without
  a local .env present)
- frontend: npm ci, lint, vitest unit tests
- e2e: Playwright against the real backend + frontend dev server,
  same webServer setup as local dev. Marked continue-on-error since
  the AI-driven spec (chat.spec.ts) depends on a real OpenRouter call
  and is already documented as blocked on a working API key
  (docs/PLAN.md); the auth/kanban specs still exercise the app
  end-to-end and are verified passing locally.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sanjay289

Copy link
Copy Markdown
Author

Heads up on CI visibility for this PR: .github/workflows/ci.yml is introduced by this PR itself, and GitHub Actions only triggers pull_request-event workflows that already exist on the base repo's default branch. Since it's not yet on main here, no check will appear on this PR \u2014 it's not failing, it's just not registered to run yet.

The workflow does work: it ran via the push trigger on my fork and passed \u2014 https://github.com/sanjay289/pm/actions/runs/31423500168

  • backend job: uv run pytest (46 passed, 3 self-skip without OPENROUTER_API_KEY, verified locally with .env removed to match CI conditions)
  • frontend job: lint + 27 vitest unit tests, all passing
  • e2e job: Playwright against the real backend + dev server; marked continue-on-error since chat.spec.ts needs a working OPENROUTER_API_KEY (already documented as broken in docs/PLAN.md). The other 7 non-AI specs (auth, kanban) pass.

Once this merges (or the workflow file otherwise lands on main), pull_request runs will start showing up as checks on future PRs.

sanjay289 and others added 2 commits August 11, 2026 23:35
Concise entry point for Claude Code that points to the existing
AGENTS.md docs and summarizes commands and cross-cutting architecture.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Read-only get_board plus create/update/delete card and rename column
tools, talking to app.board/app.db directly over stdio rather than
through the HTTP API.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant