{"id":28387512,"url":"https://github.com/rbxts-flamework/jecs","last_synced_at":"2025-06-26T20:31:44.833Z","repository":{"id":261277949,"uuid":"866773983","full_name":"rbxts-flamework/jecs","owner":"rbxts-flamework","description":"A jecs wrapper for Flamework. Takes advantage of Flamework macros and type ID system for increased ergonomics.","archived":false,"fork":false,"pushed_at":"2025-04-04T23:42:59.000Z","size":480,"stargazers_count":40,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-22T07:35:46.954Z","etag":null,"topics":["ecs","flamework","jecs","roblox"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rbxts-flamework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-02T21:08:33.000Z","updated_at":"2025-05-24T07:43:51.000Z","dependencies_parsed_at":"2024-11-23T05:29:37.974Z","dependency_job_id":null,"html_url":"https://github.com/rbxts-flamework/jecs","commit_stats":null,"previous_names":["rbxts-flamework/jecs"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rbxts-flamework/jecs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbxts-flamework%2Fjecs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbxts-flamework%2Fjecs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbxts-flamework%2Fjecs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbxts-flamework%2Fjecs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rbxts-flamework","download_url":"https://codeload.github.com/rbxts-flamework/jecs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbxts-flamework%2Fjecs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262139562,"owners_count":23265177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ecs","flamework","jecs","roblox"],"created_at":"2025-05-30T18:09:23.215Z","updated_at":"2025-06-26T20:31:44.780Z","avatar_url":"https://github.com/rbxts-flamework.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flamecs\n\nFlamework + ECS = Flamecs 🔥\n\n-   Blazingly Stupid\n-   Looking for VC funding\n-   Use types as components\n-   Zero-cost topologically aware functions\n-   Built-in Scheduler (soon)\n-   Component Metadata (soon)\n\n## Installation\n\nThis package is an extension of Flamework and it must be installed and configured. If Flamework is already installed, you can install `@rbxts/flamecs` and skip these steps.\n\n### Install Flamework packages\n\nYou can install all the necessary packages using the following command.\n\n```bash\nnpm install -D rbxts-transformer-flamework\nnpm install @flamework/core\n\n# Install flamecs, if it isn't already\nnpm install @rbxts/flamecs\n```\n\n### Configure the transformer\n\nThe Flamework transformer must be configured in your `tsconfig.json`. The fields should be placed inside of the `compilerOptions` object.\n\n```jsonc\n{\n\t\"compilerOptions\": {\n\t\t// Add `node_modules/@flamework` into your `typeRoots` field.\n\t\t\"typeRoots\": [\"node_modules/@rbxts\", \"node_modules/@flamework\"],\n\n\t\t// Copy the following fields\n\t\t\"experimentalDecorators\": true,\n\t\t\"plugins\": [\n\t\t\t{\n\t\t\t\t\"transform\": \"rbxts-transformer-flamework\",\n\t\t\t},\n\t\t],\n\t},\n}\n```\n\n### Configure your Rojo project\n\nFlamework uses a custom npm org and must be configured in your `default.project.json`.\n\nYou should find the entry for `node_modules` and modify it to include `@flamework`. It should look something like this:\n\n```json\n\"node_modules\": {\n\t\"@rbxts\": {\n\t\t\"$path\": \"node_modules/@rbxts\"\n\t},\n\t\"@flamework\": {\n\t\t\"$path\": \"node_modules/@flamework\"\n\t}\n}\n```\n\n### Recompile\n\nYou may need to delete the `out` folder and recompile for Flamework's transformer to begin working. Afterwards, you are ready to use flamecs.\n\n## Components\n\n```typescript\ninterface Position {\n\tx: number;\n\ty: number;\n}\n\n// Tag (no data)\ninterface Player extends Tag {}\n\n// Components can be wrapped to use non-table data\ninterface Name extends Wrap\u003cstring\u003e {}\ninterface Health extends Wrap\u003cnumber\u003e {}\n```\n\n## Entities\n\n### Spawning Entities\n\n```typescript\nconst entity = spawn();\n\n// When spawning with tags the bundle list can be omitted\nconst marcus = spawn\u003c[Player]\u003e();\n\nconst ketchup = spawn\u003c[Position, Player]\u003e([{ x: 0, y: 0 }]);\n\n// Get the runtime entity id from a component\nconst positionComponent = component\u003cPosition\u003e();\n```\n\n### Modifying Entities\n\n```typescript\nadd\u003cPlayer\u003e(entity);\n\nset\u003cPosition\u003e(entity, { x: 10, y: 20 });\nset\u003cName\u003e(entity, \"Alice\");\n\n// Insert can be used to add/set multiple components\ninsert\u003c[Name, Health, Player]\u003e(entity, [\"Bob\", 100]);\n\nremove\u003cPlayer\u003e(entity);\n\nif (has\u003cPlayer\u003e(entity)) {\n\t// ...\n}\n\nconst pos = get\u003cPosition\u003e(entity);\nconst name = get\u003cName\u003e(entity);\n\ndespawn(entity);\n```\n\n## Queries\n\n```typescript\nfor (const [entity, pos, name] of query\u003c[Position, Name]\u003e()) {\n\tprint(`${name} at ${pos.x}, ${pos.y}`);\n}\n\nfor (const [entity, pos] of query\u003c[Position, Without\u003cPlayer\u003e]\u003e()) {\n\t// ...\n}\n\nfor (const [entity, pos] of query\u003c[Position, With\u003c[Player, Health]\u003e]\u003e()) {\n\t// ...\n}\n```\n\n## Relationships\n\n### Defining Relationships\n\n```typescript\ninterface Likes extends Tag {}\ninterface Owns extends Wrap\u003cnumber\u003e {}\n\n// Alice likes Bob\nadd\u003cPair\u003cLikes\u003e\u003e(alice, bob);\n\n// Alice owns 5 items\nset\u003cPair\u003cOwns, Item\u003e\u003e(alice, 5);\n```\n\n### Querying Relationships\n\n```typescript\n// Query all entities that like something Pair\u003cLikes, Wildcard\u003e\nfor (const [entity] of query\u003c[Pair\u003cLikes\u003e]\u003e()) {\n\tconst target = target\u003cLikes\u003e(entity);\n\tprint(`${entity} likes ${target}`);\n}\n\n// Query specific relationships where the object is a runtime id\nfor (const [entity] of query().pair\u003cLikes\u003e(bob)) {\n\t// ...\n}\n```\n\n## Signals\n\n```typescript\nadded\u003cPosition\u003e().connect((entity) =\u003e {\n\tprint(`Position added to ${entity}`);\n});\n\nremoved\u003cPosition\u003e().connect((entity) =\u003e {\n\tprint(`Position removed from ${entity}`);\n});\n\nchanged\u003cPosition\u003e().connect((entity, newValue) =\u003e {\n\tprint(`Position of ${entity} changed to ${newValue}`);\n});\n```\n\n## Hooks and Systems\n\n```typescript\n// Hooks must be used within a `start()` function.\nstart({}, () =\u003e {\n\tif (useThrottle(0.5)) {\n\t\t// ...\n\t}\n\n\tfor (const [player] of useEvent(Players.PlayerAdded)) {\n\t\tconst entity = spawn\u003c[Name, Player]\u003e([player.Name]);\n\t\t// ...\n\t}\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbxts-flamework%2Fjecs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frbxts-flamework%2Fjecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbxts-flamework%2Fjecs/lists"}