How gizzzmo/cassanova works
Purpose and topology
Cassanova is an educational full-stack casino platform: a Next.js customer UI consumes an Express REST API backed by MongoDB. It covers account lifecycle, game/promotional catalog browsing, wallet transactions, KYC-gated withdrawals, and responsible-gaming settings. Real payment and game-provider integrations are explicitly future work.
Application entry points
• Frontend App Router root and global shell: frontend/app/layout.tsx, with the landing experience at frontend/app/page.tsx.
• Backend HTTP process: backend/src/server.ts; it owns Express setup, API route mounting, MongoDB connectivity, CORS, and server startup.
• Frontend-to-backend boundary is centralized in frontend/lib/api.ts; client authentication/session state is provided by frontend/lib/auth-context.tsx.
Frontend route composition
The Next.js application separates public catalog/marketing routes from authenticated account and wallet journeys. Dynamic detail routes resolve game and promotion slugs via frontend/app/games/[slug]/page.tsx and frontend/app/promotions/[slug]/page.tsx. Account-facing flows are routed through frontend/app/dashboard/page.tsx, frontend/app/deposit/page.tsx, and frontend/app/withdraw/page.tsx. Shared navigation frames content through frontend/components/layout/Header.tsx and frontend/components/layout/Footer.tsx.
Identity and authorization
Authentication is JWT-based: registration/login handlers issue credentials, while passwords are protected with bcrypt. API protection occurs at the Express middleware boundary before protected user and financial operations: backend/src/controllers/auth.controller.ts, backend/src/middleware/auth.middleware.ts, and backend/src/routes/auth.routes.ts. The frontend auth context persists session state and drives protected-route redirects; backend authorization remains the trust boundary.
Domain persistence and API layers
Mongoose models define the central MongoDB records: user/account and KYC or gaming state in backend/src/models/User.ts, catalog metadata in backend/src/models/Game.ts, and wallet audit records in backend/src/models/Transaction.ts. Express routes map resource endpoints to controllers, keeping HTTP wiring separate from operation logic; examples include backend/src/routes/game.routes.ts, backend/src/controllers/game.controller.ts, and backend/src/controllers/promotion.controller.ts.
Financial and compliance flow
Deposit and withdrawal requests enter transaction routes/controllers, validate authenticated user state and balance-related constraints, then create transaction history and update account state. Withdrawal is additionally KYC-gated; transaction operations are an internal application workflow, not an implemented external payment settlement integration. Primary locations: backend/src/routes/transaction.routes.ts, backend/src/controllers/transaction.controller.ts, backend/src/models/Transaction.ts.
Runtime and delivery boundaries
Frontend runtime is Next.js 15/React 19/TypeScript with Tailwind CSS; backend is Node.js 20+, Express 5, TypeScript, MongoDB 8/Mongoose, JWT, and bcryptjs. MongoDB may be local or Atlas and is configured through backend environment values, represented by backend/.env.example. CI builds backend TypeScript and lints/builds the frontend in .github/workflows/ci.yml; deployment exists only as an opt-in template at .github/workflows/deploy.yml.template.
Main entry points: server.ts Express server · layout.tsx App shell & landing · api.ts API client · page.tsx Account & wallet routes
Components 21
Next.js frontend
- App shell & landing · App Router root hosts the public landing experience.
frontend/app/layout.tsx - Catalog detail routes · Game and promotion pages resolve catalog slugs.
frontend/app/games/[slug]/page.tsx - Account & wallet routes · Dashboard, deposit, and withdrawal journeys.
frontend/app/dashboard/page.tsx - Header & footer
frontend/components/layout/Header.tsx - API client · Centralized frontend-to-backend REST access.
frontend/lib/api.ts - Auth context · Persists session state and redirects protected routes.
frontend/lib/auth-context.tsx
Express backend
- Express server · Configures Express, CORS, MongoDB connectivity, routes, and startup.
backend/src/server.ts - Auth routes
backend/src/routes/auth.routes.ts - Auth controller · Registration and login issue JWT credentials and protect passwords with bcrypt.
backend/src/controllers/auth.controller.ts - JWT auth middleware · Protects user and financial operations.
backend/src/middleware/auth.middleware.ts - Game routes
backend/src/routes/game.routes.ts - Game controller
backend/src/controllers/game.controller.ts - Promotion controller
backend/src/controllers/promotion.controller.ts - Transaction routes
backend/src/routes/transaction.routes.ts - Transaction controller · Validates balances; withdrawals require KYC; no external settlement is implemented.
backend/src/controllers/transaction.controller.ts
Persistence
- User records · Accounts, KYC, and gaming state.
backend/src/models/User.ts - Game catalog
backend/src/models/Game.ts - Transaction ledger · Wallet audit records.
backend/src/models/Transaction.ts - MongoDB · Local or Atlas deployment configured through backend environment values.
backend/.env.example
Delivery
- CI workflow · Builds backend TypeScript and lints/builds the frontend.
.github/workflows/ci.yml - Deploy template · Opt-in deployment template.
.github/workflows/deploy.yml.template
Connections 26
- App shell & landing → Header & footer: frames
- App shell & landing → Catalog detail routes: links to
- App shell & landing → Account & wallet routes: links to
- Account & wallet routes → Auth context: uses session
- Auth context → API client: supplies JWT
- Catalog detail routes → API client: loads catalog
- Account & wallet routes → API client: account requests
- API client → Express server: REST API
- Express server → Auth routes: mounts
- Express server → Game routes: mounts
- Express server → Transaction routes: mounts
- Auth routes → Auth controller: dispatches
- Auth controller → User records: creates/authenticates
- Game routes → Game controller: dispatches
- Game controller → Game catalog: reads
- Promotion controller → Game catalog: serves catalog
- Transaction routes → JWT auth middleware: requires
- JWT auth middleware → Transaction controller: authorizes
- Transaction controller → User records: checks KYC and balance
- Transaction controller → Transaction ledger: creates history
- User records → MongoDB: persists
- Game catalog → MongoDB: persists
- Transaction ledger → MongoDB: persists
- CI workflow → App shell & landing: lints and builds
- CI workflow → Express server: builds TypeScript
- Deploy template → Express server: deployment option