Core Overview
Foundational concepts and APIs that power every Robo.js project.
The Core section covers the foundational concepts, APIs, and conventions that every Robo.js project relies on. Whether you are building a Discord bot, an activity, or a web server, these topics apply across all project types.
Project Foundations
Every Robo.js project follows a consistent file structure where directories like src/commands/ and src/events/ determine functionality automatically. Configuration lives in the config/ directory, and sensitive values are stored in .env files that Robo.js loads at startup.
File Structure
Standard directories and conventions for Robo.js projects.
Configuration
Customize project behavior, intents, permissions, and Sage mode.
Environment Variables
Manage secrets and mode-specific settings with .env files.
Data and State
Robo.js provides two built-in systems for managing data. State offers fast, in-memory storage for session-scoped values that survive hot reloads but clear on shutdown. Flashcore provides persistent key-value storage that survives restarts, with support for external databases through Keyv adapters.
State Management
In-memory data that persists across hot reloads.
Flashcore Database
Built-in database with models, relations, queries, and key-value storage.
Developer Tools
The built-in logger provides structured output with log levels, child loggers, and custom drains. TypeScript works out of the box with zero configuration. Modes let you run different profiles (development, production, or custom) with distinct environment variables and code paths.
Logger
Structured logging with levels, child loggers, and custom drains.
TypeScript
First-class TypeScript support with no setup required.
Mode
Run different profiles with distinct configs and environment variables.
Linting
ESLint and Prettier setup for code quality.
Architecture
For larger projects, modules group related commands and events into self-contained units. The Portal API provides runtime access to your project's registered commands, events, and modules. Understanding the internals helps when debugging or extending the framework.
