Project Structure
pnpm create bight generates an opinionated src/ layout. The directory names stay consistent as the app grows, so learning them once pays off across the entire documentation.
Directory layout
Section titled “Directory layout”Directorysrc/
bight.tsFramework entryDirectorycommands/ Slash command definitions
- …
Directoryconfig/ Static configuration
- …
Directoryevents/ Discord client event listeners
- …
Directoryfeatures/ Feature modules
- …
Directoryinteractions/ Button, modal, and select menu handlers
- …
Directoryplugins/ Lifecycle hooks
- …
Directorypreconditions/ Reusable access-control rules
- …
Directoryservices/ App-owned integrations
- …
Directorystorage/ Storage adapter configuration
- …
Depending on CLI selections, you may also see i18n/, message-commands/, prefix-commands/, or db/.
What belongs where
Section titled “What belongs where”Commands and interactions
Section titled “ Commands and interactions”The surfaces users touch. commands/ holds slash command definitions; interactions/ holds component handlers (buttons, modals, selects). For logic shared across multiple commands, extract it into services/ or features/.
Services
Section titled “ Services”Your app’s external integrations: database clients, cache layers, error reporters, localization. Services are explicitly defined and passed through the context object. See Services.
Plugins
Section titled “ Plugins”Code that hooks into the app lifecycle without being called directly. Startup checks, persistent schedulers, devtools, and global preconditions live here. See Plugins.
Features
Section titled “ Features”When a flat commands/ + interactions/ layout stops scaling, group related logic by domain using Feature Modules.
Storage
Section titled “ Storage”The adapter configuration for Bight’s internal key-value store (framework settings, plugin state). Not a replacement for your application database. See Settings & Data Strategy.
The entry file: src/bight.ts
Section titled “The entry file: src/bight.ts”This file is the single point where client options, gateway intents, filesystem discovery, plugins, and runtime policies come together. You’ll rarely need to modify it beyond the initial setup, but understanding its shape is important. It defines the boundary between your code and the framework.