Skip to content

Catwork 🐈

The cat framework, written by cats, for cats!

Catwork is a tiny, ergonomic, declarative framework for creating runtime code.

Download Catwork


Learn what Catwork has to offer!

Weave dependencies with asynchronous design patterns.

Catwork implements all of its code through Fragments! These allow you to manage dependencies in a simple and easy to understand way!

MeowService.lua
return Catwork.Fragment {
    Init = function(self)
        task.wait(1)
        self.Value = "cat"
    end,

    ConsumeValue = function(self)
        print(self.Value)
    end
}
local MeowService = require(script.MeowService)

MeowService:Await() -- waits for the service to initialise before grabbing the value

-- If we called this without awaiting, it'd print nothing, Catwork wraps messy
-- asynchronous design behind `Await` and `HandleAsync`
MeowService:ConsumeValue()

You build the framework!

Catwork exports an object called a Service, this lets you add almost any behaviour to Fragments beyond what Catwork originally allows.

RemoteService.lua
return Catwork.Service {
    Name = "RemoteService",

    Fragment = function(self, params)
        params.Remote = makeRemote(params)
        return Catwork:CreateFragmentForService(params, self)
    end,

    Spawning = function(self, f)
        if f.RemoteConnection then
            f.Remote.OnServer:Connect(f.RemoteConnection)
        end
    end
}
local MeowRemote = RemoteService:Fragment {
    Name = "MeowRemote",

    RemoteConnection = function(plr)
        print(`meows as {plr.Name} cutely`)
    end
}

Run Fragments, anywhere.

Catwork doesn't care about what you return, only that you call one of it's constructors.

This means as long as the code is executed, you can create a Fragment just about anywhere, a ModuleScript? A Script? Go for it!

LocalScript in ReplicatedFirst
local Catwork = require(ReplicaedFirst.Catwork)

local LoadingScreenManager = Catwork.Fragment {
    Name = "LoadingScreenManager",

    Init = function()
        ReplicatedFirst:RemoveDefaultLoadingScreen()
        -- code to execute guis or whatever
    end
}

Lets go on an adventure together

Ready to start with Catwork? Then lets go into the tutorials!