Backend
The backend for this project is built with NestJS, Prisma ORM, PostgreSQL, and Docker. It exposes REST APIs for authentication (login, register, profile), posts (CRUD, like/unlike), and comments. The frontend talks to this API via the configured base URL.
Stack Overview
- NestJS — Framework for modules, controllers, services, and guards.
- Prisma ORM — Database access and migrations for PostgreSQL.
- PostgreSQL — Primary database for users, posts, comments, likes, etc.
- Docker — Containerization for the API and database (e.g.
docker-composefor local development).
Frontend Integration
The Next.js app uses NEXT_PUBLIC_API_URL as the API base URL. All requests go through src/core/lib/api-client.ts, which:
- Adds the session
accessTokenas a Bearer token. - Sends
x-custom-langwith the current locale for i18n. - Handles JSON and
FormData(e.g. for creating posts with media).
Login is done with email and password; the backend returns an access token that the frontend stores in the NextAuth session and sends on every API call. There is no dependency on third-party OAuth providers in the documented flow.
API Endpoints (Summary)
Endpoints used by the frontend:
- Auth: login, register, profile, forgot/reset password (as implemented by the backend).
- Posts:
GET/POST /posts,GET/PUT/DELETE /posts/:id,POST /posts/:id/like,POST /posts/:id/unlike. - Comments:
POST /commentswithpostIdandcontent.
Exact paths and request/response shapes should match the NestJS controllers and DTOs in the backend repository. The frontend types in src/features/social/types/post-api.ts and the auth actions reflect the expected API contract.