How pakkudon/good-feeds works
Project Type and Purpose
• This is a full-stack web application (“Good Feeds”) that helps users discover places to eat or drink around Melbourne.
• The backend (“api” directory) is a Go service exposing a REST API and performing database migrations against a MySQL server.
• The frontend (“client” directory) is a Next.js (React) app, statically generated and served (e.g., GitHub Pages), which consumes the backend API.
File Structure
• Top-level directories:
• api – Go modules, handlers, models, repositories, database migrations, main entry point.
• client – Next.js code (src/app, components, configuration), styling (Tailwind), static assets (public).
• Notice the separation: “api” contains business logic and persistence; “client” holds UI and presentation.
• Migrations under api/db/migrations drive schema evolution (MySQL).
• ADRs document key architectural choices: relational DB, Go on server, Next.js front-end, static site generation.
Extract Insights from the README
• Backend uses Go 1.21, MySQL, runs migrations via cmd/migrate.go, and starts the API server in main.go.
• Frontend uses Node.js v20+, Next.js, and static generation (npm run dev for local).
• The public site is hosted at GitHub Pages (static assets).
Main Components & Their Roles
a. Client-Side (Next.js)
• Static Host/CDN (e.g., GitHub Pages) serving HTML/CSS/JS.
• React components calling backend REST endpoints (/restaurants, /options).
b. API Server (Go)
• HTTP router/handlers (api/handler/*.go).
• Business logic & validation.
• Repository layer (api/repository/*.go) interacting with MySQL via models (api/model/*.go).
• Migration tool (api/cmd/migrate.go) applying SQL scripts (api/db/migrations).
c. Database
• MySQL instance holding tables for restaurants, options, dietary options, etc.
• Migration scripts manage schema versioning.
d. External Services
• (If used) Map API or geocoding service invoked by the client for map display.
Relationships and Data Flow
1. User’s Browser → CDN/Static Host → Serves Next.js static pages & assets.
2. Browser (React app) → HTTP REST calls → Go API endpoints.
3. Go Handler → Repository → MySQL → returns data to handler → JSON to client.
4. Migrations (one-time or CI/CD) ensure DB schema is up-to-date before server start.
Architectural Patterns & Principles
• Layered Architecture: Presentation (frontend), API (handlers), Business/Repository, Persistence (DB).
• Repository Pattern in Go for data access abstraction.
• ADRs for capturing high-level decisions.
• Static site generation for performance and cost-effective hosting.
• SQL migrations for deterministic schema management.
Technologies & Frameworks to Annotate
• Frontend: Next.js (React), TypeScript, Tailwind CSS, Node.js.
• Backend: Go modules, net/http, custom handlers, Go’s database/sql (MySQL driver).
• DB: MySQL, SQL migration scripts.
• CI/CD or hosting: GitHub Pages (frontend), Go deployment target for API, MySQL instance (self-hosted or cloud).
Final Checklist
[ ] Clear, consistent component labels
[ ] Notation of technologies & frameworks on or near each component
[ ] Migration flow illustrated from cmd/migrate.go → db/migrations → MySQL