Module Structure
A Glyria module is a standard NPM package that follows a specific folder structure. When declared in glyria.config.ts, Glyria automatically discovers and loads its commands and events.
@glyria/your-module/
src/
commands/
events/
index.ts
dist/
commands/
events/
index.js
package.json
dist/ vs src/
Glyria always prefers dist/ over src/. If dist/ exists, it is used — otherwise Glyria falls back to src/.
| Folder | Used when |
|---|---|
dist/ | Package is built (production) |
src/ | Package is not built yet (local dev) |
commands/
Slash commands exposed by the module. Glyria recursively scans this folder and loads every file, exactly like your own src/commands/.
dist/
commands/
ban.js
kick.js
config/
logs.js
events/
Discord event listeners exposed by the module. Loaded alongside your own src/events/.
dist/
events/
guildMemberAdd.js
messageCreate.js
index.ts
The module's main entry point. All exports from this file are automatically available in the user's project under the module's namespace — no import needed.
// @glyria/timers — src/index.ts
export const createJob = () => { ... }
export const deleteJob = () => { ... }
// In the user's project — no import required
const job = Timers.createJob(() => {
console.log("runs every minute")
}, "* * * * *")
The namespace is derived from the package name in PascalCase — @glyria/timers → Timers.
package.json
The main field should point to your built entry point. It is recommended to declare @glyria/bot as a peer dependency to avoid shipping multiple instances of the framework in the user's project.
{
"name": "@glyria/your-module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"peerDependencies": {
"@glyria/bot": "*"
}
}
peerDependencies ensures the module reuses the @glyria/bot instance already installed in the user's project, rather than bundling its own copy.Minimal example
A module doesn't need both commands/ and events/. If a folder doesn't exist, Glyria skips it silently. A module that only exposes utility functions through its index.ts is perfectly valid.
@glyria/timers/
dist/
index.js ← only exports, no commands or events
package.json

