Commands
Complete CLI command reference
rapina new
Create a new Rapina project:
rapina new my-app
This creates:
Cargo.tomlwith Rapina dependenciessrc/main.rswith a basic API.env.examplewith common variables.gitignore
rapina dev
Start the development server with hot reload:
rapina dev
Options:
| Flag | Description | Default |
|---|---|---|
-p, --port <PORT> | Server port | 3000 |
--host <HOST> | Server host | 127.0.0.1 |
Example:
rapina dev -p 8080 --host 0.0.0.0
rapina routes
List all registered routes from a running server:
rapina routes
Output:
METHOD PATH HANDLER
------ -------------------- ---------------
GET / hello
GET /health health
GET /users/:id get_user
POST /users create_user
4 route(s) registered
Note: The server must be running for this command to work.
rapina doctor
Run health checks on your API:
rapina doctor
Checks:
- Response schemas defined for all routes
- Error documentation present
- OpenAPI metadata (descriptions)
Output:
Running API health checks...
All routes have response schemas
Missing documentation: GET /users/:id
No documented errors: POST /users
Summary: 1 passed, 2 warnings, 0 errors
Consider addressing the warnings above.
rapina openapi export
Export the OpenAPI specification to a file:
rapina openapi export -o openapi.json
Options:
| Flag | Description | Default |
|---|---|---|
-o, --output <FILE> | Output file | openapi.json |
rapina openapi check
Verify that the committed spec matches the current code:
rapina openapi check
Useful in CI to ensure the spec is always up to date.
rapina openapi diff
Detect breaking changes against another branch:
rapina openapi diff --base main
Output:
Comparing OpenAPI spec with main branch...
Breaking changes:
- Removed endpoint: /health
- Removed method: DELETE /users/{id}
Non-breaking changes:
- Added endpoint: /posts
- Added field 'avatar' in GET /users/{id}
Error: Found 2 breaking change(s)
The command exits with code 1 if breaking changes are detected.