AI Documentation
OneBun provides LLM-optimized documentation for use with AI coding assistants.
Available Formats
| Format | Description | Use Case |
|---|---|---|
| llms.txt | Navigation index with links | Quick reference, RAG systems |
| llms-full.txt | Complete documentation | Full 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.txtOr reference Context7 with library ID onebun.
ChatGPT / Claude / Other Chat Interfaces
- Copy content from llms-full.txt
- Paste into conversation as context
- 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").textMCP 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
| Package | Description |
|---|---|
@onebun/core | Framework 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/docs | Automatic OpenAPI 3.1 generation from decorators and ArkType schemas, Swagger UI, @ApiTags, @ApiOperation decorators |
@onebun/drizzle | Drizzle ORM integration: PostgreSQL + SQLite (bun:sqlite), schema-first types, CLI & programmatic migrations, auto-migrate on startup, BaseRepository pattern |
@onebun/cache | CacheModule with in-memory (TTL, max size) and Redis backends, shared Redis connection pool, batch operations (getMany/setMany/deleteMany) |
@onebun/envs | Type-safe environment configuration: schema with Env.string/number/boolean/array, validation, defaults, transforms, sensitive value masking, .env file support |
@onebun/logger | Structured logging: JSON (production) and pretty (development) output, 6 log levels, child loggers with context inheritance, automatic trace context integration |
@onebun/metrics | Prometheus-compatible metrics: automatic HTTP/system/GC collection, @Timed/@Counted decorators, custom Counter/Gauge/Histogram, /metrics endpoint |
@onebun/trace | OpenTelemetry distributed tracing: automatic HTTP tracing, @Span decorator, configurable sampling rate, export to external collectors |
@onebun/requests | HTTP client: Bearer/API Key/Basic/HMAC auth, retry strategies (fixed/linear/exponential), typed ApiResponse, typed service clients via createServiceDefinition for inter-service communication |
@onebun/nats | NATS 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 filesbunx 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 runtimeautoMigrate: 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.
