How hugocbb/gerenciador-de-tarefas works
Project type and purpose
• This is a full-stack task-management web app (“tarefas” = tasks) with:
• A Go/Gin RESTful backend (controllers, models, GORM+Postgres)
• A React/Vite SPA frontend (pages, components, Axios-style API service)
• Users can register/login, manage tasks (CRUD), with JWT-style or session auth via middleware.
File structure
• Top-level:
• backend/ → Go server code
• frontend/ → React app
• backend layers:
• cmd/server/main.go → entry point
• config/ → env vars (godotenv), global config
• routers/ → Gin route definitions
• middleware/ → auth & request guards
• controllers/ → HTTP request handlers
• models/ → GORM structs for User & Tarefa
• database/ → DB connection (Postgres)
• frontend layers:
• src/pages/ → route targets (Home, Login, Cadastrar, Profile, Tarefas)
• src/components/ → reusable UI (Card, Navbar)
• src/services/Api/ → HTTP client wrapper for backend endpoints
• App.jsx + main.jsx → top-level router & mount
README for additional insights
• Backend uses Gin, GORM, bcrypt, Godotenv, Air (hot reload)
• Frontend uses React, Vite, ES6+, npm scripts
• DB = PostgreSQL, auth via bcrypt + middleware
a. Main components:
• Client Browser / React SPA
• API Service Layer (frontend service/Api)
• HTTP(s) / Internet
• Backend Server (Gin)
– Router
– Middleware (Auth)
– Controllers (User, Tarefas)
– Models & GORM
– Config & Env Loader
• Database (PostgreSQL)
• External tools (Air hot reload, Godotenv)
b. Relationships & interactions:
1. User interacts with React SPA → triggers UI events
2. SPA → Ajax calls via Api service → Gin endpoints
3. Gin Router dispatches → Middleware → Controllers
4. Controllers use GORM models → Query/Mutate Postgres
5. DB returns data → Controller → JSON → SPA
c. Architectural patterns & principles:
• Layered MVC-style: routers → controllers → models → DB
• Separation of concerns: config, middleware, controllers, models
• Single Page Application (SPA) on frontend, REST API on backend
• Env-driven configuration (12-factor app)
d. Key technologies & libraries:
• Backend: Go 1.19+, Gin, GORM, bcrypt, godotenv, Air, PostgreSQL
• Frontend: React, Vite, Axios-style service
• Build/deploy: npm, go mod, Air hot reload