Framework startup time and feedback

Hello Devforum and code guru’s!

I’ve made my own personal framework (that I might share), and I was wondering if a 1.01ms startup time is breaking anyone’s meter for fast?

FYI, the framework includes:

  • Smart dependency resolution - Automatic circular dependency detection and handling
  • Proper Client/server architecture - Seamless execution on both client and server with automatic detection
  • Service/ Controller management - Register, initialize, and manage services/controllers with lifecycle hooks
  • Memory management - Automatic cleanup and connection handling to prevent leaks
  • Error handling - Error recovery with optional player kick on critical failures
  • Debug tooling - Comprehensive logging with performance metrics and timing
  • Event system - Built-in signal/event handling for service communication
  • Timeout protection - Configurable timeouts to prevent hanging during initialization
  • Development utilities - Server folder cleanup and debugging aids for smooth workflow
  • Type safety - Fully Typed for a better development experience

Complete API Reference

Core Framework Methods

Registration

  • Framework:RegisterController(controller) - Register a client controller
  • Framework:RegisterService(service) - Register a server service

Lifecycle Management

  • Framework:Initialize() - Initialize all registered modules
  • Framework:Start() - Start all modules after initialization
  • Framework:Shutdown() - Clean shutdown with cleanup

Service Access

  • Framework:GetService(name) - Get a service (lazy loaded)
  • Framework:WaitForService(name, timeout?) - Wait for service with optional timeout
  • Framework:GetController(name) - Get a controller (lazy loaded)
  • Framework:WaitForController(name, timeout?) - Wait for controller with optional timeout

Utilities

  • Framework:GetMetrics() - Get performance metrics and timing data
  • Framework:IsServiceRegistered(name) - Check if service is registered
  • Framework:IsControllerRegistered(name) - Check if controller is registered
  • Framework:GetRegisteredServices() - Get list of all registered services
  • Framework:GetRegisteredControllers() - Get list of all registered controllers

Events & Signals

  • Framework:CreateSignal(name) - Create a new signal/event
  • Framework:GetSignal(name) - Get existing signal
  • Framework:FireSignal(name, ...args) - Fire a signal with arguments
  • Framework:ConnectToSignal(name, callback) - Connect to a signal

State Management

  • Framework:GetState() - Get current framework state
  • Framework:OnStateChanged(callback) - Listen for state changes

Service/Controller Structure

Required Properties

MyService.Name = "ServiceName" -- Required: Unique identifier

Optional Properties

MyService.Dependencies = {"Service1", "Service2"} -- Services this depends on
MyService.EnableDebug = true -- Enable debug logging for this service
MyService.Timeout = 30 -- Custom timeout for initialization

Lifecycle Methods

function MyService:Init()
    -- Initialize phase - dependencies available
end

function MyService:Start()
    -- Start phase - all services initialized
end

function MyService:Cleanup()
    -- Cleanup when framework shuts down
end

Framework Access

-- Access framework instance from within service
self.Framework:GetService("OtherService")

Configuration Options

CONFIG Table

CONFIG = {
    ENABLE_DEBUG = true, -- Enable debug logging
    KICK_ON_ERROR = true, -- Kick players on critical errors
    KICK_MESSAGE = "Framework loading error. Please rejoin the server.",
    CLEANUP_DELAY = 1, -- Seconds before cleanup on client
}

States

Framework States

  • "IDLE" - Framework not started
  • "INITIALIZING" - Currently initializing services
  • "STARTED" - All services started successfully
  • "RECOVERING" - Attempting error recovery
  • "SHUTTING_DOWN" - Framework shutting down

Events

Built-in Events

  • "ServiceAdded" - Fired when service is registered
  • "ControllerAdded" - Fired when controller is registered
  • "StateChanged" - Fired when framework state changes
  • "InitializeComplete" - Fired when initialization completes
  • "StartComplete" - Fired when start phase completes
  • "ShutdownComplete" - Fired when shutdown completes

Error Handling

Error Recovery

  • Automatic retry on service initialization failures
  • Graceful degradation when services fail
  • Optional player kick on critical client errors

Debug Information

  • Detailed timing metrics for each service
  • Memory usage tracking
  • Dependency resolution logs

(Yes, I used AI for the API reference, its 12am)
If anyone wants to contribute to this upcoming framework, please DM me!

Love you all!