Docs
Context Object ($ctx) Reference
Context Object ($ctx) Reference The $ctx (context) object is available in all hooks and handlers. It provides access to request data, database repositories, helper functions, cache operations, and more. Quick Navigation Request Data - $ctx.$body , $ctx.$params , $ctx.$query , $ct
Context Object ($ctx) Reference
The $ctx (context) object is available in all hooks and handlers. It provides access to request data, database repositories, helper functions, cache operations, and more.
Quick Navigation
- Request Data -
$ctx.$body,$ctx.$params,$ctx.$query,$ctx.$user - Repositories -
$ctx.$reposfor database operations - Helpers & Cache -
$ctx.$helpers(JWT, bcrypt, crypto, file helpers, rate limiting) and$ctx.$cache - Logging & Error Handling -
$ctx.$logs()and$ctx.$throw - Advanced Features - File uploads,
$ctx.$env, API info, shared context, packages, and patterns
Documentation
- Request Data - Access HTTP request information and parameters
- Repositories - Database operations through repositories
- Helpers & Cache - Utility functions (JWT, bcrypt, crypto, rate limiting) and Redis cache operations
- Logging & Error Handling - Adding logs and throwing errors
- Advanced Features - File uploads, sanitized env access, API information, shared context, and more
Next Steps
- See Repository Methods for database operations
- Check API Lifecycle to understand when context is available
- Learn about Hooks and Handlers for using context in custom code