Module Reference

Stacks.js is split across first-party framework packages under the @stacksjs/ scope. The pinned source manifest inventories 90 versioned package manifests across the repository; that count describes packaging scope, not protocol conformance or production fitness. Framework packages generally:

  • Exposes a defined interface — The TypeScript types serve as the specification
  • Is independently usable — Use any module in any TypeScript project
  • Follows consistent patterns — Shared conventions across all modules
  • Supports driver-based extensibility — Implement custom backends where applicable

Core Framework Modules

Application & Configuration

ModulePackagePurpose
Actions@stacksjs/actionsBusiness logic encapsulation pattern
Alias@stacksjs/aliasPath and module aliasing
Config@stacksjs/configConfiguration management
Env@stacksjs/envEnvironment variable handling
Enums@stacksjs/enumsEnumeration utilities
Path@stacksjs/pathPath manipulation utilities
Registry@stacksjs/registryService and package registry
Types@stacksjs/typesShared type definitions
Utils@stacksjs/utilsGeneral utility functions

HTTP & Routing

ModulePackagePurpose
API@stacksjs/apiAPI client and server utilities
HTTP@stacksjs/httpHTTP client and utilities
Router@stacksjs/routerHTTP routing and middleware
Server@stacksjs/serverHTTP server (Bun-native)
Tunnel@stacksjs/tunnelDevelopment tunneling (localtunnels)

Database & ORM

ModulePackagePurpose
Database@stacksjs/databaseDatabase connection layer
DB@stacksjs/dbDatabase query utilities
ORM@stacksjs/ormObject-relational mapping
Query Builder@stacksjs/query-builderFluent SQL query builder

Authentication & Security

ModulePackagePurpose
Auth@stacksjs/authAuthentication system
Security@stacksjs/securitySecurity utilities (CSRF, XSS, encryption)
Validation@stacksjs/validationInput validation and sanitization

Caching & Performance

ModulePackagePurpose
Cache@stacksjs/cacheMulti-driver caching layer

Queue & Background Jobs

ModulePackagePurpose
Cron@stacksjs/cronCron expression parsing
Queue@stacksjs/queueJob queue system (inspired by BullMQ)
Scheduler@stacksjs/schedulerTask scheduling

Events & Real-Time

ModulePackagePurpose
Events@stacksjs/eventsEvent dispatching and listeners
Realtime@stacksjs/realtimeWebSocket server and real-time features
Broadcasting@stacksjs/broadcastingEvent broadcasting to WebSocket channels

Email & Communication

ModulePackagePurpose
Email@stacksjs/emailEmail sending (multi-provider)
Mail Server@stacksjs/mail-serverFull mail server (post)
Notifications@stacksjs/notificationsMulti-channel notifications
Push@stacksjs/pushPush notification support
SMS@stacksjs/smsSMS messaging
Communication@stacksjs/communicationUnified communication layer

Storage & Files

ModulePackagePurpose
Storage@stacksjs/storageFile storage (local, S3, GCS)

AI & Intelligence

ModulePackagePurpose
AI@stacksjs/aiAI provider integration (OpenAI, Anthropic, etc.)
Chat@stacksjs/chatChat/conversation functionality

Frontend & UI

ModulePackagePurpose
Browser@stacksjs/browserBrowser detection and utilities
Components@stacksjs/componentsSTX UI components
UI@stacksjs/uiUI rendering engine
Vite Config@stacksjs/vite-configVite configuration presets
Vite Plugin@stacksjs/vite-pluginCustom Vite plugins

CLI & Developer Tools

ModulePackagePurpose
Buddy@stacksjs/buddyCLI toolkit and commands
Bun Create@stacksjs/bun-createProject scaffolding
CLI@stacksjs/cliCLI creation utilities
Lint@stacksjs/lintCode linting and formatting
Repl@stacksjs/replRead-eval-print loop
Shell@stacksjs/shellShell command execution
Tinker@stacksjs/tinkerInteractive REPL for Stacks
X-Ray@stacksjs/x-rayDebugging and inspection tools

Build & Deployment

ModulePackagePurpose
Build@stacksjs/buildBuild system and bundling
Cloud@stacksjs/cloudts-cloud IaC integration
Deploy@stacksjs/deployDeployment automation

Desktop & Mobile

ModulePackagePurpose
Desktop@stacksjs/desktopDesktop & mobile app support (Craft)

Dashboard & Admin

ModulePackagePurpose
Dashboard@stacksjs/dashboardAuto-generated admin UI with analytics

