Bun Core Platform

A modern, high-performance backend built on Bun runtime with TypeScript, Hono framework, and hexagonal architecture.

Overview

The Bun Core Platform provides a production-ready foundation with:
  • Framework: Hono (lightweight, edge-ready)
  • Runtime: Bun 1.x (fast startup, native TypeScript)
  • Database: MongoDB with MongoOS (auto-sharding)
  • Cache: BunRedis (Bun’s native Redis client) + In-memory fallback
  • Architecture: Hexagonal (ports & adapters)
  • API Format: REST with idempotency, i18n, rate limiting

Key Features

FeatureDescription
Idempotent APISafe retries via Idempotency-Key header
Rate LimitingSliding window algorithm, per-user/IP
i18nMulti-locale support (en, ms) with fallback
Smart LoggingMulti-transport (console, file, MongoDB)
Health ChecksLiveness + readiness probes

Get Started

Project Structure

backend/bun/
├── apps/
│   └── monolith/           ← Main Hono application
├── packages/
│   ├── domain/            ← Business entities & rules
│   ├── application/       ← Use cases & ports
│   └── infrastructure/    ← Adapters (DB, cache, i18n, logging)
├── config/
│   └── MONOLITH_CONFIG.md ← Configuration reference
└── docs/                  ← This documentation

Environment

# Server
PORT=3100
NODE_ENV=development

# MongoDB
MONGODB_URL=mongodb://localhost:27017/clawui

# Redis (optional - falls back to in-memory)
REDIS_URL=redis://localhost:6379

# Rate Limiting
RATE_LIMIT_ENABLED=true
RATE_LIMIT_TTL=60
RATE_LIMIT_MAX=100

External Resources