Before you can test, you need to enable developer settings in your Discord client:
- Open User Settings (gear icon).
- Go to Advanced.
- Enable Developer Mode.
- Enable Developer Activity Shelf. (This allows you to see your local unverified apps).
-
Install Dependencies:
npm install
-
Environment Variables: Ensure you have a
.envfile with:VITE_DISCORD_CLIENT_ID=your_client_id DISCORD_CLIENT_SECRET=your_client_secret
This command starts both the Vite frontend and the PartyKit backend (in dev mode).
npm run devYou need to expose your local Vite server (port 5173) to the internet so Discord can access it.
cloudflared tunnel --url http://localhost:5173- Copy the URL generated (e.g.,
https://cool-app.trycloudflare.com).
- Go to Discord Developer Portal.
- Select your App -> Activities -> URL Mapping.
- Add a new mapping:
- Prefix:
/ - Target: Your tunnel URL (e.g.,
https://cool-app.trycloudflare.com)
- Prefix:
- Open
.env. - Set
VITE_PARTYKIT_HOSTto your tunnel URL (withouthttps://).- Example:
VITE_PARTYKIT_HOST=cool-app.trycloudflare.com - Note: This tells the app where the "public" entry point is, but internally Vite proxies requests to localhost:1999.
- Example:
- Join a Voice Channel in a server where your app is installed.
- Click the Rocket Icon.
- Launch your Activity!
To avoid CORS issues and Mixed Content warnings, this project uses a Proxy configuration in vite.config.ts.
- Frontend requests to
/parties/*are proxied by Vite tolocalhost:1999. - WebSocket connections are also proxied.
- This means you only need ONE tunnel (for port 5173).
If you see issues:
- Check the browser console (Ctrl+Shift+I in Discord if enabled, or open the tunnel URL in Chrome).
- Ensure
VITE_DISCORD_CLIENT_IDmatches your App ID. - Ensure
DISCORD_CLIENT_SECRETis correct for Auth.
By default, the app connects to localhost:1999.
If you are testing with others or if you encounter Mixed Content errors (connecting to insecure WebSocket from secure HTTPS), you may need to tunnel the PartyKit server as well and update VITE_PARTYKIT_HOST.
To tunnel PartyKit:
cloudflared tunnel --url http://localhost:1999Then update .env:
VITE_PARTYKIT_HOST=your-partykit-tunnel.trycloudflare.com
(Do not include https:// or wss://, just the host).