bun-server-quickstart

Bun Server Quick Start

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "bun-server-quickstart" with this command: npx skills add dangaogit/bun-server-skills/dangaogit-bun-server-skills-bun-server-quickstart

Bun Server Quick Start

Prerequisites

  • Bun ≥ 1.3.3

Critical Configuration

tsconfig.json (Required)

{ "compilerOptions": { "target": "ESNext", "module": "ESNext", "moduleResolution": "bundler", "strict": true, "experimentalDecorators": true, "emitDecoratorMetadata": true } }

Critical: Both experimentalDecorators and emitDecoratorMetadata must be enabled, otherwise dependency injection will fail.

Minimal Application

import { Application, Controller, GET, Injectable } from "@dangao/bun-server";

@Injectable() class HealthService { ping() { return { status: "ok" }; } }

@Controller("/api") class HealthController { constructor(private readonly service: HealthService) {}

@GET("/health") check() { return this.service.ping(); } }

const app = new Application({ port: 3100 }); app.getContainer().register(HealthService); app.registerController(HealthController); app.listen();

Modular Application

import { Application, Module, Controller, GET, Injectable, ConfigModule, } from "@dangao/bun-server";

@Injectable() class UserService { getUsers() { return [{ id: 1, name: "Alice" }]; } }

@Controller("/users") class UserController { constructor(private readonly userService: UserService) {}

@GET("/") list() { return this.userService.getUsers(); } }

@Module({ imports: [ConfigModule.forRoot({ defaultConfig: {} })], controllers: [UserController], providers: [UserService], }) class AppModule {}

const app = new Application({ port: 3100 }); app.registerModule(AppModule); app.listen();

Recommended Project Structure

src/ ├── main.ts # Entry point ├── app.module.ts # Root module ├── users/ │ ├── user.module.ts │ ├── user.controller.ts │ └── user.service.ts └── common/ └── middleware/

Common Imports

// Core import { Application, Controller, Module, Injectable } from "@dangao/bun-server";

// HTTP decorators import { GET, POST, PUT, DELETE, PATCH } from "@dangao/bun-server";

// Parameter decorators import { Body, Query, Param, Header, Ctx } from "@dangao/bun-server";

// DI import { Inject, Scope, SCOPE } from "@dangao/bun-server";

// Modules import { ConfigModule, EventModule, LoggerModule, SecurityModule, } from "@dangao/bun-server";

Run Commands

Install dependencies

bun install

Run application

bun run src/main.ts

Run tests (in package directory)

bun --cwd=packages/bun-server test

Next Steps

  • Dependency Injection

  • Controllers and Routing

  • Module System

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

bun-server-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review
General

bun-server-di

No summary provided by upstream source.

Repository SourceNeeds Review
General

bun-server-database

No summary provided by upstream source.

Repository SourceNeeds Review
General

auto-skills

No summary provided by upstream source.

Repository SourceNeeds Review