Project Structure
Understand the application created by vela new.
vela new my-api creates four source files and the configuration needed to run
them in Cloudflare Workers:
| File | Responsibility |
|---|---|
src/worker.ts | Exports native Workers handlers with environment-scoped application initialization. |
src/app.module.ts | Registers the controller and injectable service. |
src/app.controller.ts | Handles GET / and delegates to its injected service. |
src/app.service.ts | Supplies the greeting. |
.swcrc | Compiles TypeScript, legacy decorators, and constructor metadata. |
wrangler.jsonc | Runs the custom SWC build and loads dist/worker.js. |
tsconfig.json | Configures strict TypeScript checking without emitting JavaScript. |
pnpm-workspace.yaml | Allows the native build dependencies used by SWC and Wrangler. |
The application uses published npm dependencies. It has no dependency catalog,
workspace ranges, or links to a Vela source checkout. pnpm install creates a
lockfile that you should commit.
Add a feature
As the application grows, group a feature's controller, service, and module in one directory. Import that feature module from the root module. Keep request handling in controllers and reusable application logic in services.
You can create these files manually; feature generators are not yet included.
Quick Start
Create a Workers API with a module, controller, and injected service.
Controllers
Controllers handle incoming requests and return responses.
Last updated on