Skip to content

cinnabunjs/core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@cinnabun/core

Production-ready TypeScript framework for Bun with decorators, dependency injection, and type safety. Spring Boot-inspired.

Installation

bun add @cinnabun/core reflect-metadata

Features

  • Dependency Injection — constructor and field injection with singleton scope
  • Decorator-driven routing@GetMapping, @PostMapping, @PutMapping, @DeleteMapping, @PatchMapping
  • Validation — Zod-based request validation via @Validate()
  • Guards — access control with @UseGuard()
  • Interceptors — request/response transformation with @UseInterceptor()
  • Middleware — class-based middleware via @UseMiddleware()
  • WebSocket — message broker with @EnableWebSocketMessageBroker, @MessageMapping, @SendTo
  • Plugin system — lifecycle hooks (onInit, onReady, onShutdown)
  • Module system — organize code with @Module()
  • Lifecycle hooks@PostConstruct() and @PreDestroy()

Quick Start

// src/main.ts
import "reflect-metadata";
import {
  CinnabunApp,
  CinnabunFactory,
  RestController,
  Service,
  GetMapping,
  Param,
} from "@cinnabun/core";

@Service()
class GreetingService {
  greet(name: string) {
    return `Hello, ${name}!`;
  }
}

@CinnabunApp({ port: 3000, scanPaths: [] })
@RestController("/api")
class App {
  constructor(private greetingService: GreetingService) {}

  @GetMapping("/")
  index() {
    return { message: "Welcome to Cinnabun!" };
  }

  @GetMapping("/hello/:name")
  hello(@Param("name") name: string) {
    return { message: this.greetingService.greet(name) };
  }
}

CinnabunFactory.run(App);

Run

bun run src/main.ts

Documentation

See the main Cinnabun README and docs/ for architecture, API reference, and implementation guides.

Requirements

  • Bun v1.0+
  • TypeScript with experimentalDecorators and emitDecoratorMetadata enabled

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors