How matheusmendescosta/api-my-blog works
Project type and purpose
• This is a backend REST API template built with Node.js, Express and TypeScript.
• It uses a layered (hexagonal/clean) architecture: HTTP layer (controllers & routes), business logic layer (services), data access layer (repositories & Prisma), plus utilities for email and environment management.
• It’s containerized with Docker, supports Prisma migrations, and includes CI/CD workflows for build and release.
File structure
• Top level: Docker-related files, GitHub Actions workflows, Prisma configs, src/, and template scripts in bin/.
• src/server.ts boots Express; src/app.ts wires middleware, routes, error handlers.
• HTTP layer in src/http:
• routes/route.ts aggregates entity routes.
• controllers/…: each resource (user, post, comment, etc.) has controllers mapped to HTTP endpoints.
• middlewares/: authentication and rate-limiting.
• Business logic in src/services: one folder per domain, each with specialized use-case classes.
• Data access in src/repositories: interface definitions + Prisma implementations in src/repositories/prisma.
• Utility layers: src/lib for Prisma client instantiation and Nodemailer setup; src/emails for templated emails.
• Config and env reading in src/env.
• Docker and docker-compose define containers for the API and database, migrations.
• Prisma migrations under prisma/migrations, schema in prisma/schema.prisma.
README
• Confirms purpose as a boilerplate/template to start an Express + TypeScript project quickly.
• Don’t simply list files—abstract them into components: e.g., “UserController” rather than every single controller file.
• Middleware applied globally or per-route.
• Prisma Client as the bridge between your code and the relational database.
• Environment config being loaded at startup.