Runtime APIs
Use built-in runtime APIs inside actions to perform side effects such as logging and outbound HTTP requests.
Overview
TitanPl provides a small, intentional set of runtime APIs that are available inside actions.
These APIs allow actions to perform controlled side effects while leveraging the Gravity runtime's multi-threaded model, preserving performance, determinism, and Rust-powered execution.
Runtime APIs are exposed through the global t object.
Runtime APIs are not available in routes.
They are designed exclusively for use inside actions.
Where Runtime APIs can be used
| Location | Allowed |
|---|---|
| Routes | ❌ No |
| Actions | ✅ Yes |
| Build time | ❌ No |
Runtime APIs execute only at request time.
Design philosophy
Titan’s runtime APIs are:
- Minimal by design
- Explicitly scoped
- Rust-backed
Where Runtime APIs can be used
| Location | Allowed |
|---|---|
| Routes | ❌ No |
| Actions | ✅ Yes |
| Build time | ❌ No |
Runtime APIs execute only at request time.
Design philosophy
Titan’s runtime APIs are:
- Minimal by design
- Explicitly scoped
- Rust-backed
- Production-safe
There is no hidden magic and no implicit globals beyond t by default.
Node.js Compatibility
If you need to use standard Node.js APIs (like fs, path, or process) or existing npm libraries, you can enable them using the @titanpl/node compatibility layer.
Mental model
Routes define structure Actions define behavior Runtime APIs perform side effects Rust executes everything
This keeps Titan applications predictable, fast, and maintainable.
🚀 Stay Up to Date
To ensure full support for the latest features and security patches, please update your Titan CLI and project to the latest version.