Tối ưu cho Bun
Được xây dựng từ đầu cho runtime Bun. Sử dụng Bun.serve(), Bun.password và socket TCP gốc để đạt hiệu suất tối đa.
Nhanh, mô-đun và được tối ưu hoàn toàn cho runtime Bun
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ính năng | Orbit | NestJS |
|---|---|---|
| Runtime | Bun (gốc) | Node.js |
| Máy chủ HTTP | Bun.serve() | Express/Fastify |
| Băm mật khẩu | Bun.password | bcrypt |
| Microservices | TCP gốc | Thư viện bên ngoài |
| Khởi động lạnh | ~10ms | ~100ms |
| Sử dụng bộ nhớ | Thấp hơn | Cao hơn |
Orbit là một monorepo với 32 gói được tổ chức theo chức năng: