Rogen | Organize by Feature | Client and Server Scripts in One Folder

Rogen

A Rojo superset that keeps each feature’s server and client code in one folder.


Rogen generates the Rojo project file from your file system, and sends each file to the right place in Studio.

Documentation GitHub Discord


Why Rogen?

  • Organize by feature: Group all code, UI, and assets for a specific feature in one place. This gives you high cohesion, better scalability, fewer merge conflicts, and features that are simple to maintain or delete.

  • Enforce boundaries: Keep coupling low with a linter. Every path names its feature, so a lint rule can stop one feature from requiring another.

  • Multi-place games: Write shared code once and use it in every place. When one place needs something different, add a file with the same name to that place’s folder, and it overwrites the shared one there.

  • Still Rojo: Rogen runs the Rojo commands you use, with the same flags. One tool, and nothing to relearn.


Built for Agents

When an agent works on a feature, everything it needs is in one folder, from server to client. It spends its context on your task instead of searching the codebase.

Running several agents? Give each one a feature. A lint rule catches any agent that makes one feature require another, and there’s no shared project file to conflict on.


What Top Developers Are Saying

“It has been a game changer for my team and I”
— Acecateer, Technical Director at Wonder Works Studio

“Spent the last couple days refactoring Lua Learning to use Rogen. I love it”
— Zack (boatbomber) Williams, CEO at Torpedo Software


How it works

default.rogen.json is a Rojo project file with routes. Its tree holds what folder names can’t say, such as your packages:

{
  "name": "my-game",
  "routes": {
    "Server": "ServerScriptService",
    "Client": "StarterPlayer/StarterPlayerScripts",
    "Shared": "ReplicatedStorage/Shared",
    "*": "ReplicatedStorage/Shared"
  },
  "tree": {
    "$className": "DataModel",
    "ReplicatedStorage": {
      "Packages": { "$path": "Packages" }
    }
  }
}

A file goes where its folder or @ suffix says: Server/ and @Server both mean ServerScriptService. Everything else goes to *, and a route you add, such as "Gui": "StarterGui", works the same way.


Installation

rokit add ldgerrits/rogen@2.0.0-beta.2
rogen init

rogen init pins Rojo in rokit.toml and tells you to run rokit install to fetch it. New to Rojo? Also run rogen plugin install to add its Studio plugin. Prefer npm? Run npm i @ldgerrits/rogen@next and use npx rogen.


Usage

rogen serve                # Serve with Rojo and update the project file on changes
rogen build -o game.rbxl   # Update the project file, then build a place with Rojo
rogen check                # Print warnings and errors, and exit 1 on any

sourcemap, upload, syncback and plugin take Rojo’s flags too. See the command reference for every command.

For every command and full configuration instructions, head over to the documentation:
:backhand_index_pointing_right: rogen-roblox.vercel.app


FAQ

Does Rogen replace Rojo?
Yes and no. You run rogen instead of rojo, but Rojo still does the syncing and building underneath. Its Studio plugin stays installed too.

Does Rogen work with Argon?
Yes, for syncing your files into Studio. Run rogen write --watch and serve with Argon. To bring Studio changes back, save the place and run rogen syncback --input game.rbxl. With Rojo, it’s one command: rogen serve keeps the project file current and serves it.

Can I use Rogen in an existing Rojo project?
Yes. Run rogen init to move it to Rogen. See Coming from Rojo.


Contributing

Read the contributing guide before you open a pull request. You can also star the repo or sponsor its development.

Rogen is MIT licensed.

19 Likes

I have just released a small patch to fix an issue related to .d.ts files. I also made it easier to configure settings.

1 Like

It is now compatible for both roblox-ts AND luau! Anyone can use this now!

1 Like

works with bootstrapper?

Resumen

Este texto estará oculto

1 Like

Yes, anything works with it!

It automatically updates your ‘default.project.json’ to faciltate this project structure. That’s all there is to it!

2 Likes

I just released a small patch. It fixed an issue where the internal pruning was too aggressive after an update I made yesterday. If you had a folder without an index.ts / init.luau, then it may not have always generated all the paths that were actually needed. Now, everything works like it should!

1 Like

The tool now also supports .rbxm and .rbxmx files!

1 Like

Rogen - The ‘More Than Just a New Name’ Update

Yesterday’s discussion on Discord led me to overhaul much of the tool. It also led me to rename the tool to Rogen (an abbreviation of Rojo Generator).

