{"id":22328131,"url":"https://github.com/rhidium/template","last_synced_at":"2025-07-29T18:31:16.953Z","repository":{"id":211141855,"uuid":"719696130","full_name":"rhidium/template","owner":"rhidium","description":"A TypeScript Discord bot template that fully utilizes the Rhidium framework.","archived":false,"fork":false,"pushed_at":"2024-06-09T18:18:18.000Z","size":817,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-06-10T19:22:35.242Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhidium.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-11-16T17:56:53.000Z","updated_at":"2024-06-09T18:18:21.000Z","dependencies_parsed_at":"2023-12-06T18:46:26.550Z","dependency_job_id":"bdc743a2-8718-4561-8c56-bd6d27f3c512","html_url":"https://github.com/rhidium/template","commit_stats":null,"previous_names":["rhidium/template"],"tags_count":3,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhidium%2Ftemplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhidium%2Ftemplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhidium%2Ftemplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhidium%2Ftemplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhidium","download_url":"https://codeload.github.com/rhidium/template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228034977,"owners_count":17859245,"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":[],"created_at":"2024-12-04T03:11:41.912Z","updated_at":"2025-07-29T18:31:16.921Z","avatar_url":"https://github.com/rhidium.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://rhidium.xyz\"\u003e\u003cimg src=\"https://github.com/rhidium/core/assets/57721238/e6d25fa1-07cb-4284-a02a-f73fe7ef3878\" width=\"100\" alt=\"logo\" /\u003e\u003c/a\u003e\n\n  ![Font_PNG](https://github.com/rhidium/core/assets/57721238/9ccc5763-8336-4d1e-8187-a738bafdc519)\n\n  \u003cp\u003e\n    \u003ca href=\"https://discord.gg/mirasaki\"\u003e\u003cimg src=\"https://img.shields.io/discord/793894728847720468?color=5865F2\u0026logo=discord\u0026logoColor=white\" alt=\"Discord server\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@rhidium/core\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@rhidium/core.svg?maxAge=3600\" alt=\"npm version\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@rhidium/core\"\u003e\u003cimg src=\"https://img.shields.io/npm/dt/@rhidium/core.svg?maxAge=3600\" alt=\"npm downloads\" /\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/rhidium/core\"\u003eCore\u003c/a\u003e\n    •\n    \u003ca href=\"https://github.com/rhidium/template\"\u003eTemplate\u003c/a\u003e\n    •\n    \u003ca href=\"https://github.com/rhidium/json-editor\"\u003eJSON Editor\u003c/a\u003e\n    •\n    \u003ca href=\"https://github.com/rhidium/core\"\u003ePlaceholder\u003c/a\u003e\n  \u003c/p\u003e\n\n  [THIS REPOSITORY HAS BEEN MOVED](https://github.com/rhidium/rhidium) | [THIS REPOSITORY HAS BEEN MOVED](https://github.com/rhidium/rhidium) | [THIS REPOSITORY HAS BEEN MOVED](https://github.com/rhidium/rhidium) | [THIS REPOSITORY HAS BEEN MOVED](https://github.com/rhidium/rhidium) | [THIS REPOSITORY HAS BEEN MOVED](https://github.com/rhidium/rhidium) | [THIS     REPOSITORY HAS BEEN MOVED](https://github.com/rhidium/rhidium) | [THIS REPOSITORY HAS BEEN MOVED](https://github.com/rhidium/rhidium)\n  \n\u003c/div\u003e\n\n# @rhidium/template\n\nThis is a Discord bot template that fully utilizes the [rhidium framework](https://rhidium.xyz). From essential system related commands to detailed command usage/statistics and re-usable embed and placeholder integrations - this template aims to provide everything you need to develop powerful, scalable Discord bots fast and efficiently.\n\n\u003e With Rhidium, you can focus on what's really important: **Creating meaningful features**\n\nExcited to begin? [Get started](#-installation) or try [the demo](#-support)!\n\n## 🤩 Features (non-exhaustive)\n\nWe've compromised a list of some of the core functionality provided by Rhidium:\n\n- Powerful, dynamic [middleware](https://rhidium.xyz/classes/Middleware.CommandMiddleware.html) system\n- Type-safe, re-usable [controllers](https://rhidium.xyz/modules/Commands.Controllers.html)\n- Dynamic [Component](https://rhidium.xyz/modules/Commands.html) Handlers/File-Loaders\n- Synchronized local \u0026 API commands, automatic refreshes\n- Fully localized (through [i18next](https://www.npmjs.com/package/i18next)), convenience localization for commands\n- Colorful console logging \u0026 verbose, organized file logging\n- Wide range of everyday utilities and functionality\n- [CRON](https://crontab.guru/) and interval-based jobs\n\n### Developer Friendly\n\nThis template focuses on simplicity and robustness for developers. The primary example of this is that components are resolved from directories, not extended from a class and imported elsewhere - as commonly seen across other templates. It's our mission to get you started on your project fast, so you can focus on the important things: implementing meaningful features.\n\n- Check out the [API Reference](https://rhidium.xyz/)\n- Made with [TypeScript](https://www.typescriptlang.org/) and [discord.js](https://discord.js.org/)\n- [PM2](https://pm2.io/), [Docker](https://www.docker.com/), [docker compose](https://docs.docker.com/compose/) configurations provided\n\n### Functionality\n\n- Detailed command usage statistics and metrics\n- User configurable embed utilities, easily extendable to new functionality\n- Dynamic placeholder structure, easily extendable to new data\n- Discord logging for errors, guild join/leave etc.\n- Administrator and Moderator permission level roles and channels\n- Member Join messages, uses both Embed and Placeholder functionality as a complete integration\n- User information, and developer utility commands\n- And so much more...\n\n### Scaling\n\nThis template grows with you and your bot. Opt-in to sharding \u0026 clustering (`x` shards for `n` processes) as you reach new milestones, all functionality included is sharding + clustering friendly by design.\n\n- Supports [sharding](https://discordjs.guide/sharding), which is required when your bot reaches 2500+ servers\n- Supports [clustering](https://www.npmjs.com/package/discord-hybrid-sharding), which allows you to seamlessly run your bot over multiple processes\n\n### RESTful API (coming soon)\n\nThis template comes with a REST API (OpenAPI spec 3.0.0). By default, this only serves the client's command data, which can be used to easily fetch your command data and build a dynamic command table/overview on your project's website. You can easily extend, and build upon this API yourself. Visit the `api` section in the `/config/config.json` file to get started.\n\n## 💽 Database\n\nThis TypeScript project uses [Prisma](https://www.prisma.io/docs/getting-started/quickstart) TypeORM with `postgresql` adapter.\n\nAvailable adapters: `cockroachdb`, `mongodb`, `postgresql`\n\n- If you make changes to the schema, use the `prisma db push` command to push the new schema state to the database.\n- If you want to use an existing database (pull the schema from existing database), use the `prisma db pull` command.\n- Use `prisma migrate dev` to create migrations, apply them to the database, and generate artifacts (e.g. Prisma Client)\n- When using CockroachDB, the `autoincrement()` default function is defined only on BigInt fields. Change `autoincrement()` to `sequence()` if you want an autoincrementing Int field.\n\n### Mongo\n\nThe MongoDB adapter can be chosen to minimize required setup for this project. Converting to Mongo adapters should (mostly) only include adding `_id` `@map`'ing and adding `@db.ObjectId` for `@id`'s (an up-to-date [mongo schema file](./prisma/schema.mongo.prisma) is included for your convenience). Do note, Prisma migrations aren't supported for the MongoDB adapter.\n\n## 🛠️ Installation\n\nPlease note, a [Discord Application](https://wiki.mirasaki.dev/docs/discord-create-application#go-to-discord-developer-portal) is required for both installation methods.\n\n### 📦 Run as a Docker container (preferred)\n\nThe quickest, and easiest, way to host/use this bot template is by deploying it inside of a [Docker](https://www.docker.com/) container. We recommend [Docker Desktop](https://www.docker.com/products/docker-desktop/).\n\n1. Download the [latest release](\u003chttps://github.com/rhidium/template/releases`\u003e) or `git clone git@github.com:rhidium/template.git` the repo\n2. Run `pnpm setup:linux` or `pnpm setup:windows` (depending on your OS) in the project root folder\n3. Edit the newly created `.env` and `/config/config.json` files and provide your configuration\n4. Start the application: `docker compose up`\n\n### 🖥️ Run as a plain NodeJS app\n\n- Install the additional pre-requisites:\n  - [Node.js](https://nodejs.org/en/) v16.6.0 or newer\n  - [PostgreSQL](https://www.postgresql.org/) v13 or newer\n- Download the [latest release](\u003chttps://github.com/rhidium/template/releases`\u003e) or `git clone git@github.com:rhidium/template.git` the repo\n- Run `pnpm setup:linux` or `pnpm setup:windows` in the project root folder\n- Edit the newly created `/config/config.json` file and provide your configuration\n  - Alternatively, use `pnpm setup:config` if you prefer a web-based editor\n  - Hit `ctrl+c` to stop the application once you've clicked \"Save\"\n- Edit the newly created `.env` file and provide your environmental values\n- Start the application: `pnpm start`\n\n## ⚙️ Configuration\n\nThe full configuration for this project can be found [here](./config/config.example.json), and is validated through a JSON schema file that is automatically kept up-to-date. There's quite a bit of options to explore, which is why we've included a web-based editor to keep things simple.\n\n- `pnpm config-editor` - starts the configuration editor, edit [the script](./scripts/config-editor.mjs) if needed\n- `pnpm update-schema` - generate a new JSON Schema, `config-editor` automatically does this\n- `pnpm generate-schema` - CLI alternative to `update-schema`, included for completeness\n\n\u003e Using the editor is by no means necessary, and only serves to make the large amount of configuration a bit more digestible to new users.\n\n### dotenv\n\nThe `.env` file holds your secrets and other environmental values. Let's explain the different keys here:\n\n```bash\n# The node environment your bot is running in\n# Available values: production, development\nNODE_ENV=production\n\n# The database URL Prisma uses to connect to your database.\nDATABASE_URL=\"postgresql://\u003cusername\u003e:\u003cpassword\u003e@\u003chost\u003e/\u003cdatabase\u003e\"\n\n# Docker Compose uses the following environment variables to configure the database connection.\nDATABASE_PASSWORD=\"\u003cpassword\u003e\"\n```\n\n## 🧩 Component Handlers\n\nJust a quick note on the component/command handler the underlying [@rhidium/core](https://rhidium.xyz/) implements - you don't **have** to use the built-in handlers. You can use the following (vanilla `discord.js`) code to achieve the same, but within an existing component (instead of having to create a new one) - which is useful for small commands/components.\n\n\u003e ⚠️ You can use `@` at the start of any `componentId`/`customId` to omit the built-in handlers. Alternatively, you can use the `suppress_unknown_interaction_warnings` configuration option.\n\nIn any scope with a valid interaction context:\n\n```ts\nimport { ComponentType } = from 'discord.js';\nimport { UnitConstants } from '@rhidium/core';\n\n// Fetching the message attached to the received interaction\nconst interactionMessage = await interaction.fetchReply();\n\n// Button reply/input collector\nconst collector = interactionMessage.createMessageComponentCollector({\n  filter: (i) =\u003e (\n    i.customId === '@customId' || i.customId === '@customIdTwo'\n  ) \u0026\u0026 i.user.id === interaction.user.id,\n  componentType: ComponentType.Button,\n  time: UnitConstants.MS_IN_ONE_HOUR,\n});\n\n// And finally, running code when it collects an interaction (defined as \"i\" in this callback)\ncollector.on('collect', (i) =\u003e { /* The callback to run */ });\n```\n\n### Dynamic Components\n\nYou can create **dynamic** components by using multiple `@`'s in the `componentId/customId` property. For example, an id of `@close-ticket@12` will make the component handler look for a component with a `customId` of `close-ticket`. This allows for dynamic component ids, allowing you to effectively \"store\" data or other references in the components `customId`.\n\n### Reserved filenames\n\nDue to the dynamic nature of the project structure/architecture, some (file) names are reserved **when using a directory to organize your command/component**. \"Reserved\" here means that commands/components won't be loaded from files named either of the following:\n\n`components`, `options`, `types`, `helpers`, `controllers`, `services`, `transformers`, and `enums`.\n\nCheck out [the `/embeds` command structure](./src/chat-input/Administrator/embeds) for an example of what this looks like in action.\n\n## ⌨️ Scripts\n\nWe've also included some example scripts to get you started with your favorite runtime:\n\n\u003e Please note, you should run these from the **directory root**\n\n### [PM2](https://pm2.io/)\n\n```bash\npm2 start\npm2 stop\npm2 restart\npm2 reset\npm2 delete\n```\n\n### [Docker](https://www.docker.com/)\n\n```bash\n# Build\ndocker build --tag rhidium-template .\n# Start\ndocker run -it -p 9000:9000 --env-file .env -d --name my-discord-bot rhidium-template\n# Logs\ndocker logs my-discord-bot -f\n# Stop\ndocker stop my-discord-bot\n# Restart\ndocker restart my-discord-bot\n# Kill\ndocker rm -f my-discord-bot\n# Purge\ndocker rm -fv my-discord-bot\n# Shell\ndocker run -it --rm my-discord-bot sh\n```\n\n## 🙋 Support\n\nJoin our [support server](https://discord.gg/mirasaki) if you have any questions, feature requests or other feedback:\n\n[![banner](https://invidget.switchblade.xyz/mirasaki)](https://discord.gg/mirasaki)\n\n\u003e Open-source and ISC licensed, meaning you're in full control.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhidium%2Ftemplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhidium%2Ftemplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhidium%2Ftemplate/lists"}