Introduction
Feature-based architecture for Roblox
Updated
You're reading the docs for Rogen v1
A bad folder structure slows you down. You spend your time remembering where the related pieces live, and then hunting for them.
The Problem: Layer-Based Architecture
Most Roblox projects split their code twice:
- By environment:
server,clientandsharedfolders at the root. - By type: inside those, a folder per technical role, like
Controllers,ServicesorUtils.
It looks tidy at first, but it doesn't scale. The folders keep growing and related files drift further apart, until changing the Inventory system means digging through three big trees just to collect its pieces.
- src
- client
- Controllers
- InventoryController.luau
- server
- Services
- InventoryService.luau
- shared
- Types
- InventoryTypes.luau
The cost: constant context switching. Working on one feature means wading through unrelated systems just to find the right server script.
The Solution: Feature-Based Architecture
Keep all the code for one feature (client, server and shared) together in a single folder, and let Rogen sort out the rest. It reads your folder and file names and sends every file to the Roblox service where it belongs.
- src
- Inventory
- client
- InventoryController.luau
- server
- InventoryService.luau
- shared
- InventoryTypes.luau
- ReplicatedStorage
- Inventory
- InventoryTypes
- ServerScriptService
- Inventory
- InventoryService
- StarterPlayer
- StarterPlayerScripts
- Inventory
- InventoryController
The result: your repository stays organized by feature, and Studio still gets every script in the right place.