elysia-cli is a CLI tool designed to simplify and speed up module creation in ElysiaJS projects.
It automatically generates a Controller, Service, and Model inside one folder, and updates your index.ts file automatically — allowing you to focus on writing logic instead of setting up files.
- Speeds up module development.
- No need to manually create files.
- Automatically updates
index.tswith imports andapp.use(...). - Fully compatible with Node.js and Bun.
- Works from anywhere in the project using
process.cwd().
Open your terminal at the project root and run:
npx elysia-cli module <module-name>Example:
npx elysia-cli module authThis will create the
authmodule with the following files:
src/
modules/
auth/
auth.controller.ts
auth.service.ts
auth.model.ts
And automatically update src/index.ts.
You can also run:
npx elysia-cliYou will be prompted with options:
- Generate new module – to create a new module.
- Exit – to quit the CLI.
After creating the module, you can import and use it like this:
import { auth } from "./modules/auth/auth.controller";
app.use(auth);- Prevents overwriting if a module with the same name already exists.
- All paths are based on
process.cwd(), so it works from any location. - Fully compatible with Bun and Node.js.
src/
modules/
<moduleName>/
<moduleName>.controller.ts
<moduleName>.service.ts
<moduleName>.model.ts
Example for a module named auth:
src/
modules/
auth/
auth.controller.ts
auth.service.ts
auth.model.ts
- Node.js or Bun.
- An existing ElysiaJS project.