How bytium-labs/bytium-core works
bytium-core is a modular TypeScript framework for FiveM Enhanced. Its main workflow is to bootstrap a decorated resource, discover modules/controllers/providers, resolve dependencies, and dispatch FiveM commands, events, ticks, callbacks, or HTTP requests through handlers. The repository also provides browser-side NUI communication and optional feature packages for configuration, persistence, and localization. The graph follows the README’s documented lifecycle and the sampled HTTP/NUI implementations; unsampled package internals are represented at their exact enclosing directories, with links omitted where evidence does not establish a call.
Main entry points: http-router.service.ts HTTP router · citizenfx-runtime.manager.ts Runtime manager · discovery.service.ts Provider discovery · bootstrap.utils.ts Resource bootstrap
Components 22
Resource foundation
- Resource bootstrap
packages/common/src/core/utils/bootstrap.utils.ts - Modules and metadata
packages/common/src/core/decorators/bytium-resource-module.decorator.ts - Provider discovery
packages/common/src/core/services/discovery.service.ts - Dependency resolution
packages/common/src/core/managers/bytium-dependency.manager.ts - Handler pipeline
packages/common/src/core/invokers/handler.invoker.ts
FiveM runtime
- Runtime manager
packages/common/src/citizenfx/managers/citizenfx-runtime.manager.ts - Runtime decorators
packages/common/src/citizenfx/decorators - Event and task registries
packages/common/src/citizenfx/registries - Callback services
packages/common/src/citizenfx/services/callbacks.service.ts
HTTP handling
- HTTP route decorators
packages/http/src/http/decorators - HTTP router
packages/http/src/http/services/http-router.service.ts - HTTP middleware
packages/http/src/http/middleware/cors.middleware.ts - Multipart uploads
packages/http-multipart/src/multipart/interceptors/multipart.interceptor.ts
Feature packages
- Configuration
packages/config/src/config/services/config.service.ts - TypeORM integration
packages/database/src/database/services/type-orm-core.service.ts - Translations
packages/i18n/src/i18n/services/i18n.service.ts - Vector math
packages/math/src/math/classes/vector3.class.ts
NUI browser
- NUI SDK
packages/nui/src/nui/nui.ts - React hooks
packages/nui-react/src/use-nui-call.ts - NUI call state
packages/nui-react/src/interfaces/nui-call-state.interface.ts
Other components
- FiveM runtime
- HTTP request
Connections 21
- Resource bootstrap → Modules and metadata: boots modules
README.md - Modules and metadata → Provider discovery: declares providers
- Provider discovery → Dependency resolution: resolves providers
- Dependency resolution → Handler pipeline: supplies instances
- Resource bootstrap → Runtime manager: wires runtime
- Runtime manager → FiveM runtime: registers handlers
- Runtime decorators → Event and task registries: registers metadata
- Runtime manager → Event and task registries: dispatches entries
- HTTP request → HTTP router: dispatches request
packages/http/src/http/services/http-router.service.ts - HTTP router → FiveM runtime: registers HTTP handler
packages/http/src/http/services/http-router.service.ts - HTTP router → Handler pipeline: invokes handler
packages/http/src/http/services/http-router.service.ts - HTTP router → Provider discovery: discovers controllers
packages/http/src/http/services/http-router.service.ts - HTTP router → HTTP middleware: runs middleware
packages/http/src/http/services/http-router.service.ts - HTTP route decorators → HTTP router: defines routes
packages/http/src/http/services/http-router.service.ts - Multipart uploads → HTTP router: parses request body
- Configuration → FiveM runtime: reads resource config
packages/config/src/config/services/config.service.ts - TypeORM integration → FiveM runtime: manages data sources
- Translations → FiveM runtime: loads resource catalogs
packages/i18n/src/i18n/services/i18n.service.ts - React hooks → NUI SDK: calls SDK
packages/nui-react/src/use-nui-call.ts - React hooks → NUI call state: uses call state
packages/nui-react/src/use-nui-call.ts - NUI SDK → FiveM runtime: calls NUI callback
packages/nui/src/nui/nui.ts