microservices-sh/microservices-sh/express-api-to-workers
Claude Code and agent skill by microservices-sh/microservices-sh
- community
Checking that the SKILL.md file is still in the repository.
Migrate an Express/Node.js API to Cloudflare Workers inside a microservices.sh app. Use when a user has an existing Express (or Fastify/Koa/Nest) HTTP API and wants to move routes, middleware, and handlers onto the Workers runtime behind microservices.sh module boundaries. Covers runtime gap assessment, route/middleware translation, data and integration cutover, and verification.
Install
npx vskill@latest install microservices-sh/microservices-sh/express-api-to-workersSKILL.md
The same SKILL.md was published earlier as microservices-sh/microservices-sh/express-api-to-workers.
Express / Node API → Cloudflare Workers
Overview
Use this skill to move an existing Node HTTP API onto the Cloudflare Workers runtime inside a microservices.sh app. The target keeps route handlers thin and pushes domain logic into modules and documented use-case files, with provider details behind adapters/ports.
The hard part is not routing — it is the runtime gap: Workers is not Node. No persistent process, no filesystem, no long-lived in-memory state, a request-scoped execution model, and Web-standard APIs instead of Node built-ins. Map those before porting handlers.
This is plan-first and approval-gated. Cutting over an API touches live traffic, data, and integrations — never apply remote changes without explicit approval.
Runtime Gap Mapping
| Express / Node | Workers target | Notes | |
|---|---|---|---|
| Long-lived process + in-memory cache | Stateless per request; state in KV/D1/DO | No module-scope mutable state across requests | |
fs / local disk | R2 (objects), KV (small values) | No filesystem | |
process.env | Worker bindings + secrets | Set via wrangler/secrets, not .env at runtime | |
| Express middleware chain | Worker handler composition / module hooks | Re-express auth, logging, validation as composable steps | |
req/res (Node) | Request/Response (Web Fetch) | Streams and bodies are Web-standard | |
setInterval/background timers | Cron Triggers / Queues / waitUntil | No free-running timers | |
WebSocket server (ws) | Durable Objects + WebSocket | durable-objects skill | |
Node DB drivers (pg, mysql2) | D1 / Drizzle, or HTTP-based driver | Native TCP drivers do not run on Workers | |
Buffer, crypto (Node) | Web crypto, Uint8Array | Some Node APIs available via nodejs_compat; prefer Web APIs | |
| Heavy CPU per request | Watch CPU limits; offload to Queues |
Flag every handler that relies on persistent process state, the filesystem, native DB drivers, or long-running work — these are the real port cost, not the route table.
Workflow
1. Assess the source
- List routes (method + path), grouped by domain/resource.
- Inventory middleware: auth, validation, rate limiting, logging, CORS, body parsing.
- Find runtime-gap usages:
fs, native DB drivers, background timers, in-memory caches/sessions, WebSocket servers, large dependencies. - Note external integrations (payment, email, third-party APIs) and which map to existing modules.
2. Scaffold or target the app
Map resources to existing modules first:
- Routes over people/accounts →
customer. - Payment endpoints →
payment-stripe. - Mail-sending endpoints →
email. - Build remaining surfaces as overlays/use-case files, not by forking module internals.
3. Translate routes and middleware
- Re-express each route as a thin Worker handler delegating to a module/use-case function.
- Convert middleware to composable steps or module hooks: auth at the Worker boundary, validation in use-cases, logging via the platform's mechanism.
- Replace
req/reswith WebRequest/Response; adapt body parsing and streaming to Web standards. - Keep
docs/api-boundary.mdaccurate as routes/adapters change.
4. Move data and integrations
- Move the datastore with
prisma-postgres-to-d1(or the Supabase/Firebase skill) if the API owns its DB. - Replace native DB drivers with D1/Drizzle or HTTP-based drivers.
- Route third-party calls through module adapters/ports; put keys in secrets, not code.
- Re-implement sessions/caches on KV or D1; move background work to Cron Triggers or Queues.
5. Verify
Verify each migrated route returns equivalent responses, auth/validation behave as before, and no handler depends on removed Node primitives. Only after local verification, plan the approval-gated remote deploy and cutover.
Approval Gates
Ask for explicit approval before:
- Cutting over live API traffic or changing public endpoints/contracts.
- Importing data into remote D1 or any production resource.
- Provisioning Cloudflare resources, secrets, Queues, or deploying.
- Decommissioning the source API (confirm rollback path first).
Never ask the user to paste secret values into chat. Discuss names, scopes, and where to set them.
Finish Checklist
Report:
- Routes/middleware ported and which relied on removed Node primitives.
- Integrations mapped to modules vs rebuilt as overlays.
- Data-layer move (which skill, verified counts) if applicable.
- Approval-gated work planned but not executed (traffic cutover, remote import, deploy, source teardown).
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/express-api-to-workers/SKILL.md
Popularity
- Repository stars
- 5
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/microservices-sh/microservices-sh/express-api-to-workers)