RblxArch

Clean Architecture for Roblox Studio


Project maintained by lorizz Hosted on GitHub Pages — Theme by mattgraham

RblxArch — Clean Architecture for Roblox Studio

A structured, zero-boilerplate framework for Roblox games. Strict separation between server and client, reactive UI via the Cubit pattern, and dependency injection that makes your codebase actually maintainable.

Zero Boilerplate · Client/Server Split · Cubit Pattern · Dependency Injection · DataStore Abstraction


Why this architecture?

A default Roblox project grows into a mess of spaghetti Scripts and LocalScripts with RemoteEvents scattered everywhere. This framework gives you a single, consistent answer to every question about where code lives and how it communicates.

Problem Solution
game:GetService("Players").LocalPlayer everywhere Context.GetPlayer() — one line, anywhere
Services tightly coupled to DataStore Repository pattern — swap the data source, zero changes elsewhere
ViewModel + Controller boilerplate per feature Cubit — one class owns state and actions
RemoteEvents created all over the place NetBridge — all network in one place
No clear answer to “where does this code go?” Eight layers, each with a single defined responsibility

Data Flow

[Server]
  Repository  →  Service  →  Signal
                                └→  NetBridge.FireClient()

[Client]
  NetBridge.OnClient()  →  Cubit:method()  →  _emit(newState)
                                                    └→  OnStateChanged  →  View

Documentation

Page Description
Core Concepts The eight layers and their responsibilities
Folder Structure Where every file lives and why
Framework Files The five core files you copy once
Repository Abstracting the data source
Service Business logic layer
Server Controller Handling client requests
Cubit Client state + actions
View Pure UI rendering
Bootstrap Wiring everything together
Rules & Conventions Naming, structure, hard rules

Tutorial

Step Description
1 — Setup Project structure and framework files
2 — Types Defining PlayerData
3 — Repository Persisting data with DataStore
4 — Service Coins logic and player lifecycle
5 — Server Bootstrap Wiring the server
6 — Cubit Reactive coin state on the client
7 — View Binding the Cubit to the UI
8 — Client Bootstrap Wiring the client
9 — Result Running the game