New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

@galaxy-stack/orbit-cli

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@galaxy-stack/orbit-cli

Orbit CLI - scaffolding and code generation for the Orbit framework

latest
Source
npmnpm
Version
0.1.12
Version published
Weekly downloads
333
Maintainers
1
Weekly downloads
 
Created
Source

@galaxy-stack/orbit-cli

npm version docs

Part of the Orbit framework — a NestJS-style backend framework for Bun.

Installation

bun add @galaxy-stack/orbit-cli

orbit

Mô tả

CLI tool cho Orbit framework để scaffolding projects và generate components.

Cài đặt

bun add -g orbit
# hoặc
npx orbit

Commands

1. Tạo Project mới

orbit new my-app
orbit new my-app --template api
orbit new my-app --template graphql
orbit new my-app --template microservice

2. Generate Components

# Controller
orbit generate controller user
orbit g co user

# Service
orbit generate service user
orbit g s user

# Module
orbit generate module user
orbit g mo user

# Guard
orbit generate guard auth
orbit g gu auth

# Pipe
orbit generate pipe validation
orbit g pi validation

# Interceptor
orbit generate interceptor logging
orbit g in logging

# Middleware
orbit generate middleware cors
orbit g mi cors

# Filter
orbit generate filter http-exception
orbit g f http-exception

# Resource (CRUD)
orbit generate resource user
orbit g res user

3. Development Server

orbit dev
orbit dev --port 3000
orbit dev --watch

4. Build

orbit build
orbit build --minify
orbit build --target bun

5. Test

orbit test
orbit test --watch
orbit test --coverage

Auto-import

CLI tự động update module imports khi generate:

// Trước
@Module({
  controllers: [],
  providers: [],
})
class AppModule {}

// Sau generate controller user
@Module({
  controllers: [UserController],  // Auto-imported
  providers: [],
})
class AppModule {}

Project Structure

my-app/
├── src/
│   ├── main.ts
│   ├── app.module.ts
│   ├── app.controller.ts
│   ├── app.service.ts
│   └── users/
│       ├── users.module.ts
│       ├── users.controller.ts
│       ├── users.service.ts
│       └── dto/
│           └── create-user.dto.ts
├── test/
│   └── app.e2e-spec.ts
├── package.json
├── tsconfig.json
└── bunfig.toml

Options

# Generate với spec file
orbit g co user --spec

# Generate không có spec
orbit g co user --no-spec

# Dry run (không tạo file)
orbit g co user --dry-run

# Flat structure (không tạo folder)
orbit g co user --flat

Benchmark hiệu năng

Repo này kèm bộ benchmark thực tế so sánh Orbit với Elysia, Hono, Fastify, Express, NestJS (Express/Fastify) — từ hello-world đơn giản đến kết nối SQLite thật. Xem chi tiết tại benchmarks/README.md.

Cài đặt & chạy nhanh

git clone https://github.com/galaxy-orbit/orbit-cli.git
cd orbit-cli/benchmarks
bun install
bun run src/runner.ts --runs=3   # full suite (7 framework × 8 scenario, best-of-3)
bun run src/runner.ts --duration=5   # chạy nhanh
bun run src/runner.ts --scenario=db-sqlite   # một scenario cụ thể

Yêu cầu phiên bản

  • Bun ≥ 1.2 (Orbit, Elysia, Hono) — khuyến nghị 1.3.x
  • Node.js ≥ 22.5 (Express, Fastify, NestJS — cần node:sqlite builtin)
  • autocannon tự tải qua npx khi chạy lần đầu

Kết quả mới nhất (macOS Intel i5 2.0GHz, Bun 1.3.14, Node 26.9, 10 connections × 10s × best-of-3)

Orbit 0.2.1 với các tối ưu hot-path, security: false trong benchmark (mọi framework đều không bật security headers mặc định — helmet/secure-headers là plugin opt-in). Mọi server dùng chung schema SQLite + prepared statement. Đậm = cao nhất:

ScenarioOrbitElysiaHonoFastifyNestJS FastifyNestJS ExpressExpress
hello-world31,31526,80429,82523,81323,22710,7417,499
json-serialization28,81631,46328,68718,68221,61710,2969,006
path-params28,44532,59430,03720,27721,87310,1879,975
query-params23,11231,85329,61818,14220,5298,9908,901
body-parsing22,85927,25819,67212,81913,5297,4757,248
db-sqlite27,77135,12925,29421,76623,55615,73014,330
db-list13,97215,37111,5335,5836,7804,6014,534
db-insert17,04912,81517,14211,45912,5396,4067,433

Cold start & bộ nhớ:

FrameworkCold startRSS
Hono113ms27.4MB
Orbit133ms25.8MB
Elysia217ms42.4MB
Express526ms59.6MB
Fastify627ms67.4MB
NestJS Fastify925ms81.4MB
NestJS Express1,331ms79.0MB

Điều gì khiến Orbit nhanh?

Kể từ 0.2.1: static route index O(1), parse pathname bằng indexOf/slice thay vì new URL() (~25× nhanh hơn), lazy-parse query/body/headers, cache pipeline metadata, secure headers set in-place. Full chi tiết trong benchmarks/README.md.

Kết luận thực tế: Orbit nhanh hơn mọi full framework ở cả 8 scenarios — hơn NestJS Express 1.8–3.1×, hơn NestJS Fastify 1.1–2.1×, hơn Fastify 1.3–2.5×, hơn Express 1.9–4.2× — trong khi là framework duy nhất của nhóm này có cold start 133ms + RSS 25.8MB thấp nhất. So với micro-frameworks (Elysia, Hono — không DI/decorators/pipeline): Orbit thắng hello-world (+17% so Elysia), db-insert (+33%), body-parsing/db-list/db-sqlite (thắng Hono); Elysia nhỉnh hơn 9–27% ở json/path/query — một sự cân bằng rất sát cho một framework có đủ DI + pipeline.

FAQs

Package last updated on 26 Sep 2026

Related posts