Cleanup: purge the in-repo api/ Express stub — zero callers, 11 unused deps, dead vite proxy /api/v1 → :3001 #113

Closed
opened 2026-09-25 20:56:34 +00:00 by Mark · 0 comments
Owner

Cleanup: purge the in-repo api/ stub backend — it has no callers and confuses every developer who lands on this repo

Status of #83

#83 (closed) called out that api/src/index.ts is a 22-line Express stub. It was "fixed" by making the stub honest — /api/v1/auth/register now returns 501 not_implemented instead of a fake 200. But the stub directory and its proxies are still on disk and still being referenced, which is worse than the original problem: now we have a "real-looking" backend that does nothing and looks like the place to add endpoints.

Current state (verified 2026-09-25)

api/                                      ← still in repo, still in docker-compose, still in README
├── Dockerfile
├── dist/                                 ← pre-built stub artifacts
├── drizzle/                              ← migrations for users/designs/exports tables
├── drizzle.config.ts
├── node_modules/                         ← bcrypt, pg, s3, winston, zod all installed but unused
├── package.json                          ← declares threadcraft-api as a separate package
├── package-lock.json
├── src/
│   ├── db/
│   ├── index.ts                          ← 36-line Express stub (was 22, +14 lines for honest 501s)
│   └── index.test.ts
└── tsconfig.json

Vite config still proxies both endpoints to a backend:

// vite.config.ts:19-28
proxy: {
  '/api/easystitch': { target: env.EASYSTITCH_API_URL || 'http://localhost:8080', ... },
  '/api/v1':         { target: env.API_URL || 'http://localhost:3001', ... },
},

