How spike04/friday-futsal works
Project type and purpose
• This is a full‑stack single‑page web application.
• Frontend: React + TypeScript + Vite + Tailwind CSS.
• Backend: json‑server serving db.json (REST API on port 3000).
• Purpose: generate, save, and share Friday Futsal match lineups (players, teams, match info).
File structure
• Top‑level:
– package.json, vite.config.ts, tsconfig*.json, tailwind.config.js, postcss.config.js → build & tooling.
– db.json + json‑server usage → simple REST backend.
– public/index.html, src/index.css → static assets.
• src:
– main.tsx, App.tsx → application entry point & root component.
– api.ts → abstraction over REST calls to json‑server.
– assets → logos or images.
– components/ui → atomic UI elements (Button, Input, Card, etc.).
– components → feature‑level UI (nav‑bar, player-item, team-item, match-info).
– pages → route‑driven components (home-page, match-generate-page).
– lib/utils.ts → shared utility functions.
– types → TypeScript type definitions.
README for additional insights
• Features: generate & share matches, CRUD operations on players, teams, match data, share via URL.
• Dev setup: run json-server --watch db.json --port 3000; run Vite via npm run dev.
a. Main components
1. Browser / Client
2. Vite Dev Server (serves the SPA, bundles code)
3. React SPA
– UI Layer (components/ui, components)
– Page/Route Layer (pages)
– API client (src/api.ts)
4. JSON‑Server REST API
5. db.json (persistent data store)
b. Relationships & interactions
• Browser sends HTTP GET/POST/PUT/DELETE to Vite Dev Server → serves index.html & JS bundle.
• React SPA renders UI, calls api.ts → issues AJAX calls to JSON‑Server endpoints (e.g., /players, /teams, /matches).
• JSON‑Server reads/writes db.json and returns JSON responses.
c. Architectural patterns & design principles
• Component‑based UI (atomic → feature → pages).
• Single Responsibility: api.ts abstracts HTTP calls; utils.ts has pure helpers.
• RESTful backend (json‑server as mock backend).
• Separation of concerns: build tooling isolated, static assets in public, type definitions centralized.
d. Key technologies/frameworks
• React + TypeScript + Vite + Tailwind CSS
• json‑server (mock REST API)
• PostCSS, ESLint, TSConfig
Detail without over‑splitting
• Just enough detail to convey how data flows and how modules depend on each other.