Skip to content

AI Documentation

OneBun provides LLM-optimized documentation for use with AI coding assistants.

Available Formats

FormatDescriptionUse Case
llms.txtNavigation index with linksQuick reference, RAG systems
llms-full.txtComplete documentationFull context for AI agents

Usage with AI Assistants

Cursor / Windsurf / Similar IDEs

Add to project rules (.cursor/rules/ or similar):

When working with OneBun framework, fetch documentation from:
https://onebun.dev/llms-full.txt

Or reference Context7 with library ID onebun.

ChatGPT / Claude / Other Chat Interfaces

  1. Copy content from llms-full.txt
  2. Paste into conversation as context
  3. Ask questions about OneBun framework

RAG Systems / Custom Agents

python
import requests

# Fetch documentation index
docs = requests.get("https://onebun.dev/llms.txt").text

# Or full documentation
full_docs = requests.get("https://onebun.dev/llms-full.txt").text

MCP Context7

OneBun documentation is indexed by Context7. Use library ID onebun with Context7 MCP server:

json
{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"]
    }
  }
}

What's Included

  • API reference for all packages (@onebun/core, @onebun/cache, @onebun/drizzle, etc.)
  • Code examples and patterns
  • Type signatures and interfaces
  • Common errors and solutions
  • Technical notes in <llm-only> blocks (visible only to AI)

Key Packages

PackageDescription
@onebun/coreFramework core: Modules & DI, Controllers with decorator routing, Services, WebSocket Gateway (+ Socket.IO + typed client), Queue & Scheduler (in-memory, Redis, NATS, JetStream backends), HTTP Guards (@UseGuards, AuthGuard, RolesGuard, createHttpGuard), Exception Filters (@UseFilters, createExceptionFilter, defaultExceptionFilter), TestingModule for isolated controller/service tests (TestingModule.create(...).overrideProvider(...).compile()), Security Middleware (CorsMiddleware, RateLimitMiddleware, SecurityHeadersMiddleware), Middleware, MultiServiceApplication for microservices, Graceful Shutdown, SSE (@Sse, sse())
@onebun/docsAutomatic OpenAPI 3.1 generation from decorators and ArkType schemas, Swagger UI, @ApiTags, @ApiOperation decorators
@onebun/drizzleDrizzle ORM integration: PostgreSQL + SQLite (bun:sqlite), schema-first types, CLI & programmatic migrations, auto-migrate on startup, BaseRepository pattern
@onebun/cacheCacheModule with in-memory (TTL, max size) and Redis backends, shared Redis connection pool, batch operations (getMany/setMany/deleteMany)
@onebun/envsType-safe environment configuration: schema with Env.string/number/boolean/array, validation, defaults, transforms, sensitive value masking, .env file support
@onebun/loggerStructured logging: JSON (production) and pretty (development) output, 6 log levels, child loggers with context inheritance, automatic trace context integration
@onebun/metricsPrometheus-compatible metrics: automatic HTTP/system/GC collection, @Timed/@Counted decorators, custom Counter/Gauge/Histogram, /metrics endpoint
@onebun/traceOpenTelemetry distributed tracing: automatic HTTP tracing, @Span decorator, configurable sampling rate, export to external collectors
@onebun/requestsHTTP client: Bearer/API Key/Basic/HMAC auth, retry strategies (fixed/linear/exponential), typed ApiResponse, typed service clients via createServiceDefinition for inter-service communication
@onebun/natsNATS and JetStream integration for distributed queues and messaging with at-least-once delivery

Database Migrations (@onebun/drizzle)

The Drizzle package provides database schema management:

Schema imports:

  • PostgreSQL: import { pgTable, text, integer, ... } from '@onebun/drizzle/pg'
  • SQLite: import { sqliteTable, text, integer, ... } from '@onebun/drizzle/sqlite'
  • Common operators: import { eq, and, sql, count, defineConfig, ... } from '@onebun/drizzle'

CLI (use onebun-drizzle wrapper for correct version):

  • bunx onebun-drizzle generate - Generate migration files
  • bunx onebun-drizzle push - Push schema directly (dev only)
  • bunx onebun-drizzle studio - Open Drizzle Studio

Programmatic API:

  • generateMigrations() - Generate SQL files from schema (build step)
  • pushSchema() - Apply schema directly (development)
  • DrizzleService.runMigrations() - Apply migrations at runtime
  • autoMigrate: true - Auto-run migrations on app startup

See Database API for full documentation.

Format Details

Documentation follows llmstxt.org standard:

  • Plain Markdown without HTML
  • Self-contained sections for RAG chunking
  • Descriptions for each page
  • Generated by vitepress-plugin-llms

Per-Page Markdown

Each documentation page is also available as .md file alongside the HTML version:

  • /api/core/api/core.md
  • /getting-started/getting-started.md
  • etc.

Use these for individual page context when full documentation is too large.

Released under the LGPL-3.0 License.