Skip to main content

Module module

Module module 

Source
Expand description

The module system: a Module bundles routes, migrations, hooks and OpenAPI parts under a name, like a service provider.

Order is deterministic: registration order. Modules’ migrations run in that order (then the app’s own), their routes are merged in that order, start runs in that order and shutdown in the reverse order. A name may be registered once.

Build order: for each module in registration order, setup (state values, authenticators, rate limiters), then register_hooks, then the routes are assembled. Command-line commands (commands) are collected before the command line is parsed.

Compatibility promise: methods added to Module later (e.g. permissions) always come with a default implementation, so a module written today keeps compiling.

Structs§

Setup
What a module may contribute in Module::setup.

Constants§

MAX_MODULE_NAME_BYTES
The longest module name, in bytes.
RESERVED_MODULE_NAMES
Names a module may not use: app is the app’s own migrations namespace; core and nbs are reserved for the framework.

Traits§

Module
A pluggable part of the server (chat, storage, leaderboards, a game’s own subsystem).

Functions§

validate_module_name
Check a module name (see Module::name).