How corced/discorddam works
DiscordDam gates web access on Discord OAuth and target-guild membership, then issues JWT-backed access. The auth server owns verification, sessions, and internal APIs; the Discord bot supplies membership checks and moderation commands through HTTP. The web screens represent login and access outcomes. Relationships involving unsampled UI pages and bot event handlers are omitted where the excerpts do not show their wiring.
Main entry points: auth.ts OAuth routes · internal.ts Internal API · userRepository.ts User records · app.ts HTTP app
Components 26
Web experience
- Login screen
packages/web/app/login/page.tsx - OAuth callback
packages/web/app/auth/callback/page.tsx - Dashboard
packages/web/app/dashboard/page.tsx - Access denied
packages/web/app/access-denied/page.tsx
Auth service
- HTTP app
packages/auth-server/src/app.ts - OAuth routes
packages/auth-server/src/routes/auth.ts - Token routes
packages/auth-server/src/routes/token.ts - Internal API
packages/auth-server/src/routes/internal.ts - Discord OAuth
packages/auth-server/src/services/discordOAuth.ts - Guild verifier
packages/auth-server/src/services/guildVerifier.ts - JWT service
packages/auth-server/src/services/jwtService.ts - Request middleware
packages/auth-server/src/middleware
Discord bot
- Discord client
packages/bot/src/client.ts - Moderation commands
packages/bot/src/commands - Membership API
packages/bot/src/http/server.ts - Verify route
packages/bot/src/http/routes/verify.ts - Auth webhook client
packages/bot/src/services/authWebhook.ts
Shared contracts
- Shared contracts
packages/shared/src/types/verification.ts
Persistence and cache
- User records
packages/auth-server/src/db/repositories/userRepository.ts - Session records
packages/auth-server/src/db/repositories/sessionRepository.ts - Audit records
packages/auth-server/src/db/repositories/auditRepository.ts - Auth Redis
packages/auth-server/src/services/redisService.ts - Bot Redis
packages/bot/src/services/redisService.ts
Other components
- Visitor
- Discord
- PostgreSQL
Connections 32
- HTTP app → OAuth routes: mounts
packages/auth-server/src/app.ts - HTTP app → Token routes: mounts
packages/auth-server/src/app.ts - HTTP app → Internal API: mounts
packages/auth-server/src/app.ts - OAuth routes → Request middleware: uses
packages/auth-server/src/routes/auth.ts - OAuth routes → Discord OAuth: exchanges code
packages/auth-server/src/routes/auth.ts - OAuth routes → Guild verifier: checks membership
packages/auth-server/src/routes/auth.ts - OAuth routes → User records: upserts user
packages/auth-server/src/routes/auth.ts - OAuth routes → JWT service: issues tokens
packages/auth-server/src/routes/auth.ts - OAuth routes → Session records: creates session
packages/auth-server/src/routes/auth.ts - OAuth routes → Discord: OAuth exchange
packages/auth-server/src/routes/auth.ts - Token routes → Guild verifier: checks membership
packages/auth-server/src/routes/token.ts - Token routes → JWT service: validates tokens
packages/auth-server/src/routes/token.ts - Internal API → User records: queries users
packages/auth-server/src/routes/internal.ts - Internal API → Session records: manages sessions
packages/auth-server/src/routes/internal.ts - Internal API → Audit records: records events
packages/auth-server/src/routes/internal.ts - Discord OAuth → Auth Redis: stores PKCE
packages/auth-server/src/services/discordOAuth.ts - Guild verifier → Membership API: checks membership
- JWT service → Auth Redis: tracks tokens
packages/auth-server/src/services/jwtService.ts - User records → Audit records: logs revocation
packages/auth-server/src/db/repositories/userRepository.ts - User records → PostgreSQL: queries
packages/auth-server/src/db/repositories/userRepository.ts - Session records → PostgreSQL: queries
packages/auth-server/src/db/repositories/sessionRepository.ts - Audit records → PostgreSQL: queries
packages/auth-server/src/db/repositories/auditRepository.ts - Membership API → Verify route: registers route
packages/bot/src/http/server.ts - Verify route → Discord client: checks Discord
packages/bot/src/http/routes/verify.ts - Moderation commands → Auth webhook client: calls internal API
packages/bot/src/commands/index.ts - Auth webhook client → Internal API: HTTP requests
packages/bot/src/services/authWebhook.ts - Moderation commands → Bot Redis: uses sync lock
packages/bot/src/commands/syncmembers.ts - Visitor → Login screen: opens
- Login screen → OAuth routes: starts OAuth
- OAuth routes → OAuth callback: redirects outcomes
- OAuth callback → Dashboard: shows access
- OAuth callback → Access denied: shows rejection