How nikitapryymak/mern-auth-jwt works
Project type and purpose
• This is a full-stack MERN (MongoDB, Express, React, Node) authentication template using JWT.
• It provides user registration, login/logout, email verification, password reset and session management.
• Frontend: React + Chakra UI + React Query; Backend: TypeScript + Express; Database: MongoDB; Email service: Resend.
File structure
• Top-level directories:
– backend/ – all API logic organized in layers: routes → controllers → services → models
– frontend/ – React single-page app with components, pages, hooks, config, theme
– caddy/ – Caddy reverse-proxy configurations & Dockerfiles
– docker-compose.yml & docker-compose.dev.yml – orchestration for local/dev containers
• Config & env samples in both frontend and backend.
• Middleware (authentication, error handling), utility modules (jwt, bcrypt, email templates) in backend.
• React Query and custom hooks handle data fetching and caching on the client.
README for additional insights
• It describes a layered API architecture (routes → controllers → services → models).
• It shows the JWT authentication flow (short-lived access token + long-lived refresh token in HTTP-only cookies).
• Mentions Postman collection for testing.
Elements
– Clear labels for each component (e.g., “React SPA,” “Express API – Controller Layer”).
• Backend layers in another (e.g., green)
• External services/data stores in a third (e.g., orange)