{"id":15041901,"url":"https://github.com/discord/discord-example-app","last_synced_at":"2025-05-14T18:04:56.714Z","repository":{"id":37358925,"uuid":"479533829","full_name":"discord/discord-example-app","owner":"discord","description":"Basic Discord app with examples","archived":false,"fork":false,"pushed_at":"2025-01-23T19:29:22.000Z","size":1179,"stargazers_count":620,"open_issues_count":7,"forks_count":688,"subscribers_count":28,"default_branch":"main","last_synced_at":"2025-05-11T18:58:55.412Z","etag":null,"topics":["samples"],"latest_commit_sha":null,"homepage":"https://discord.com/developers/docs/quick-start/getting-started","language":"JavaScript","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/discord.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":"2022-04-08T20:46:13.000Z","updated_at":"2025-05-08T22:48:46.000Z","dependencies_parsed_at":"2024-12-06T05:02:24.142Z","dependency_job_id":"4f5c98e0-a5a9-42a4-9092-767d8952faeb","html_url":"https://github.com/discord/discord-example-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discord%2Fdiscord-example-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discord%2Fdiscord-example-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discord%2Fdiscord-example-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discord%2Fdiscord-example-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/discord","download_url":"https://codeload.github.com/discord/discord-example-app/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198514,"owners_count":22030965,"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":["samples"],"created_at":"2024-09-24T20:46:36.924Z","updated_at":"2025-05-14T18:04:51.706Z","avatar_url":"https://github.com/discord.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Getting Started app for Discord\n\nThis project contains a basic rock-paper-scissors-style Discord app written in JavaScript, built for the [getting started guide](https://discord.com/developers/docs/getting-started).\n\n![Demo of app](https://github.com/discord/discord-example-app/raw/main/assets/getting-started-demo.gif?raw=true)\n\n## Project structure\nBelow is a basic overview of the project structure:\n\n```\n├── examples    -\u003e short, feature-specific sample apps\n│   ├── app.js  -\u003e finished app.js code\n│   ├── button.js\n│   ├── command.js\n│   ├── modal.js\n│   ├── selectMenu.js\n├── .env.sample -\u003e sample .env file\n├── app.js      -\u003e main entrypoint for app\n├── commands.js -\u003e slash command payloads + helpers\n├── game.js     -\u003e logic specific to RPS\n├── utils.js    -\u003e utility functions and enums\n├── package.json\n├── README.md\n└── .gitignore\n```\n\n## Running app locally\n\nBefore you start, you'll need to install [NodeJS](https://nodejs.org/en/download/) and [create a Discord app](https://discord.com/developers/applications) with the proper permissions:\n- `applications.commands`\n- `bot` (with Send Messages enabled)\n\n\nConfiguring the app is covered in detail in the [getting started guide](https://discord.com/developers/docs/getting-started).\n\n### Setup project\n\nFirst clone the project:\n```\ngit clone https://github.com/discord/discord-example-app.git\n```\n\nThen navigate to its directory and install dependencies:\n```\ncd discord-example-app\nnpm install\n```\n### Get app credentials\n\nFetch the credentials from your app's settings and add them to a `.env` file (see `.env.sample` for an example). You'll need your app ID (`APP_ID`), bot token (`DISCORD_TOKEN`), and public key (`PUBLIC_KEY`).\n\nFetching credentials is covered in detail in the [getting started guide](https://discord.com/developers/docs/getting-started).\n\n\u003e 🔑 Environment variables can be added to the `.env` file in Glitch or when developing locally, and in the Secrets tab in Replit (the lock icon on the left).\n\n### Install slash commands\n\nThe commands for the example app are set up in `commands.js`. All of the commands in the `ALL_COMMANDS` array at the bottom of `commands.js` will be installed when you run the `register` command configured in `package.json`:\n\n```\nnpm run register\n```\n\n### Run the app\n\nAfter your credentials are added, go ahead and run the app:\n\n```\nnode app.js\n```\n\n\u003e ⚙️ A package [like `nodemon`](https://github.com/remy/nodemon), which watches for local changes and restarts your app, may be helpful while locally developing.\n\nIf you aren't following the [getting started guide](https://discord.com/developers/docs/getting-started), you can move the contents of `examples/app.js` (the finished `app.js` file) to the top-level `app.js`.\n\n### Set up interactivity\n\nThe project needs a public endpoint where Discord can send requests. To develop and test locally, you can use something like [`ngrok`](https://ngrok.com/) to tunnel HTTP traffic.\n\nInstall ngrok if you haven't already, then start listening on port `3000`:\n\n```\nngrok http 3000\n```\n\nYou should see your connection open:\n\n```\nTunnel Status                 online\nVersion                       2.0/2.0\nWeb Interface                 http://127.0.0.1:4040\nForwarding                    https://1234-someurl.ngrok.io -\u003e localhost:3000\n\nConnections                  ttl     opn     rt1     rt5     p50     p90\n                              0       0       0.00    0.00    0.00    0.00\n```\n\nCopy the forwarding address that starts with `https`, in this case `https://1234-someurl.ngrok.io`, then go to your [app's settings](https://discord.com/developers/applications).\n\nOn the **General Information** tab, there will be an **Interactions Endpoint URL**. Paste your ngrok address there, and append `/interactions` to it (`https://1234-someurl.ngrok.io/interactions` in the example).\n\nClick **Save Changes**, and your app should be ready to run 🚀\n\n## Other resources\n- Read **[the documentation](https://discord.com/developers/docs/intro)** for in-depth information about API features.\n- Browse the `examples/` folder in this project for smaller, feature-specific code examples\n- Join the **[Discord Developers server](https://discord.gg/discord-developers)** to ask questions about the API, attend events hosted by the Discord API team, and interact with other devs.\n- Check out **[community resources](https://discord.com/developers/docs/topics/community-resources#community-resources)** for language-specific tools maintained by community members.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscord%2Fdiscord-example-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiscord%2Fdiscord-example-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscord%2Fdiscord-example-app/lists"}