Getting Started

Project Structure

Overview of the folder structure generated by glyria.js.

After running npx glyria init, your project will look like this:

your-bot/
  src/
    commands/
    events/
    composables/
    utils/
    index.ts
  .glyria/
    imports.d.ts
  .env
  .gitignore
  tsconfig.json
  glyria.config.ts
  package.json

src/

The main folder containing your bot's source code.

src/commands/

All your slash commands live here. glyria.js recursively scans this folder at startup and automatically registers every file.

src/commands/
  ping.ts
  moderation/
    ban.ts
    kick.ts
  config/
    logs.ts
Subfolders are purely for organization — every .ts file, regardless of its depth, is loaded as a command.

src/events/

Discord event listeners. Each file handles one or more discord.js events.

src/composables/

Business logic and stateful utilities. Files placed here are automatically available globally through auto-imports — no import statement needed. The convention is to prefix functions with use.

// src/composables/useModeration.ts
export const useModeration = () => {
  // ban logic, kick logic, etc.
}

// src/commands/ban.ts — no import required
const moderation = useModeration()

src/utils/

Pure functions with no dependencies or side effects. Files placed here are also auto-imported globally.

// src/utils/formatDate.ts
export const formatDate = (date: Date) => {
  // ...
}

// src/commands/ping.ts — no import required
const formatted = formatDate(new Date())
utils/ is for pure functions with no dependencies — formatting, parsing, math. composables/ is for logic that interacts with the database, Discord, or other services.

src/index.ts

Your bot's entry point. Minimal by design:

const client = new GlyriaClient({
  intents: [GatewayIntentBits.Guilds]
})

await client.login()

.glyria/

Automatically generated by glyria.js. Contains TypeScript declaration files for auto-imports.

This folder is regenerated on every glyria generate or glyria dev run. Any manual changes will be overwritten.

.env

Environment variables for your bot. glyria.js automatically loads this file at startup.

TOKEN=your_bot_token_here

glyria.config.ts

Global configuration for your bot — theme, default embed settings, and more.

export default defineGlyriaConfig({
  modules: ["@glyria/timers"]
  ...
})

tsconfig.json

Pre-configured by npx glyria init. Includes the .glyria/ folder for auto-import type resolution.

Copyright © 2026