A basic Discord Activity starter built with Vite, React, TypeScript, and the Discord Embedded App SDK.
-
Install dependencies:
pnpm install
-
Copy the example environment file and add your Discord application client ID:
cp .env.example .env.local
VITE_DISCORD_CLIENT_ID=your_discord_application_client_id
-
Start the dev server:
pnpm dev
The Vite server is configured for http://localhost:3000.
Discord Activities need to load from an HTTPS URL. For local development, expose Vite with a tunnel such as Cloudflare Tunnel, ngrok, or the tunnel provider you prefer.
- Create an application in the Discord Developer Portal.
- Enable Activities for the application.
- Add a URL mapping that points to your HTTPS tunnel URL.
- Launch the activity from Discord.
When Discord loads the app, src/App.tsx creates a DiscordSDK instance with
VITE_DISCORD_CLIENT_ID and calls discordSdk.ready().
This project includes nixpacks.toml so Dokploy can build and serve the
production Vite bundle with Nixpacks.
-
Create a new Dokploy application from this repository.
-
Select Nixpacks as the builder.
-
Add this environment variable before the first deploy:
VITE_DISCORD_CLIENT_ID=your_discord_application_client_id
-
Deploy the app. Nixpacks runs
pnpm install --frozen-lockfile,pnpm build, and then starts the server withpnpm start -- --port ${PORT:-3000}. -
Use the Dokploy HTTPS domain as the URL mapping for your Discord Activity.
If you change VITE_DISCORD_CLIENT_ID, redeploy the app so Vite can rebuild the
client bundle with the new value.
pnpm devstarts Vite on port3000.pnpm buildtype-checks and builds the app.pnpm lintruns ESLint.pnpm previewserves the production build locally.pnpm startserves the production build on0.0.0.0for deployment.