Rerolled is a web app for creating random weapon loadouts and challenge runs with friends using the Bungie API.
Users can sign in with their Bungie account, view their Destiny 2 weapons, join a shared lobby, and generate or queue roulette-style weapon loadouts. The app is intended for private group use between matches while players are in orbit.
- Bungie OAuth sign-in
- Destiny 2 character, inventory, and vault lookup
- Weapon cards with icons, perks, and roll details
- Shared lobby system for friends
- Three-slot loadout queue
- Random weapon selection
- Rotating captain system
- Transfer and equip support through the Bungie API where allowed
This app uses the Bungie API to read Destiny 2 profile, inventory, vault, and equipment data. With user authorization, it may also move or equip Destiny 2 items.
The app does not store Bungie passwords. Authentication is handled through Bungie OAuth.
See /privacy (app/privacy/page.tsx) for the full privacy policy — what's stored, why, and how to request deletion.
See SECURITY.md for how tokens are encrypted, what account/game
data is stored, secret-handling expectations for collaborators, and how to
report a vulnerability.
- Node.js and npm installed
- A Bungie account
- ngrok installed (
brew install ngrokon macOS)
-
Install dependencies
npm install
-
Set up ngrok for local tunneling
- Create a free ngrok account at https://ngrok.com
- Get your auth token from https://dashboard.ngrok.com/auth/your-authtoken
- Run:
ngrok config add-authtoken YOUR_AUTHTOKEN
-
Start your local dev server
npm run dev
The server will run on
http://localhost:3000(plain HTTP — ngrok is what provides the HTTPS tunnel Bungie's OAuth requires, see next step) -
Start ngrok in a separate terminal
ngrok http 3000
This will display a forwarding URL like
https://abc123.ngrok.io -
Create a Bungie API application
- Go to https://www.bungie.net/en/Application
- Create a new application
- Set the OAuth redirect URL to:
https://YOUR_NGROK_URL/api/auth/bungie/callback- Replace
YOUR_NGROK_URLwith the ngrok URL from step 4
- Replace
- Save your Client ID and Client Secret
-
Configure environment variables
- Copy
.env.exampleto.env.localand fill in every value —.env.exampleis the source of truth for what's required (Bungie OAuth creds, Supabase project keys,TOKEN_ENCRYPTION_KEY,NEXTAUTH_SECRET). The app won't run past the login screen without a working Supabase connection. - Bungie creds specifically:
BUNGIE_CLIENT_ID=YOUR_CLIENT_ID BUNGIE_CLIENT_SECRET=YOUR_CLIENT_SECRET - Optionally, set
BUNGIE_REDIRECT_URIif your redirect URL differs from the default:If not set, it defaults toBUNGIE_REDIRECT_URI=https://YOUR_NGROK_URL/api/auth/bungie/callback{NEXTAUTH_URL}/api/auth/bungie/callback
- Copy
-
Test locally
- Visit
https://YOUR_NGROK_URLin your browser - Sign in with your Bungie account using the OAuth redirect
- Visit
- BUNGIE_REDIRECT_URI: Optional environment variable for the OAuth redirect URL. By default, it's constructed from
NEXTAUTH_URL. Set this if you need a custom redirect path (e.g., when using ngrok with a custom domain or testing with different tunneling services). - ngrok URL changes: Each time ngrok restarts, you get a new URL. Update your Bungie app's redirect URL and
.env.localif ngrok restarts. - Keep both services running: The dev server and ngrok must both be running for OAuth to work.
- Use https://: ngrok provides SSL automatically; Bungie API requires HTTPS.
https://d2roulette.app — deploys from the release branch.
https://preview.d2roulette.app — deploys from the main branch (uses a
separate Bungie OAuth app so sign-in works on preview). Promote to production
by merging main into release.
Local development uses:
http://localhost:3000/api/auth/callback/bungie
Early development / personal project.
- Match detection architecture — how games are detected, recorded, and how captain rotation works (read this before touching the stats pipeline).
- Weapon variant pooling — how re-released / Adept / craftable versions of the same gun are grouped (and what's still exact-hash).
- Weapon/perk data pipeline — how the static weapon/perk tables are built and refreshed, the intrinsic frame/archetype perk, and the Clarity community data integration (with its attribution requirement).
- Database migrations — migrations are applied by hand, not automatically. Check the status table before assuming a migration is live.
- Best rolls dataset — crowd-sourced ideal perk/stat combos per weapon archetype, feeding a future "best roll" badge on the Roll Comparison screen.
This project is not affiliated with, endorsed by, sponsored by, or approved by Bungie. Destiny, Destiny 2, and Bungie are trademarks of Bungie, Inc.