{"id":47851979,"url":"https://github.com/devroots-studio/discord.js-nest.js-template","last_synced_at":"2026-04-03T22:03:33.245Z","repository":{"id":343376755,"uuid":"1177295717","full_name":"DevRoots-Studio/Discord.js-Nest.js-Template","owner":"DevRoots-Studio","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-10T03:31:10.000Z","size":92,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-10T11:24:46.806Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DevRoots-Studio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-09T22:25:11.000Z","updated_at":"2026-03-10T03:31:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/DevRoots-Studio/Discord.js-Nest.js-Template","commit_stats":null,"previous_names":["devroots-studio/discord.js-nest.js-template"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/DevRoots-Studio/Discord.js-Nest.js-Template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevRoots-Studio%2FDiscord.js-Nest.js-Template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevRoots-Studio%2FDiscord.js-Nest.js-Template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevRoots-Studio%2FDiscord.js-Nest.js-Template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevRoots-Studio%2FDiscord.js-Nest.js-Template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevRoots-Studio","download_url":"https://codeload.github.com/DevRoots-Studio/Discord.js-Nest.js-Template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevRoots-Studio%2FDiscord.js-Nest.js-Template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31379453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T21:40:47.592Z","status":"ssl_error","status_checked_at":"2026-04-03T21:40:05.436Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-04-03T22:03:32.052Z","updated_at":"2026-04-03T22:03:33.232Z","avatar_url":"https://github.com/DevRoots-Studio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Discord Bot + NestJS Backend (Monorepo)\n\nMonorepo with a **Discord bot** and **NestJS API** sharing a **Prisma** database and connected via an **HTTP bridge**. Full TypeScript, single-command build, and Docker support.\n\n## Structure\n\n- **`apps/discord-bot`** – Discord.js bot (CommandKit, Prisma, bridge server for API → bot, optional API client for bot → API)\n- **`apps/api`** – NestJS backend (Prisma, health, Discord bridge client, events endpoint)\n- **`packages/database`** – Shared Prisma schema and client (PostgreSQL)\n\n## Setup\n\n1. **Install and generate Prisma client**\n\n   ```bash\n   npm install\n   npm run build:db\n   ```\n\n2. **Environment**\n\n   Copy `.env.example` to `.env` and set:\n   - `DATABASE_URL` – PostgreSQL connection string\n   - `BOT_TOKEN` – Discord bot token\n   - `BRIDGE_SECRET` – Shared secret for API ↔ bot bridge (optional but recommended)\n   - `PORT` – API port (default 3000)\n   - `BOT_BRIDGE_URL` – In Docker: `http://discord-bot:3100`; locally: `http://localhost:3100`\n   - `API_URL` – In Docker: `http://api:3000`; locally: `http://localhost:3000`\n\n3. **Database**\n\n   ```bash\n   npm run db:migrate:dev\n   ```\n\n## Build and run\n\nAll build output goes to a single **`dist/`** folder at the repo root:\n\n- **`dist/api/`** – NestJS API\n- **`dist/bot/`** – Discord bot\n\n- **Build everything:** `npm run build`\n- **Run API:** `npm run start:api` (after `npm run build`)\n- **Run bot:** `npm run start:bot` (after `npm run build`)\n- **Dev (both):** `npm run dev`\n- **Dev (single app):** `npm run dev:api` or `npm run dev:bot`\n\n## Bot–backend connection\n\n- **API → Discord:** `POST /api/discord/send-message` with `{ channelId, content }` – API calls the bot’s bridge; the bot sends the message.\n- **Bot → API:** Bot can call `POST /api/events/discord` (e.g. via `reportDiscordEvent()` in `apps/discord-bot/src/api-client`).\n\n## Docker\n\n```bash\ncp .env.example .env\n# Set BOT_TOKEN and optionally BRIDGE_SECRET in .env\ndocker compose up --build\n```\n\n- **postgres** – PostgreSQL 16 on port 5432\n- **api** – NestJS on port 3000 (runs migrations on start)\n- **discord-bot** – Bot + bridge on internal port 3100\n\n## Scripts (root)\n\n| Script           | Description                    |\n| ---------------- | ------------------------------ |\n| `build`          | Build db, api, bot (in order)  |\n| `build:db`       | Prisma generate                |\n| `build:api`      | NestJS build                   |\n| `build:bot`      | TypeScript build for bot       |\n| `start:api`      | Run built API                  |\n| `start:bot`      | Run built bot                  |\n| `dev`            | Run API and bot in watch mode  |\n| `db:migrate`     | Run Prisma migrations (deploy) |\n| `db:migrate:dev` | Create/apply migrations (dev)  |\n\n## License\n\nISC.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevroots-studio%2Fdiscord.js-nest.js-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevroots-studio%2Fdiscord.js-nest.js-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevroots-studio%2Fdiscord.js-nest.js-template/lists"}