How gabrieldornelas/clone-tabnews works
Project type and purpose
• Full-stack web application built with Next.js (pages/, pages/api/v1/…)
• Provides user management, sessions, migrations, and status endpoints
• Intended as a “clone” of TabNews, likely for posting and reading content
File structure
• Top-level infra/: Docker Compose (compose.yaml), DB bootstrap scripts, controller.js, database.js
• pages/: Next.js pages (SSR UI) and API routes under pages/api/v1
• models/: ORM-style modules (user, session, password, authentication, migrator)
• infra/migrations: schema migration scripts
• tests/: integration tests driving the HTTP API
• Config and workflows (.env.development, GitHub Actions, ESLint, Jest)
Extract key README insights
• Very minimal; confirms it’s a “clone-tabnews” course project
Main components & their interactions
a. Browser (end user)
– Hits UI routes (pages/index.js, pages/status)
– Hits API routes (pages/api/v1/…)
b. Next.js Server
– Serves UI pages
– Exposes RESTful JSON API under /api/v1
– Uses infra/controller.js for request handling
c. Controller Layer (infra/controller.js)
– Parses HTTP requests, invokes business logic in models
– Handles errors via infra/errors.js
d. Data Access Layer (models/*.js)
– Models for User, Session, Password, Authentication, Migrator
– Calls database.js for low-level queries
e. PostgreSQL Database
– Stateful store for users, sessions
– Initialized/migrated via infra/migrations and wait-for-postgres.js
f. Docker Compose (infra/compose.yaml)
– Defines Node service and Postgres service
– Orchestrates local dev environment
g. External Dependencies
– Node.js, Next.js, PostgreSQL, GitHub Actions (CI), Husky/commitlint
Architectural patterns & design principles
• MVC-like layering: Controllers → Models → Database
• API versioning (v1 namespace) to allow future upgrades
• Migration-driven schema evolution
• Separation of concerns: UI pages vs. API routes
• DevOps: containerized infra and CI pipelines
– UI Subbox (pages/index.js, pages/status)
– API Subbox (pages/api/v1/…)
– Controller (infra/controller.js, errors.js)
– Models (user, session, password, auth, migrator)
7. A footer or side note for Docker Compose, CI, and tests as supporting infrastructure.