Skip to content

chore: retire Express layer — Hono Worker is the only server#43

Open
chitcommit wants to merge 1 commit into
feat/hono-phase-4-r2-routesfrom
chore/retire-express-layer
Open

chore: retire Express layer — Hono Worker is the only server#43
chitcommit wants to merge 1 commit into
feat/hono-phase-4-r2-routesfrom
chore/retire-express-layer

Conversation

@chitcommit
Copy link
Copy Markdown
Contributor

Stack: Final cleanup. Stacks on #42#41#40#39#38#37#36#34#33.

Production traffic now flows entirely through the Hono Worker at assets.chitty.cc/*. The Express server is gone. The SPA (Vite-built dist/public) is served by the Worker's ASSETS binding in production.

Files deleted (27)

Routes & bootstrap

  • server/index.ts, server/routes.ts

Clients (ported to worker/src/clients/*)

  • server/aiAnalysis.ts, server/openai.ts
  • server/chittyCloudMcp.ts, server/chittyEcosystem.ts, server/chittyCloudflareCore.ts, server/chittyCore.ts
  • server/chittyAuth.ts, server/githubWebhooks.ts

Infra (replaced by Drizzle + Worker bindings)

  • server/objectStorage.ts, server/objectAcl.ts (R2 + r2_object_acl table)
  • server/storage.ts, server/db.ts (worker/src/db.ts)
  • server/seedData.ts, server/toolRegistry.ts, server/vite.ts

Middleware

  • server/middleware/{errorHandler,logging,validation}.ts

Tests

  • server/__tests__/** (superseded by worker/__tests__/* real-Neon integration suite)

Utility scripts

  • scripts/notion-sync.js, scripts/update-sync-status.js (Notion sync is centralized via Ch1tty; not a per-repo concern)

Deps removed from package.json

express, express-session, connect-pg-simple, memorystore, memoizee,
@types/{express,express-session,connect-pg-simple,passport,passport-local,ws,memoizee},
@clerk/{backend,clerk-sdk-node,express,types}, @google-cloud/storage, google-auth-library,
@notionhq/client, @anthropic-ai/claude-code, @chittyapps/chittycloude-mcp, openid-client,
ws, tsx, esbuild.

Deps added

concurrently (dev workflow), wrangler (deploy), @cloudflare/workers-types (Worker types).

Dev workflow chosen — Option B (separate vite + wrangler dev)

Standard Cloudflare + Vite SPA dev pattern with HMR.

npm run dev      # concurrently: vite (5173) + wrangler dev (8788)
                 # vite proxies /api/* → localhost:8788
npm run dev:web  # vite only
npm run dev:api  # wrangler dev only
npm run build    # vite build (Worker is bundled by wrangler deploy)
npm run deploy   # wrangler deploy --env production

Validation gates

Gate Result
npm run check before 85 errors
npm run check after 41 errors — all pre-existing client/* issues, surfaced once server/* noise gone. client/ untouched per constraints.
vite build OK (496 KB JS / 70 KB CSS gzipped 149 KB / 12 KB)
wrangler deploy --dry-run --env production OK — all bindings resolve (Hyperdrive, R2 EVIDENCE/PROCESSED, ASSETS, tail consumer chittytrack)
Worker tests 6 env-independent tests pass; DB-backed tests gated on TEST_DB_URL per "no mocks" policy — operator validates against a real Neon branch
grep -rE "from .*server/" client/ shared/ empty (no client deps on deleted server)
git ls-files server/ 0 (was 25)

Migration complete checklist

  • All Express routes ported to Hono
  • Real-Neon integration tests cover all routes (worker/__tests__/*)
  • Express layer fully removed
  • Build/dev/deploy scripts updated
  • R2 buckets created — operator: wrangler r2 bucket create chittyassets-evidence && wrangler r2 bucket create chittyassets-processed
  • Production secrets set — operator: wrangler secret put OPENAI_API_KEY --env production (and any others surfaced by wrangler deploy)
  • Migrations applied to prod Neon — operator: npm run db:push against prod connection string (route via ChittyConnect for cold creds)
  • chittyassets registered with ChittyRegistry — operator: route via ChittyConnect

🤖 Generated with Claude Code

Final phase of the Express → Hono Worker migration. All routes were ported in
PRs #33#42; this PR removes the Express layer entirely and rewires dev/build.

Deleted (25 files):
- Routes & bootstrap: server/index.ts, server/routes.ts
- Clients: server/aiAnalysis.ts, server/openai.ts, server/chittyCloudMcp.ts,
  server/chittyEcosystem.ts, server/chittyCloudflareCore.ts, server/chittyCore.ts,
  server/chittyAuth.ts, server/githubWebhooks.ts
- Infra: server/objectStorage.ts, server/objectAcl.ts, server/storage.ts,
  server/db.ts, server/seedData.ts, server/toolRegistry.ts, server/vite.ts
- Middleware: server/middleware/{errorHandler,logging,validation}.ts
- Tests: server/__tests__/** (superseded by worker/__tests__/* integration suite)
- Utility scripts: scripts/notion-sync.js, scripts/update-sync-status.js
  (Notion sync is centralized via Ch1tty; not a per-repo concern)

Deps removed:
  express, express-session, connect-pg-simple, memorystore, memoizee,
  @types/{express,express-session,connect-pg-simple,passport,passport-local,ws,memoizee},
  @clerk/{backend,clerk-sdk-node,express,types}, @google-cloud/storage,
  google-auth-library, @notionhq/client, @anthropic-ai/claude-code,
  @chittyapps/chittycloude-mcp, openid-client, ws, tsx, esbuild

Deps added:
  concurrently (dev workflow), wrangler (deploy), @cloudflare/workers-types

Dev workflow (Option B — separate vite + wrangler dev):
  npm run dev      — concurrently runs vite (5173) + wrangler dev (8788);
                     vite proxies /api/* to the Worker for HMR.
  npm run dev:web  — vite only
  npm run dev:api  — wrangler dev only
  npm run build    — vite build (Worker is bundled by wrangler deploy)
  npm run deploy   — wrangler deploy --env production

Validation:
- npm run check: 85 errors → 41 errors (all remaining errors are pre-existing
  client/* type issues, surfaced once server/* noise is removed; client is
  untouched in this PR)
- vite build: OK (496 KB JS / 70 KB CSS)
- wrangler deploy --dry-run --env production: OK, all bindings resolve
  (Hyperdrive, R2 EVIDENCE/PROCESSED, ASSETS, tail consumer chittytrack)
- Worker integration tests: 6 env-independent tests pass; DB-backed tests
  gated on TEST_DB_URL (per "no mocks" policy, run against a real Neon branch)

Constraints honored:
- client/** and shared/** untouched
- No prod-mutating commands (R2 bucket create, secrets, registry register)
  executed — operator tasks called out in the checklist below.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e63344e0-69e9-4e80-8cc6-ce4bbd68c40b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/retire-express-layer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5bd9c2f0a4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/notion-sync.js
@@ -1,286 +0,0 @@
#!/usr/bin/env node
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep Notion sync workflow runnable after script removal

Deleting this script breaks .github/workflows/notion-sync.yml, which still executes node scripts/notion-sync.js (and node scripts/update-sync-status.js) on push/PR/schedule when Notion secrets are configured. After this commit those steps will fail with a missing-file/module error before any sync logic runs, so the repository’s Notion automation is effectively dead until the workflow is updated or replacement scripts are provided.

Useful? React with 👍 / 👎.

Comment thread server/githubWebhooks.ts
Comment on lines -316 to -317
app.post('/api/github/webhooks', express.raw({ type: 'application/json' }), handler.handleWebhook);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Port GitHub App endpoints before removing webhook routes

This removal drops the only implementation of /api/github/webhooks, /api/github/callback, and /api/github/setup, but no equivalent routes exist in the Worker router (worker/src/index.ts only mounts non-GitHub route groups and falls back to app.all('/api/*', ...) with 501). Any existing GitHub App configuration (for example .github/app/app-manifest.json webhook URL) will stop working immediately after deployment.

Useful? React with 👍 / 👎.

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