Additions

  • Config File Support: You can now create a .rogen.json file that will be automatically detected by Rogen. It has the following structure:
{
    "sourceDir": "src",
    "luau": { 
        "outFile": "default.project.json", 
        "outDir": "src", 
        "wrapper": false 
    },
    "ts": { 
        "outFile": "default.project.json", 
        "outDir": "out", 
        "wrapper": "TS" 
    },
    "darklua": { 
        "outFile": "build.project.json", 
        "outDir": "dist" 
        "wrapper": false
    },
    "project": {
        "name": "roblox-project",
        "globIgnorePaths": [
            "**/package.json",
            "**/tsconfig.json"
        ],
        "tree": {}
    }
}
  • Darklua Support: Added darklua as additional mode.
  • CLI Optional Arguments:
    • -c, --config : Specify a custom config file path.
    • -m, --mode : Specify the mode to run (luau, ts, or darklua). If omitted, Rogen automatically detects your project type (via tsconfig.json or .darklua.json) and runs the appropriate mode(s).
    • -p, --project : Specify a path to a JSON file that contains a Rojo project. If omitted, Rogen will use the project specified in “project” in the .rogen.json file.
  • .rbxm and .rbxmx Support: Rogen will now create paths for these file name extensions.

Removals

  • appendSuffix: This optional setting only led to confusion and inconsistent behavior when set to true (default was set to false to begin with). It was just not worth keeping around.
1 Like

Rogen - emitLegacyScripts Rework

This is a big update that hopes to solve all remaining issues. It changes the config files, but, more importantly, also affects the generated paths. When you update to this new version (which is recommended), you may need to update your imports.

Fixes

  • emitLegacyScripts: When emitLegacyScript is set to false, client scripts had to be routed to ReplicatedStorage. However, if we merged the shared and client code under one directory, it could cause name collisions. To prevent this and to make the behavior consistent, code will now always be wrapped in a ‘client’, ‘shared’ or ‘server’ folder depending on the context.

Changes (Breaking)

  • Roblox Paths: The fix for emitLegacyScripts means that many paths have changed a tiny bit (by having a wrapper folder). This also goes for client containers like ReplicatedFirst which will now have a client folder if you ever route code to that container.
  • **New and Replaced CLI Args and .rogen.json: ** These new args also correspond to new names in the config.
    • -c, --config : Specify a custom Rogen config file path.
    • -m, --mode : Specify the mode to run (luau, ts, or darklua). If omitted, Rogen automatically detects your project configuration (via tsconfig.json or .darklua.json) and runs the appropriate target(s).
    • -s, --source : Override the directory containing your raw, uncompiled code.
    • -t, --template : Specify a path to a JSON file that contains your base Rojo blueprint. If omitted, Rogen defaults to the inline object or file mapped in your .rogen.json.
    • -b, --build : Override the directory where your compiled/transpiled code lands.
    • -o, --output : Override the name and destination of the final generated Rojo .project.json file.

Removals

  • Wrapper Setting: Since scripts always have a wrapper folder, this became useless.

Documentation | Github

3 Likes

Rogen 1.0.1 - Toolchain Manager Release!

Additions

  • Rokit, Foreman and Aftman Support: Simply run rokit add ldgerrits/rogen or add this to your rokit.toml (or equivalent):
[tools]
rogen = "ldgerrits/rogen@1.0.1"
  • -w, --watch: Rogen now supports a built-in watch mode. There’s no need anymore for the chokidar-cli dependency! All you need to do is run rogen -w.

Improvements

  • Roblox-ts Stability: Rogen now employs several strategies in order to work more nicely alongside the roblox-ts compiler.
1 Like

Rogen 1.0.2 - Roblox-ts and Darklua Patch

roblox-ts requires a valid default.project.json path to resolve imports, but it won’t generate the code in out until it successfully resolves those imports. By creating empty files, Rogen tricks Rojo and roblox-ts into seeing a valid environment, allowing roblox-ts to compile and immediately overwrite the empty files with actual code.

Fixes

  • Compiler Rojo Data Errors: Resolves the compiler error Could not find Rojo data. There is no $path in your Rojo config that covers out\... which occurred because files were pruned before roblox-ts (and possibly Darklua as well) had a chance to compile them. Instead of deleting missing paths from the Rojo project file, Rogen now creates empty placeholder .luau/.lua scripts in your build directory.
1 Like

Rogen 1.1.0 - Stability

Improvements

  • Internal Refactor: Split the original monolithic script into smaller modules.

Additions

  • Jest Test Suites: Added test coverage to improve stability of Rogen

