# Express Deletion

# Express Deletion (MC #10493)

**CEO directive:** "Express je tvoj bug, brisi" — 2026-05-02  
**PR:** [#39](https://github.com/johnatbasicas/bilko/pull/39)  
**Status:** DONE (merged 2026-05-02)  
**Outcome:** 141 api-express files deleted, 415 npm packages deregistered

---

## Context

Bilko had dual backends for 3 months post-Kotlin migration:
- `apps/api-express/` (12 routes, 9 services, Node.js/TypeScript)
- `apps/api/` (Kotlin/Ktor, Exposed ORM, Flyway migrations)

**Stage environment:** Running Kotlin (`bilko/api:stage-1f48fdc`)  
**Prod environment:** STILL running Express (`bilko-api` on Cloud Run, digest `2986d8b0...`, port 4000)

CEO decision 2026-05-02: Kotlin is canonical. Express is deprecated. Delete immediately.

---

## Actions Taken

1. **Branch created:** `feat/bilko-kill-express`
2. **Directory deleted:** `rm -rf apps/api-express/`
3. **Workspace cleanup:** Updated `package.json` workspaces (removed `apps/api-express`)
4. **Docs updated:** 
   - `CLAUDE.md` — removed Express backend description
   - `BUILD-BLUEPRINT.md` — removed Express references
5. **CI verification:** `turbo.json` and `cloudbuild.yaml` had ZERO Express references (no changes needed)
6. **Cloud Run verification:** Stage `bilko-api-stage` confirmed Kotlin-safe (revision `stage-1f48fdc`)
7. **Package install test:** `npm install` → exit 0 (no broken workspace refs)

---

## PR Details

**URL:** https://github.com/johnatbasicas/bilko/pull/39  
**Commit:** `2c63cdb`  
**Files changed:** 141 deletions  
**Packages removed:** 415 npm dependencies

**Merge:** Squash-merged 2026-05-02 08:51:17 UTC

---

## Root Finding: PROD Still on Express

During Cloud Run inventory (MC #10493 verification by kelsey-hightower):

**Stage API (`bilko-api-stage`):**
- Image: `bilko/api:stage-1f48fdc` (Kotlin)
- Port: 4001
- Healthy

**Prod API (`bilko-api`):**
- Image digest: `sha256:2986d8b0...` (Express container)
- Port: 4000
- **Still serving Express backend**

**Implication:** Deleting `apps/api-express/` from git does NOT affect prod — prod is running a stale container image. Prod cutover requires separate deployment action.

**Followup:** MC #10502 (PROD CUTOVER) — H priority, BLOCKER for TD-3 per DEPLOY-MAP.md

---

## Side-Effect: Web Dockerfile Broke

**Discovered:** 2026-05-02 by kelsey-hightower during MC #10494 deploy verification

**Root cause:** `apps/web/Dockerfile` contained:
```dockerfile
COPY apps/api-express/package.json ./apps/api-express/
```

This line was used for web build dependency extraction. When PR #39 deleted `apps/api-express/`, the COPY directive failed:

```
Step 8/24 : COPY apps/api-express/package.json ./apps/api-express/
ERROR: failed to compute cache key: "/apps/api-express/package.json" not found: not found
```

**Impact:** Web Cloud Build pipeline failed for 3 consecutive builds (regression window: PR #39 merge → PR #41 fix)

**Fix:** PR #41 (MC #10505) — removed single line from `apps/web/Dockerfile`

---

## Verification

**Tested by:**
- **codecraft** — codebase integrity (no dangling imports)
- **kelsey-hightower** — Cloud Run service state

**Evidence directory:** `/tmp/evidence-10493/`

**Smoke tests:**
- Stage API health: `curl https://bilko-api-stage-dh4m46blja-lz.a.run.app/api/v1/health` → HTTP 200, Kotlin response shape
- Web build: Cloud Build ID `b3bbde85` SUCCESS (post-PR #41 fix)
- Package install: `npm install` exit 0, no workspace errors

---

## Docs Cleanup

**Files updated in PR #39:**

### `CLAUDE.md`
**Before:**
```markdown
Backend: Express (apps/api-express/) — 12 routes, 9 services
Migration: Kotlin in progress (apps/api/)
```

**After:**
```markdown
Backend: Kotlin/Ktor (apps/api/) — canonical since 2026-05-02
```

### `BUILD-BLUEPRINT.md`
**Before:**
```markdown
- Express API (Node.js/TypeScript)
- Kotlin API (migration target)
```

**After:**
```markdown
- Kotlin/Ktor API (canonical)
- Note: Express deleted 2026-05-02 per ADR-021 package rename + CEO directive
```

---

## Open Items

### 1. PROD Cutover (MC #10502)
**Blocker:** TD-3 per DEPLOY-MAP.md  
**Action required:** Deploy Kotlin container to prod `bilko-api` Cloud Run service  
**Risk:** Prod still on Express means any regression fix in Kotlin (e.g., MC #10494 registracija) does NOT reach prod users  
**Priority:** H

### 2. Cloud Build API Pipeline
**Current state:** `cloudbuild.yaml` deploys web only (no Kotlin API build/deploy)  
**Risk:** Kotlin code changes have no CI gate; manual deploy only  
**Followup:** MC #10498 (Arch roadmap — Kotlin CI pipeline)

---

## References

**MCs:**
- MC #10493 — Express deletion (this page)
- MC #10502 — PROD CUTOVER (open, H priority)
- MC #10505 — Web Dockerfile regression fix

**PRs:**
- [#39](https://github.com/johnatbasicas/bilko/pull/39) — Express deletion
- [#41](https://github.com/johnatbasicas/bilko/pull/41) — Web Dockerfile fix

**Evidence:**
- `/tmp/evidence-10493/` — postflight artifacts
- DEPLOY-MAP.md — Cloud Run service inventory