Run Your Application Locally
You can load your application from a localhost port or a custom URL. This URL must support HTTPS to load in the web and desktop Discord clients (HTTPS is not required for mobile). When loading from localhost, your application’s network traffic does not pass through Discord’s proxy. This means any requests made by the application must use full URLs rather than mapped paths.Running Through a Network Tunnel
For the most accurate local development experience, we recommend testing against the Discord proxy. This ensures all URL behaviors match what you will see in production. To do this, use a network tunneling tool such as cloudflared to expose your local server. A typical pattern is for each developer to have their own development-only application. To set up a local tunnel:Create a Discord application
Create a new application in the Discord Developer Portal.
Configure URL mapping
Set up the URL mapping for your application.
Your local web server can use HTTP. The network tunnel will upgrade the connection to HTTPS automatically.
3000 with your actual port):
/ prefix to funky-jogging-bunny.trycloudflare.com.
Running in Production
The production configuration is nearly identical to local development:Create an application
Create a new application in the Discord Developer Portal if you haven’t already.
Configure URL mapping
Set up URL Mapping with your production server’s URL at the
/ route.Launch Your Application from the Discord Client
You can see and launch all Activities owned by you or any team you are a member of via the Developer Activity Shelf. Note that an Activity will not appear on the current platform (web, iOS, Android) unless you have checked that platform in Settings > Supported Platforms in the developer portal.- Web
- Mobile
- Go to User Settings > App Settings > Advanced and toggle on
Developer Mode - Enter a voice channel
- From the RTC Panel or Center Control Tray, click the Rocket Button to open the Activity shelf
- Click your Activity to launch it
URL Mapping
Activities in Discord are sandboxed through a Discord proxy. This hides users’ IP addresses, your application’s IP addresses, and blocks requests to known malicious endpoints. As an application owner, you can configure the proxy to allow network requests to external endpoints. Because your application is sandboxed, it cannot make network requests to arbitrary external URLs. To accesshttps://some-api.com, create a URL mapping with PREFIX set to /api and TARGET set to some-api.com. Requests from your Activity to /api will then be forwarded through the Discord proxy to some-api.com.
How to Set a URL Mapping
Click Activities > URL Mappings in the developer portal and set the prefix and target values.Prefix/Target Formatting Rules
-
Do not include a protocol in the target URL. Use
your-url.com, nothttps://your-url.com. -
Parameter matching is supported for subdomains:
PREFIX TARGET /google/{subdomain}{subdomain}.google.com -
Targets must point to a directory, not a specific file (e.g.,
example.com/index.htmlis not supported). -
When multiple prefixes share the same initial path, place the longer prefix first. For example, place
/foo/barbefore/foo, or requests to/foo/barwill never be reached.
CSP Exceptions
The following URLs are exempt from the sandbox and can be reached without a URL mapping:https://discord.com/api/https://canary.discord.com/api/https://ptb.discord.com/api/https://cdn.discordapp.com/attachments/https://cdn.discordapp.com/avatars/https://cdn.discordapp.com/icons/https://media.discordapp.net/attachments/https://media.discordapp.net/avatars/https://media.discordapp.net/icons/
Logging
By default, the SDK forwards allconsole.log, warn, error, info, and debug events from your app to the Discord client.
Viewing Logs on Desktop
Desktop logs are visible in the browser’s Developer Tools console. The Public Test Build (PTB) Discord client also supports inspecting logs via View > Developer > Toggle Developer Tools. Download PTB at discord.com/downloads.Viewing Logs on Mobile
Filtering Application Logs
Inside Debug Logs, search for your application’s logs using:RpcApplicationLogger- Your Application ID
[RpcApplicationLogger] <application-id> - message
Sharing Logs from Mobile
With Developer Mode enabled, you can share logs from a voice channel. Swipe up from the bottom to see expanded voice controls, then tap Share Application Logs.Disabling Log Forwarding
To prevent logs from being forwarded to the browser:Forwarding Specific Log Messages
Use thecaptureLog command to forward specific log messages: