How matteobira/jss works
Project type and purpose
• This is a full-stack JavaScript application implementing the Italian card game “Scopa” as a web app.
• The frontend is a static web client (HTML/CSS/JS) served from the public folder; the backend is a Node.js/Express monolith exposing RESTful game APIs; there’s also a simple database initialization script.
File structure
Top-level
• .env.example / .gitignore – environment and ignore rules
• package.json / package-lock.json – Node.js dependencies and scripts
• project_structure.md – (likely docs on logical layout)
• scripts/create-db.js – DB schema/setup script
• README.md – project overview
public/ (frontend)
• index.html, style.css, script.js – main UI and styling
• assets/, img/, music/, soundEffects/ – static media resources
• pdf/guide.pdf – game guide
server/ (backend)
• server.js – entry point, Express app setup
• API/ – route handlers (addAdmin.js, index.js)
• Card/, Mazzo/, Partita/, Player/ – domain logic modules, each with its own index.js
Key insights from README
• Pure-JavaScript implementation of Scopa
• No mention of external services beyond user’s browser and your Node.js server
• Game rules and flow but no extra microservices or message brokers
Main components
a. Client (Browser)
– Static files: index.html, script.js, style.css, media assets
– UI logic: rendering the table, cards, user interactions, sound playback
b. Web Server (Node.js/Express)
– HTTP(S) server (server.js)
– API Layer (server/API) handling requests (e.g., startGame, playCard, addAdmin)
– Domain Modules (server/Card, server/Mazzo, server/Partita, server/Player) encapsulating game rules and state transitions
c. Database (SQL or NoSQL)
– Initialized by scripts/create-db.js
– Persists users, admin flags, game sessions, scores, etc.
d. (Optional) CI/CD
– GitHub Actions workflow in .github/workflows/test.yml for automated tests
Relationships and interactions
• Browser → HTTP → Express API endpoints
• Express endpoints → domain modules → database
• Database → Express (read/write game state) → Browser (updated UI)
• All static-asset requests → Express static middleware → public/
Architectural patterns and design principles
• Monolithic, modularized by domain (Card, Mazzo, Partita, Player)
• Clear separation of concerns:
– Static assets vs. dynamic API
– Route handling vs. business logic
• Single origin for frontend and backend (no separate CDN or microservices)
Technologies and frameworks
• Node.js & Express for server
• Vanilla JavaScript for frontend (no framework)
• Relational or document database accessed via create-db.js (custom setup)
• GitHub Actions for CI tests