{"id":26672121,"url":"https://github.com/lacunahub/letsfrag","last_synced_at":"2026-04-10T16:46:08.475Z","repository":{"id":229319068,"uuid":"770727208","full_name":"LacunaHub/letsfrag","owner":"LacunaHub","description":"Scale your Discord bot across multiple machines.","archived":false,"fork":false,"pushed_at":"2024-09-17T10:48:00.000Z","size":500,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-09-18T02:58:22.493Z","etag":null,"topics":["bot","discord","discord-js","shard","sharding"],"latest_commit_sha":null,"homepage":"https://lacunahub.github.io/letsfrag/","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/LacunaHub.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-03-12T03:41:05.000Z","updated_at":"2024-09-17T10:47:30.000Z","dependencies_parsed_at":"2024-04-13T09:50:04.004Z","dependency_job_id":"b609a238-6c90-469b-9e0c-d443970aa2e8","html_url":"https://github.com/LacunaHub/letsfrag","commit_stats":null,"previous_names":["lacunahub/letsfrag"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LacunaHub%2Fletsfrag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LacunaHub%2Fletsfrag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LacunaHub%2Fletsfrag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LacunaHub%2Fletsfrag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LacunaHub","download_url":"https://codeload.github.com/LacunaHub/letsfrag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245568581,"owners_count":20636803,"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":["bot","discord","discord-js","shard","sharding"],"created_at":"2025-03-26T00:48:24.833Z","updated_at":"2026-04-10T16:46:08.418Z","avatar_url":"https://github.com/LacunaHub.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\n\nThis package is inspired by [discord-hybrid-sharding](https://github.com/meister03/discord-hybrid-sharding) and allows you to scale your Discord bot across multiple hosts/machines.\n\n# Links\n\n-   [Documentation](https://lacunahub.github.io/letsfrag)\n\n# Installation\n\nIn the same directory as your `package.json` file, create or edit an `.npmrc` file:\n\n```\n@lacunahub:registry=https://npm.pkg.github.com/\n```\n\nThen run:\n\n```bash\nnpm install @lacunahub/letsfrag\n```\n\n_Developed and tested on Node.js v18_\n\n# Usage\n\n## File structure\n\n```\n├── src\n│   ├── client.ts\n│   ├── cluster.ts\n│   └── server.ts\n└── package.json\n```\n\n`src/server.ts`\n\n```ts\nimport { Server } from '@lacunahub/letsfrag'\n\nconst server = new Server({\n    port: 5565,\n    authorization: 'authorization_token',\n    hostCount: 2,\n    shardCount: 10,\n    botToken: 'bot_token'\n})\n\nserver.on('connect', client =\u003e console.info(`Client \"${client.id}\" connected`))\nserver.on('disconnect', client =\u003e console.warn(`Client \"${client.id}\" disconnected`))\nserver.on('error', err =\u003e console.error(err))\nserver.on('ready', url =\u003e console.info(`Server is ready on url ${url}`))\n\nserver.initialize()\n```\n\n`src/cluster.ts`\n\n```ts\nimport { ClusterManager } from '@lacunahub/letsfrag'\n\nconst clusterManager = new ClusterManager(`${__dirname}/Client.js`, {\n    server: {\n        host: 'localhost',\n        port: 5565,\n        authorization: 'authorization_token',\n        type: 'bot',\n        reconnect: true,\n        retries: 10\n    },\n    mode: 'fork',\n    spawnDelay: 10_000\n})\n\nclusterManager.on('clusterCreate', cluster =\u003e console.info(`Cluster #${cluster.id} has been created`))\nclusterManager.on('ready', manager =\u003e console.info(`Manager with clusters (${manager.clusters}) is ready`))\n\nclusterManager.spawn()\n```\n\n`src/client.ts`\n\n```ts\nimport { ClusterShardClient } from '@lacunahub/letsfrag'\nimport { GatewayIntentBits } from 'discord.js'\n\nconst client = new ClusterShardClient({\n    intents: [GatewayIntentBits.Guilds]\n})\n\nclient.login()\n```\n\n_**Note**: The server must be started before `ClusterManager` is initialized._\n\n### Rate limit sync\n\nYou can enable rate limit sync between shards/hosts by setting the `store` option in the `rest` object:\n\n`src/client.ts`\n\n```ts\nimport { ClusterShardClient } from '@lacunahub/letsfrag'\nimport { GatewayIntentBits } from 'discord.js'\n\nconst client = new ClusterShardClient({\n    intents: [GatewayIntentBits.Guilds],\n    rest: {\n        store: 'redis://user:pass@127.0.0.1:6379'\n    }\n})\n\nclient.login()\n```\n\nSee [Keyv](https://www.npmjs.com/package/keyv?activeTab=readme#usage) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flacunahub%2Fletsfrag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flacunahub%2Fletsfrag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flacunahub%2Fletsfrag/lists"}