How javierparradev/casino works
Project type and purpose
• This is a full-stack web application for a “casino” or sports betting platform.
• The frontend (“casino-frontend”) is a React/Vite single-page app.
• The backend (root “src/”) is a Node.js/Express REST API that manages users, authentication, bets, transactions and football fixtures.
• It persists data in MongoDB and pulls live match data from an external Football API (via RapidAPI).
File structure
• Top-level separation:
• casino-frontend/ (React SPA)
• src/ (Express app)
• Frontend: standard Vite project with index.html, src/components, src/pages, a central App.jsx, and an api.js module for HTTP calls.
• Backend:
• config/ (db connection, env validation, RapidAPI config)
• controllers/ (request handlers per domain: auth, user, football, bet, transaction, dashboard)
• routes/ (Express routes mapping URLs to controllers)
• services/ (business logic: fetching fixtures, placing bets, processing transactions, user management)
• models/ (Mongoose schemas for User, Bet, Transaction)
• middlewares/ (JWT auth, validation, error handling)
• utils/ (JWT helpers)
• Deployment/config: .env, package.json, gitignore.
README for additional insights
• Confirms architecture: Express app with route-controller-service-model layers.
• Mentions MongoDB connection, JWT, RapidAPI integration for football data.
Elements
• From browser → Frontend → API client → Backend Routes
• Backend flow down through Controllers → Services → Database or external API → back up to client
• Rectangles for compute components (frontend, backend modules)