How saab04/express-app works
This is an Express coin-flip game with user accounts, a coin balance, and a once-daily 100-coin reward. Users sign up or log in, receive a cookie-based JWT, then access authenticated dashboard, reward, account, and coin-flip routes. Reward claims and coin-flip bets update the user record in MongoDB. The graph includes the sampled browser scripts and route/controller behavior; the templates and other client-side game behavior were not sampled, so their internal interactions are not inferred.
Main entry points: auth.js Auth routes · dashboard.js Dashboard routes · server.js Express server · global.js Shared browser script
Components 14
Web entry and pages
- Express server
server.js - Shared browser script
public/js/global.js - Game and account pages
views
Accounts and authentication
- Auth routes
routes/auth.js - JWT middleware
middleware/authMiddleware.js - Account controller
controllers/authController.js - Login and signup
public/js/login.js - Signup script
public/js/signup.js
Wallet and game
- Dashboard routes
routes/dashboard.js - Balance controller
controllers/balanceController.js - Reward interface
public/js/reward.js
User data
- User model
models/User.js
Other components
- Player browser
- MongoDB
Connections 19
- Player browser → Express server: requests pages
server.js - Express server → Auth routes: mounts routes
server.js - Express server → Dashboard routes: mounts routes
server.js - Express server → MongoDB: connects
server.js - Auth routes → JWT middleware: checks sessions
routes/auth.js - Auth routes → Account controller: dispatches auth
routes/auth.js - Dashboard routes → JWT middleware: protects pages
routes/dashboard.js - Dashboard routes → Balance controller: dispatches actions
routes/dashboard.js - Dashboard routes → Game and account pages: renders pages
routes/dashboard.js - Auth routes → Game and account pages: renders forms
routes/auth.js - Account controller → User model: reads and writes
controllers/authController.js - Balance controller → User model: reads and updates
controllers/balanceController.js - Login and signup → Auth routes: posts credentials
public/js/login.js - Signup script → Auth routes: posts signup
public/js/signup.js - Shared browser script → Auth routes: checks session
public/js/global.js - Shared browser script → Auth routes: posts logout
public/js/global.js - Shared browser script → Dashboard routes: gets rewards
public/js/global.js - Reward interface → Dashboard routes: claims reward
public/js/reward.js - Reward interface → Shared browser script: uses reward helper
public/js/reward.js