Content & Commerce

ModulePackagePurpose
CMS@stacksjs/cmsContent management system
Commerce@stacksjs/commerceE-commerce functionality

Analytics & Monitoring

ModulePackagePurpose
Analytics@stacksjs/analyticsAnalytics tracking
Health@stacksjs/healthHealth checks and monitoring
Logging@stacksjs/loggingStructured logging (Clarity)

Search & Discovery

ModulePackagePurpose
Search Engine@stacksjs/search-engineFull-text search integration

Date, Time & Formatting

ModulePackagePurpose
Calendar@stacksjs/calendarCalendar utilities
DateTime@stacksjs/datetimeDate/time handling (ts-datetime)

Data Structures & Utilities

ModulePackagePurpose
Arrays@stacksjs/arraysArray manipulation utilities
Collections@stacksjs/collectionsCollection utilities (ts-collect)
Objects@stacksjs/objectsObject manipulation utilities
Slug@stacksjs/slugURL slug generation
Strings@stacksjs/stringsString manipulation utilities

Testing & Quality

ModulePackagePurpose
Faker@stacksjs/fakerFake data generation (ts-mocker)
Testing@stacksjs/testingTest utilities and helpers

Networking & DNS

ModulePackagePurpose
DNS@stacksjs/dnsDNS management (dnsx)
Whois@stacksjs/whoisWHOIS lookup utilities

Documentation

ModulePackagePurpose
Docs@stacksjs/docsDocumentation generation

Error Handling

ModulePackagePurpose
Error Handling@stacksjs/error-handlingError management and reporting

Version Control

ModulePackagePurpose
Git@stacksjs/gitGit integration utilities

Social & External Services

ModulePackagePurpose
Payments@stacksjs/paymentsPayment processing (Stripe, etc.)
Socials@stacksjs/socialsSocial media integration

Plugin System

ModulePackagePurpose
Plugins@stacksjs/pluginsPlugin architecture and loading

Configuration Reference

All configuration files are located in config/ and use TypeScript for type safety.

Config FilePurposeKey Options
app.tsApplication settingsname, env, timezone, locale, key
auth.tsAuthenticationguards, providers, tokens, session
database.tsDatabase connectionsdefault, connections, migrations, seeders
cache.tsCachingdefault, stores, prefix, ttl
queue.tsJob queuedefault, connections, failed, retries
email.tsEmaildefault, mailers, from, queue
ai.tsAI providersdefault, providers, models, streaming
cloud.tsCloud infrastructureproject, mode, infrastructure, region
security.tsSecurity settingscors, csp, rateLimit, encryption
commerce.tsE-commercecurrency, products, checkout, tax
storage.tsFile storagedefault, disks, visibility
logging.tsLoggingdefault, channels, level
notification.tsNotificationschannels, queue
scheduler.tsTask schedulingtimezone, overlap
server.tsHTTP serverport, host, ssl, compression
seo.tsSEO settingssitemap, robots, meta
i18n.tsInternationalizationlocale, fallback, locales
search.tsSearch configurationdefault, drivers
broadcasting.tsReal-time broadcastingdefault, connections
analytics.tsAnalyticsproviders, tracking
cms.tsContent managementcollections, media
desktop.tsDesktop app settingswindow, menu, tray
dns.tsDNS configurationprovider, zone
health.tsHealth checkschecks, endpoints
plugins.tsPlugin configurationenabled, paths

CLI Command Reference

Development

buddy dev                    # Start development server with hot reload
buddy dev --port 3001        # Use custom port
buddy dev --https            # Enable HTTPS
buddy serve                  # Start production server
buddy tinker                 # Interactive REPL
buddy repl                   # Alternative REPL command

Building & Testing

buddy build                  # Build for production
buddy build --analyze        # Build with bundle analysis
buddy test                   # Run test suite
buddy test:watch             # Run tests in watch mode
buddy test:coverage          # Run with coverage report
buddy lint                   # Run linters
buddy lint:fix               # Fix linting issues
buddy typecheck              # Check TypeScript types
buddy types:generate         # Generate type definitions

Database

buddy migrate                # Run pending migrations
buddy migrate:fresh          # Drop all and re-migrate
buddy migrate:rollback       # Rollback last batch
buddy migrate:status         # Show migration status
buddy seed                   # Run database seeders
buddy db:wipe                # Drop all tables
buddy db:backup              # Backup database
buddy make:migration         # Create migration file
buddy make:model             # Create model with migration
buddy make:seeder            # Create seeder file

