Disclose backend hardening and route changes

🟢 open · #131 · willchen96/mike ← hoogvliets/mike · opened 12d ago by hoogvliets · +9,750-5,851 across 69 files · ↗ on GitHub

From the PR description

Part of the downstream AGPL disclosure. This PR isolates backend hardening and route changes for easier review.

Scope

  • Backend source changes for app bootstrapping, auth-aware APIs, storage, uploads, LLM routing, chat tools, account lifecycle, logging, and validation.
  • Full disclosure PR: #127.

App and Configuration

  • Adds backend/src/app.ts to separate Express app construction from server startup.
  • Adds typed environment handling in backend/src/env.ts.
  • Updates backend package dependencies, scripts, lockfiles, TypeScript settings, and deployment config.

Auth, Access, and User Lifecycle

  • Hardens auth middleware and Supabase access helpers.
  • Adds encrypted user model key handling through user settings and model routes.
  • Adds account deletion, restore token, and deletion worker support.
  • Adds validation helpers used by route inputs.

Chat, LLM, and Tools

  • Splits the previous large chat tools module into focused modules under backend/src/lib/chatTools/.
  • Adds structured tool schemas, tool runner behavior, document context loading, citation handling, workflow store helpers, streaming support, and individual tools.
  • Updates Anthropic and Gemini integration behavior and removes the old OpenAI-specific module path.
  • Adds model availability routing through a backend models endpoint.

Storage, Uploads, and Documents

  • Updates storage, upload, download token, and document route behavior.
  • Adds PDF queue and structure tree helpers.
  • Improves document upload, project document, tabular, workflow, and download API behavior.

Operations and Safety

  • Adds Pino request logging support.
  • Adds LLM request rate limiting.
  • Adds helper code for restore tokens, crypto, and safer route validation.

Review Note

  • Database schema support for some backend behavior is disclosed in #130. Frontend flows that call these endpoints are disclosed in #128. Test coverage for this behavior is disclosed in #129.

Our analysis

Isolate backend hardening for downstream AGPL disclosure — read the full analysis →

Think the analysis missed something the PR description covers?

Capture this PR into my fork

Download a Markdown prompt that tells Claude how to port every commit in this PR into your working tree. Run it via claude -p < capture-pull-131.md from inside the repo you want the changes in.

⬇ Download capture-pull-131.md