But the front-end never calls /api/v1/*. Verified:

$ grep -rnE '/api/v1|/auth|register|login' src/ --include='*.ts' --include='*.tsx' | grep -v test
(no matches)

The only network calls from the front-end go to /api/easystitch/* (which is easystitch-service in ~/Projects/easystitch-service, NOT this api/ directory). So:

  • api/ Express stub has zero callers
  • vite proxy /api/v1 → :3001 is dead
  • All of bcrypt, pg, drizzle, s3, winston, zod, multer, jsonwebtoken, helmet, cors, express in api/package.json are unused
  • The Docker setup references this stub
  • README + walk-plan docs reference this stub

Why this is worse than not having it

Every new dev who lands on this repo sees api/ and assumes:

  1. The backend lives here
  2. Adding a new endpoint means editing api/src/index.ts
  3. The Postgres / S3 dependencies are real
  4. The drizzle migrations are live schema

They spend hours wiring endpoints to a stub that returns 501, or to a Postgres that nothing queries. We've already done this at least twice (see #83, #84, #85, #86 — all about a stub that does nothing).

Suggested fix

  1. Delete the entire api/ directory from this repo. Move it to a separate repo IF/WHEN a real backend is needed (and even then, it'd be a different shape — Drizzle ORM + Express, not FastAPI like easystitch-service).
  2. Remove the /api/v1 proxy block from vite.config.ts.
  3. Keep /api/easystitch proxy — that's the path to the real backend.
  4. Update README + walk-plan docs to point at ~/Projects/easystitch-service (or wherever the real backend lives) for the digitize/export API.
  5. Update any docker-compose / nginx configs that reference this stub.

Verification steps

cd ~/Projects/Kimi_Agent_Brother_10_Digitizing_App
rm -rf api/
grep -rn 'localhost:3001\|/api/v1\|api/src' . --exclude-dir=node_modules --exclude-dir=.git
# Expected: zero references except docs that already point at the real backend

Then npm run build should pass with no broken imports (the front-end doesn't reference api/).

Labels

  • cleanup
  • tech-debt
  • triage-approved

Severity

Medium. Not a user-facing bug — but every dev who works on this repo wastes time on it, and it makes the codebase lie about its architecture.

Filed 2026-09-25 by user-driven bughunt session.

## Cleanup: purge the in-repo `api/` stub backend — it has no callers and confuses every developer who lands on this repo ### Status of #83 #83 (closed) called out that `api/src/index.ts` is a 22-line Express stub. It was "fixed" by making the stub honest — `/api/v1/auth/register` now returns `501 not_implemented` instead of a fake 200. But the **stub directory and its proxies are still on disk and still being referenced**, which is worse than the original problem: now we have a "real-looking" backend that does nothing and looks like the place to add endpoints. ### Current state (verified 2026-09-25) ``` api/ ← still in repo, still in docker-compose, still in README ├── Dockerfile ├── dist/ ← pre-built stub artifacts ├── drizzle/ ← migrations for users/designs/exports tables ├── drizzle.config.ts ├── node_modules/ ← bcrypt, pg, s3, winston, zod all installed but unused ├── package.json ← declares threadcraft-api as a separate package ├── package-lock.json ├── src/ │ ├── db/ │ ├── index.ts ← 36-line Express stub (was 22, +14 lines for honest 501s) │ └── index.test.ts └── tsconfig.json ``` Vite config still proxies both endpoints to a backend: ```ts // vite.config.ts:19-28 proxy: { '/api/easystitch': { target: env.EASYSTITCH_API_URL || 'http://localhost:8080', ... }, '/api/v1': { target: env.API_URL || 'http://localhost:3001', ... }, }, ``` But the front-end never calls `/api/v1/*`. Verified: ``` $ grep -rnE '/api/v1|/auth|register|login' src/ --include='*.ts' --include='*.tsx' | grep -v test (no matches) ``` The only network calls from the front-end go to `/api/easystitch/*` (which is `easystitch-service` in `~/Projects/easystitch-service`, NOT this `api/` directory). So: - `api/` Express stub has zero callers - vite proxy `/api/v1 → :3001` is dead - All of `bcrypt`, `pg`, `drizzle`, `s3`, `winston`, `zod`, `multer`, `jsonwebtoken`, `helmet`, `cors`, `express` in `api/package.json` are unused - The Docker setup references this stub - README + walk-plan docs reference this stub ### Why this is worse than not having it Every new dev who lands on this repo sees `api/` and assumes: 1. The backend lives here 2. Adding a new endpoint means editing `api/src/index.ts` 3. The Postgres / S3 dependencies are real 4. The drizzle migrations are live schema They spend hours wiring endpoints to a stub that returns 501, or to a Postgres that nothing queries. We've already done this at least twice (see #83, #84, #85, #86 — all about a stub that does nothing). ### Suggested fix 1. **Delete the entire `api/` directory** from this repo. Move it to a separate repo IF/WHEN a real backend is needed (and even then, it'd be a different shape — Drizzle ORM + Express, not FastAPI like `easystitch-service`). 2. **Remove the `/api/v1` proxy block** from `vite.config.ts`. 3. **Keep `/api/easystitch` proxy** — that's the path to the real backend. 4. **Update README + walk-plan docs** to point at `~/Projects/easystitch-service` (or wherever the real backend lives) for the digitize/export API. 5. **Update any docker-compose / nginx configs** that reference this stub. ### Verification steps ```bash cd ~/Projects/Kimi_Agent_Brother_10_Digitizing_App rm -rf api/ grep -rn 'localhost:3001\|/api/v1\|api/src' . --exclude-dir=node_modules --exclude-dir=.git # Expected: zero references except docs that already point at the real backend ``` Then `npm run build` should pass with no broken imports (the front-end doesn't reference `api/`). ### Labels - cleanup - tech-debt - triage-approved ### Severity **Medium.** Not a user-facing bug — but every dev who works on this repo wastes time on it, and it makes the codebase lie about its architecture. Filed 2026-09-25 by user-driven bughunt session.
Mark closed this issue 2026-09-25 20:58:59 +00:00
Sign in to join this conversation.
No description provided.