Code Generation

buddy make:controller        # Create controller
buddy make:model             # Create model
buddy make:action            # Create action
buddy make:middleware        # Create middleware
buddy make:event             # Create event
buddy make:listener          # Create listener
buddy make:job               # Create job
buddy make:notification      # Create notification
buddy make:component         # Create STX component
buddy make:command           # Create CLI command

Cache & Queue

buddy cache:clear            # Clear application cache
buddy cache:table            # Create cache database table
buddy queue:work             # Start queue worker
buddy queue:listen           # Listen for jobs (dev)
buddy queue:restart          # Restart queue workers
buddy queue:failed           # List failed jobs
buddy queue:retry            # Retry failed jobs
buddy queue:flush            # Flush failed jobs
buddy schedule:run           # Run scheduled tasks
buddy schedule:list          # List scheduled tasks

Broadcasting & Real-Time

buddy broadcast:serve        # Start WebSocket server
buddy broadcast:serve --host=0.0.0.0  # Bind to all interfaces
buddy broadcast:serve --port=6001     # Custom port
buddy broadcast:serve --tls           # Enable TLS
buddy broadcast:status       # Show WebSocket server status
buddy broadcast:channels     # List active channels
buddy broadcast:connections  # List active connections

Cloud & Deployment

buddy deploy                 # Deploy application
buddy deploy --env=staging   # Deploy to staging
buddy cloud:up               # Provision infrastructure
buddy cloud:down             # Tear down infrastructure
buddy cloud:status           # Show infrastructure status
buddy cloud:ssh              # SSH into server
buddy cloud:logs             # View cloud logs
buddy cloud:secret           # Manage secrets

Security & Keys

buddy key:generate           # Generate application key
buddy dev:cert               # Generate dev SSL certificate
buddy dev:cert --trust       # Trust the certificate

Publishing & Release

buddy release                # Create new release
buddy release:patch          # Patch version bump
buddy release:minor          # Minor version bump
buddy release:major          # Major version bump
buddy publish                # Publish packages
buddy changelog              # Generate changelog

AI Assistant

buddy ai                     # Start AI assistant
buddy ai:chat                # Interactive chat mode
buddy ai:generate            # Generate code with AI
buddy ai:review              # AI code review

Utilities

buddy doctor                 # Check system health
buddy upgrade                # Upgrade Stacks
buddy config:show            # Show configuration
buddy config:validate        # Validate configuration
buddy route:list             # List all routes
buddy storage:link           # Create storage symlink
buddy profile                # Profile application
buddy profile:cpu            # CPU profiling
buddy profile:memory         # Memory profiling
buddy search:index           # Index searchable models
buddy search:flush           # Flush search index
buddy search:import          # Import data to search

i18n

buddy i18n:extract           # Extract translatable strings
buddy i18n:check             # Check for missing translations
buddy i18n:sync              # Sync translation files

SEO

buddy seo:sitemap            # Generate sitemap
buddy seo:check              # Check SEO configuration

Module Usage Examples

Actions Pattern

import { Action } from '@stacksjs/actions'

export default new Action({
  name: 'CreateUser',
  description: 'Create a new user account',

  rules: {
    email: 'required|email|unique:users',
    password: 'required|min:8',
  },

  async handle({ email, password }) {
    return await User.create({ email, password })
  }
})

Events & Listeners

// Event definition
import { Event } from '@stacksjs/events'

export const UserRegistered = new Event({
  name: 'UserRegistered',
  listeners: ['SendWelcomeEmail', 'NotifyAdmins'],
})

// Dispatching
await UserRegistered.dispatch({ user })

Scheduled Tasks

// config/scheduler.ts
export default {
  tasks: [
    {
      command: 'cache:clear',
      schedule: '0 0 * * *', // Daily at midnight
    },
    {
      job: 'CleanupTempFiles',
      schedule: '*/30 * * * *', // Every 30 minutes
    },
  ]
}

Health Checks

// config/health.ts
export default {
  checks: [
    'database',
    'cache',
    'queue',
    'storage',
    {
      name: 'custom',
      check: async () => {
        // Custom health check logic
        return { healthy: true }
      }
    }
  ]
}

Plugin System

// plugins/my-plugin.ts
import { Plugin } from '@stacksjs/plugins'

export default new Plugin({
  name: 'my-plugin',

  boot() {
    // Plugin initialization
  },

  register() {
    // Register services
  }
})