How usernanni/placar works
Project type and purpose
• This is a full-stack, real-time scoreboard WebApplication for the “Olimpíada de História Militar e Aeronáutica.”
• Frontend: React + TypeScript SPA built with Vite, React Router, Chakra-UI and SASS.
• Backend: PocketBase (embedded Go-based DB + REST/API server) running in Docker on a VM (Fly.io).
• Deployment: frontend hosted via AWS Amplify (connected to GitHub), backend in a Docker container on Fly.io (or local Docker for LAN mode).
File structure to infer architectural layers
• src/components & src/routes → UI/Views layer (cards, header/footer, pages like Home, Placar).
• src/service → Service layer (pocketBase.tsx: client for REST calls; useParticipante.tsx: hooks for data fetching/business logic).
• index.html, Vite config & public/ → Build/static-asset layer.
• package.json, tsconfig → Tooling/configuration layer.
README for deployment/runtime context
• Initially ran locally with Docker-based PocketBase, port exposed on LAN for projector.
• Now: frontend pipeline on AWS Amplify (GitHub-driven CI/CD), public Landing Page + “/placar” routes, real-time projections at 1920×1080 viewport.
Main components
a. Client Browser (Projector or User device)
• Runs the React SPA (served as static assets)
b. CI/CD Pipeline
• GitHub repo + GitHub Actions (or AWS Amplify build triggers) → Vite build → deploy to AWS Amplify (S3 + CloudFront)
c. Frontend Hosting
• AWS Amplify (Static Web Hosting + CDN)
d. PocketBase Backend
• Docker container on Fly.io VM (or Docker locally for LAN mode)
• Exposes REST API / real-time endpoints, stores data in embedded DB
e. Data Storage
• SQLite (inside PocketBase)
f. Optional Local Mode
• Developer laptop running Docker & PocketBase, direct LAN access
Relationships & data flow
1. Developer pushes to GitHub → triggers CI/CD on AWS Amplify → Vite builds static bundle → deploy.
2. Client’s browser loads SPA from CDN (AWS Amplify).
3. SPA UI (components/routes) calls service layer (pocketBase.tsx) → REST/WebSocket requests to PocketBase API.
4. PocketBase processes requests, updates/fetches from embedded DB → returns JSON responses.
5. Service hooks (useParticipante) update React state → UI re-renders in real time.
Architectural patterns & principles
• SPA with clear separation:
• Presentation Layer (React components & routes)
• Service/Data Layer (client wrappers, hooks)
• Domain Layer (models, content)
• Stateless front-end, back-end as a BaaS (Backend-as-a-Service)
• CI/CD pipeline for automated builds and deployments
• Responsive design locked to 1920×1080 for projector mode
Technologies & frameworks
• React, React Router DOM, Chakra-UI, SASS
• TypeScript, Vite
• PocketBase (Docker)
• AWS Amplify (Static Hosting, CDN)
• GitHub (source control, CI/CD trigger)