Flux - Lite Framework

Flux Lite – A friendlier starting line for Roblox devs

I just pushed Flux Lite to GitHub, a tiny framework that keeps your code tidy without burying you under abstractions. It grew out of my own itch to build games faster while still teaching newer scripters why things work.

What it is

  • A feather-weight loader that auto-discovers “Services” on the server and “Controllers” on the client, then runs their Init and Start methods in the right order.
  • BridgeNet 2 under the hood, so remote events and functions come for free. You never touch RemoteEvent objects yourself.
  • Trove, Promise, and a simple Signal class re-exported in one place, ready whenever you need them.
  • Plain Luau. no custom syntax, no Rojo requirement (though it plays nicely with Rojo if you want).

Why you might care

  • New teammates learn the folder structure in minutes and can ship a working feature the same day.
  • Hot-swap a different networking lib later if you like. Services only talk through the Flux.BridgeNet helper, so nothing breaks.
  • Zero external dependencies apart from the tiny libs that ship inside the Libs folder.

Quick start

  1. Drop the Flux folder in ReplicatedStorage.
  2. Require Flux.Loader once on the server and once on the client.
  3. Create Server/Services/MyService.lua, give it a Name field, add your game logic.
  4. Create Client/Controllers/MyController.lua, grab the Bridge, and react to updates.

That is literally it.

Roadmap

  • ProfileService wrapper for painless data saves
  • CLI command flux g service <Name> that scaffolds the boilerplate for you
  • In-game debug overlay showing active bridges and frame timings

Call for contributors

If you love frameworks like Knit or Aero but wish they were easier to teach, clone the repo and open an issue. Test cases, docs PRs, and new examples are all welcome. Even a typo fix helps.

  • Coins Service:
--!strict
local Flux      = require(game.ReplicatedStorage.Flux.Core)
local BridgeNet = Flux.BridgeNet

-- Two bridges: one event, one function
local CoinsUpdated = BridgeNet.CreateBridge("CoinsUpdated")             -- RemoteEvent
local BuyItem      = BridgeNet.CreateBridge("BuyItem", "RemoteFunction")-- RemoteFunction

local CoinService = { Name = "CoinService" }

function CoinService:Init()
    self.Balance = {}            -- [player] = coins
    self.ItemCost = 10
end

function CoinService:Start()
    -- Handle BuyItem invokes from clients
    BuyItem:SetServerInvoke(function(plr)
        local bal = self.Balance[plr] or 0
        if bal < self.ItemCost then
            return false, "Not enough coins!"
        end
        self.Balance[plr] = bal - self.ItemCost
        CoinsUpdated:FireTo(plr, self.Balance[plr])
        return true, "Purchase successful!"
    end)

    -- Give everyone +1 coin / second
    game.Players.PlayerAdded:Connect(function(plr)
        self.Balance[plr] = 0
        CoinsUpdated:FireTo(plr, 0)
    end)

    game.Players.PlayerRemoving:Connect(function(plr)
        self.Balance[plr] = nil
    end)

    task.spawn(function()
        while true do
            task.wait(1)
            for plr, bal in pairs(self.Balance) do
                bal += 1
                self.Balance[plr] = bal
                CoinsUpdated:FireAll(bal)
            end
        end
    end)
end

return CoinService
  • Coins Controller:
--!strict
local Flux      = require(game.ReplicatedStorage.Flux.Core)
local BridgeNet = Flux.BridgeNet
local Trove     = Flux.Trove
local Players   = game:GetService("Players")

local CoinsUpdated = BridgeNet.CreateBridge("CoinsUpdated")  -- RemoteEvent proxy
local BuyItem      = BridgeNet.CreateBridge("BuyItem")       -- RemoteFunction proxy

local CoinController = { Name = "CoinController" }

function CoinController:Init()
    self._trove = Trove.new()
    self.Coins  = 0
end

function CoinController:Start()
    -- UI: simple floating TextLabel + TextButton
    local screenGui = Instance.new("ScreenGui", Players.LocalPlayer:WaitForChild("PlayerGui"))
    local label     = Instance.new("TextLabel", screenGui)
    label.Size = UDim2.fromOffset(200, 50)
    label.BackgroundTransparency = 1
    label.Position = UDim2.fromOffset(10, 10)
    label.TextScaled = true

    local button = Instance.new("TextButton", screenGui)
    button.Size = UDim2.fromOffset(200, 50)
    button.Position = UDim2.fromOffset(10, 70)
    button.Text = "Buy Item (10 🪙)"
    button.TextScaled = true

    -- Listen for coin updates
    self._trove:Connect(CoinsUpdated, function(newBal)
        self.Coins = newBal
        label.Text = "Coins: " .. newBal
    end)

    -- Handle button click
    self._trove:Connect(button.MouseButton1Click, function()
        local ok, msg = BuyItem:InvokeServer()
        print(ok and "[✓]" or "[×]", msg)
    end)
end

function CoinController:Destroy()
    self._trove:Destroy()
end

return CoinController

Flux - Lite Framework.rbxm (49.9 KB)
https://github.com/xvzy20166/Flux-Lite

7 Likes

Amazing resource! I like that its similar to knit.

I just want to let you know there is another resource also named Flux. Maybe consider using a different name?

3 Likes

Thank you so much for letting me know, i didnt know this :joy::sweat_smile: