RiserBob logoRiserBobv1.0.0
HomeDocsCLIRelease notes

Getting started

  • Introduction
  • Installation
  • Quick start
  • Project structure

Core concepts

  • Routing
  • Request
  • Responses
  • Error handling

Middleware

  • Middleware
  • Authentication
  • Logger and CORS

Data

  • Validation

Structure and tooling

  • Modules
  • CLI

Examples

  • Build a project
  • Mongoose
  • Drizzle ORM
  • Sequelize
  • JWT and cookies
  • File uploads

Packages

  • Cookies

Resources

  • Troubleshooting
  • Release notes
  • License
  • Security
  • Contributing
Structure and tooling

CLI

Generate a complete module with a single command.

The riser-bob command creates a controller, a router and a module for a new feature, so you can start at the interesting part.

Generate a module

Run it from the root of your project:

Terminal
bun run riser-bob g module users

generate works as a long form of g.

Terminal
bun run riser-bob generate module users

The files are created in src/modules/<name>/:

Output
🧽 Module "users" generated successfully!šŸ“ src/modules/users   └── users.controller.ts   └── users.route.ts   └── users.module.ts

The generated routes live under /api/<name>: POST and GET on /api/users, and GET, PUT and DELETE on /api/users/:id.

Naming

Names may contain letters, numbers, - and _, and must start with a letter. The folder and file names are written in kebab-case and the classes in PascalCase.

You typeFilesClasses
usersusers.controller.tsUsersController, UsersRouter, UsersModule
blog-postblog-post.controller.tsBlogPostController, BlogPostRouter, BlogPostModule
BlogPostblog-post.controller.tsBlogPostController, BlogPostRouter, BlogPostModule

After generating

  • Register the module in src/index.ts: new BlogPostModule().register(bob).
  • Fill in the TODO bodies of the controller. Until you do, every handler fails with a 500.
  • Implement verifyToken, or remove the auth middleware from the router if the feature is public. Until then the protected routes answer 401.

It never overwrites your work

  • If any of the three files already exists, the command stops with an error before writing anything.
  • If writing fails halfway, the files created by that run are removed again.

Other commands

CommandDescription
riser-bob --help or -hShows usage.
riser-bob --version or -vShows the CLI banner. The version comes from the installed package.
PreviousModulesNextBuild a project

On this page

  • Generate a module
  • Naming
  • After generating
  • It never overwrites your work
  • Other commands