Skip to content

OrbitFramework theo phong cách NestJS cho Bun

Nhanh, mô-đun và được tối ưu hoàn toàn cho runtime Bun

Ví dụ nhanh

typescript
import { BunFactory, Module, Controller, Get, Injectable } from '@galaxy-stack/orbit-core';

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

@Controller('users')
class UserController {
  constructor(private userService: UserService) {}

  @Get()
  findAll() {
    return this.userService.getUsers();
  }
}

@Module({
  controllers: [UserController],
  providers: [UserService],
})
class AppModule {}

const app = await BunFactory.create(AppModule);
await app.listen(3000);

Tại sao chọn Orbit?

Tính năngOrbitNestJS
RuntimeBun (gốc)Node.js
Máy chủ HTTPBun.serve()Express/Fastify
Băm mật khẩuBun.passwordbcrypt
MicroservicesTCP gốcThư viện bên ngoài
Khởi động lạnh~10ms~100ms
Sử dụng bộ nhớThấp hơnCao hơn

Tổng quan về các gói

Orbit là một monorepo với 32 gói được tổ chức theo chức năng:

  • Core: @galaxy-stack/orbit-core, @galaxy-stack/orbit-common, @galaxy-stack/orbit-config, @galaxy-stack/orbit-validation
  • Cơ sở dữ liệu: @galaxy-stack/orbit-database, @galaxy-stack/orbit-cache
  • Microservices: @galaxy-stack/orbit-microservices-tcp, redis, nats, rmq, kafka, grpc
  • GraphQL: @galaxy-stack/orbit-graphql, @galaxy-stack/orbit-graphql-federation
  • Bảo mật: @galaxy-stack/orbit-auth, @galaxy-stack/orbit-security, @galaxy-stack/orbit-throttler
  • Khả năng quan sát: @galaxy-stack/orbit-observability, @galaxy-stack/orbit-logger, @galaxy-stack/orbit-telemetry
  • Công cụ: orbit, @galaxy-stack/orbit-testing, @galaxy-stack/orbit-devtools

Released under the MIT License.