{"id":"paramacode/compose","name":"compose","scope":"paramacode","platform":"roblox","description":"A deterministic, scope-aware, capability-based composition core for Luau frameworks.","version":"0.1.1","latest":"0.1.1","versions":["0.1.1"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"9c916ccb6e7e4ce1df5501cbd81441ab84683f0084a9854729b465609cc114ee","likes":0,"downloads":0,"install":"forest install paramacode/compose","url":"https://forest.dev/p/roblox/paramacode/compose","files":"https://api.forest.dev/ai/package/roblox/paramacode/compose/files","readme":"# Compose\n\nA deterministic, scope-aware, capability-based composition core for Luau frameworks.\n\n`Compose` is **not a framework** and does not prescribe gameplay patterns, ECS, or architecture styles. It is a **low-level composition and dependency core** designed to be the stable foundation for multiple frameworks and large Roblox codebases.\n\nIt focuses on **explicit dependencies**, **runtime enforcement**, and **structural safety**, rather than convenience or magic.\n\n---\n\n## Why Compose exists\n\nMost Roblox projects fail architecturally for the same reasons:\n\n* Implicit dependencies\n* Global state access\n* Weak separation between Client / Server / Shared\n* No enforcement of module boundaries\n* Systems that work… until they scale\n\n`Compose` exists to solve these problems **once**, at the foundation level.\n\n---\n\n## Core principles\n\n### 1. Deterministic composition\n\n* Modules are composed in a known, explicit order\n* No auto-discovery\n* No hidden lifecycle hooks\n* No reflection or magic\n\nIf something runs, it is because you explicitly declared it.\n\n---\n\n### 2. Capability-based dependency access\n\nModules **cannot access dependencies implicitly**.\n\nEach module must declare:\n\n* What it depends on (`Requires`)\n* What scope it runs in (`Scope`)\n\nAt runtime, each module receives a **restricted context** that only allows access to its declared dependencies.\n\nAttempting to access anything else **fails immediately**.\n\n---\n\n### 3. Scope enforcement (Client / Server / Shared)\n\nDependencies and modules declare their scope explicitly:\n\n* `Client`\n* `Server`\n* `Shared`\n\nInvalid combinations are rejected during composition.\n\nThis prevents:\n\n* Client code accessing server-only systems\n* Accidental cross-boundary coupling\n* Silent security issues\n\n---\n\n### 4. No OOP required\n\n`Compose` is built around **functional composition**, not classes.\n\n* No inheritance\n* No base classes\n* No metatable hierarchies\n\nModules are plain tables with optional lifecycle functions.\n\n---\n\n## Basic example\n\n```lua\nlocal Compose = require(ReplicatedStorage.Compose)\n\nlocal LoggerToken = {}\n\nlocal application = Compose.Define({\n    Scope = 'Server',\n\n    Dependencies = {\n        [LoggerToken] = {\n            Scope = 'Shared',\n\n            Value = {\n                log = function(message)\n                    print(message)\n                end\n            }\n        }\n    },\n\n    Modules = {\n        {\n            Scope = 'Shared',\n            Requires = {LoggerToken},\n\n            Create = function(context)\n                local logger = context.Resolve(LoggerToken)\n\n                return {\n                    Initiate = function()\n                        logger.log('Hello from compose')\n                    end\n                }\n            end\n        }\n    }\n})\n\napplication.Initiate()\n```\n\n---\n\n## Lifecycle\n\nModules may optionally implement any of the following functions:\n\n* `Initiate()`\n* `Execute()`\n* `Terminate()`\n\nOnly the functions that exist are called.\n\nThere are no implicit defaults.\n\n---\n\n## What Compose deliberately does NOT do\n\n* ❌ Automatic module discovery\n* ❌ Global service locators\n* ❌ Reflection-based wiring\n* ❌ Silent dependency injection\n* ❌ Runtime guessing\n\nIf you want convenience over correctness, this is not the right tool.\n\n---\n\n## Intended audience\n\n`Compose` is designed primarily for:\n\n* Developers building **multiple internal frameworks**\n* Large or long-lived Roblox projects\n* Codebases where architectural drift is a real cost\n\nIt is opinionated by design.\n\n---\n\n## Status\n\n`Compose` is stable for internal framework use.\n\nThe API is intentionally small and unlikely to change frequently, but semantic versioning is respected.\n\n---\n\n## License\n\nMIT\n","readmeTruncated":false}