Nubis / Introduction
Start
Introduction
What Nubis is, what it does for you, and how a bot built with it is laid out.
Nubis is a TypeScript framework for Discord bots. It treats a bot the way modern web frameworks treat an app: a file is a command, types come from what you wrote, and tests run without Discord.
// commands/ping.ts → /ping
import { command } from "nubis";
export default command({
description: "Check that the bot is alive",
run: ({ reply }) => reply("Pong!"),
});That file is the whole command. Run nubis dev and /ping appears in your test server; edit the file and it updates.
Why another framework
Discord's API is large, and the libraries around it mostly hand it to you as it is. You end up writing the same things in every bot: a command registry, a custom_id parser, a "did I already reply?" flag, a deploy script for commands, and the checks Discord applies only after you have shipped.
Nubis writes those once:
- Files are commands.
commands/config/set.tsis/config set. Folders become subcommands and groups. - Types come from definitions. Option values, choice unions, component state, select values and modal fields are inferred. There are no string lookups.
- Components carry typed state in their
custom_id, validated with any Standard Schema library on every click. - Discord's rules are checked when you define something, not when Discord rejects it: name formats, length limits, option counts,
custom_idlength, rows of components. - One
reply(). Nubis shows "thinking…" for slow handlers, turns later replies into follow-ups and answers errors, so "already replied" and "did not respond" stop happening by accident. - Tests without Discord.
nubis/testingruns commands, buttons, selects, modals and menus the way Discord would. - Runs anywhere. Node and Bun, over the gateway or as an HTTP interactions endpoint.
How a bot is laid out
my-bot/
├── commands/ one slash command per file
│ ├── ping.ts → /ping
│ └── fun/
│ ├── _folder.ts settings for /fun
│ └── roll.ts → /fun roll
├── components/ buttons, selects and modals
├── menus/ right-click commands
├── events/ gateway events
├── tests/
└── nubis.config.ts bot-wide settingsEvery folder is optional. Project layout has the details.
Packages
| Package | What it is |
|---|---|
nubis | The framework, the nubis CLI, nubis/node and nubis/testing. This is the one you install. |
create-nubis | Creates a new bot: npx create-nubis my-bot. |
@nubisjs/core | Commands, components, modals, guards and dispatch, with no Node dependencies. |
@nubisjs/testing | The test helpers behind nubis/testing. |
Next: Getting started.