Fixes

  • Fallback Config: Fix error where json parse returned undefined for the fallback config
  • Typo in Build Arg: Changed the “d” to “b” as alternative shorter version of “build” arg

Rogen 1.1.1 - QoL Update

Additions

  • rogen --init: Generate a default .rogen.json config file when doing rogen --init or rogen --i.
  • “keepSuffixes” Property and --k: A boolean flag (defaults to false). When set to true, Rogen will preserve your routing suffixes in the script names instead of stripping them out. You can also use the command rogen --k.
  • “aliases” Property: If you want to map specific suffixes or folder to a particular service, use the aliases field in the config. You can configure it like this:
"aliases": {
    "Controller": "ReplicatedStorage",
    "Service": "ServerScriptService"
}
1 Like

Rogen 1.2.0 - Multi-Source Update

Rogen now supports codebases that contain multiple directories, allowing you to merge them into a single Rojo project. This is useful for multi-place games where you want to share a core across different places.

  • Clean Merging: If src/core and src/hub both contain a shared folder, Rogen will merge the contents of both into a single ReplicatedStorage.shared folder. No duplicates are created.
  • Overrides: The order of your sources matters. If both directories contain a file with the exact same name and routing path, the directory listed last will overwrite the former.

Changes

  • source (.rogen.json): The root directory (String) or directories (Array of Strings) where your source code lives (defaults to “src”). Passing an array allows you to merge multiple source folders into a single tree.
  • –source, -s (CLI): Override the directory containing your code. Can be passed multiple times (e.g., -s src/core -s src/hub) to merge multiple directories.

Rogen 1.2.1 - Quick Patch

Fixes

  • –watch, -w (CLI): Solved an issue introduced in the last update where using the --watch command would result in an error.
1 Like

Rogen 1.2.2 - Linux Fix

Fixes

  • Linux Build Failed: Replaced fs.watch with chokidar to fix error experienced only on Linux.

Improvements

  • Custom Mode Config Errors: Added error messages when missing the "output" or "build" fields.

Rogen 1.3.0 - Routing Update

This release introduces a few QoL updates that makes Rogen more flexible and powerful.

Additions

  • New Routing Strategy: Marker File: You can now place marker files (e.g., an empty file named .server, .client, .shared, or of a custom alias) inside any directory to explicitly set its target service. Previously, relying purely on folder names (like src/server/) meant those names were consumed and stripped from the final Roblox tree. Now, by using a marker file (like src/AntiCheat/.server), Rogen changes the folder’s destination but preserves your folder’s exact name.
  • Add Prefix Routing: In addition to suffix routing, you can now route files with prefixes (e.g. serverData.ts, client-input.luau).

Improvements

  • Nested Routing Logic: Rogen now handles routing conflicts in an easier and more understandable way. When multiple routes apply to the same file, Rogen follows a simple principle: the most specific route wins. An explicit rule placed directly on a file will always override a general rule set by its parent folder.

Changes (BREAKING)

  • keepRouteNames in .rogen.json: To facilitate prefix routing, keepSuffixes was no longer an accurate name, as routing keywords can now appear at the beginning of the file name as well. Please, update your configuration file to use keepRouteNames instead.

Rogen 1.3.1 - TypeScript Migration

This is purely an internal codebase update. Rogen functions exactly the same as before.

Improvements (Internal)

  • TypeScript Rewrite: Converted Rogen from JavaScript to TypeScript. It is now fully typed to make future development and contributions easier.

How do I turn this, into that? Everytime I add a new file, I have to reconnect rojo, so that it gets added into studio.

Is Rojo crashing for you? If so, that shouldn’t be happening at all.

When you add a file, Rogen (when watching) will automatically update the default.project.json, and Rojo will sync it to Roblox (when serving). What you are experiencing has never been reported before, so I think it may be going wrong with your specific setup. Is there anything you changed in your .rogen.json file? Could you show me your .rogen.json file?

I don’t quite understand why you’d want to “turn this into that”. Rogen generates creates individual paths for each file, so it’s expected behavior. That’s what enables it to be so powerful, so you generally don’t want to stop that.

However, one way that you can just sync an entire folder (this stops any routing inside the folder), is to add an init.luau file at the root of that folder. However, this is more of a limitation on Rojo’s part – I wouldn’t rely on this because there’s an outstanding PR that will fix this in Rojo. When that day comes, this specific behavior will be patched out of Rogen.

The best way, if you just want to sync a folder and not individual files, is to add the folder to the tree in the template field of the .rogen.json. This is how we’re syncing the Wally Packages folder as well.