How shivamthakurxcode/dynexia-client-portal works
Project Type and Purpose
• This is a full-stack, monorepo MERN-style application combining:
• A Next.js 13 “app” folder front-end (React + Tailwind + shadcn/ui + NextAuth)
• An Express.js REST API back-end (in “backend/”)
• A legacy-style Create-React-App front-end (in “frontend/”)—likely for transitional or standalone use
• Shared libraries and hooks under “lib/” and “hooks/”
• Purpose: a client portal supporting user auth, project/document/invoice management, messaging, and onboarding.
File-Structure Analysis
• Top-level:
• Dockerfiles and docker-compose configs (local + prod)
• nginx reverse-proxy config
• prisma schema (though MongoDB is primary—prisma may be for local schemas or future SQL)
• Next.js project (app/, components/, lib/) with serverless API routes for auth, upload, webhook
• Separate Express backend (backend/) exposing /api/auth, /api/projects, /api/documents, etc.
• A standalone React app (frontend/) using React Router and Axios
• Patterns:
• Next.js handles SSR/SSG and NextAuth under “app/api/auth”
• Express uses MVC structure: controllers/, models/, routes/
• Shared authentication logic: JWT in Express, NextAuth in Next.js
• Cloudinary as file-storage service, Google OAuth as external identity provider
• Deployment: containerized services orchestrated via Docker Compose, with Nginx for SSL/HTTP routing.
a. Main Components
1. User’s Browser (React SPA or Next.js pages)
2. Next.js Front-End Server
3. Express.js API Server
4. MongoDB Database
5. Cloudinary (file storage)
6. External OAuth Provider (Google)
7. Nginx Reverse Proxy (in prod)
8. (Optional) CRA Front-End Service
b. Relationships & Data Flows
• Browser ↔ Next.js Server: page requests, form submissions, NextAuth flows
• Next.js Server ↔ Express API: REST calls for projects, docs, messages, invoices
• Express API ↔ MongoDB: Mongoose CRUD operations
• Express API ↔ Cloudinary: upload/download via cloudinary.js util
• Next.js Server ↔ Google OAuth: OAuth handshake via NextAuth
• Nginx ↔ (Next.js / Express) containers: SSL termination and path-based routing
• (If used) Browser ↔ CRA Front-End Service → Express API (similar calls)
c. Architectural Patterns
• Monorepo with multiple sub-projects
• Separation of concerns: SSR/SSG front-end vs. dedicated data API
• MVC in Express backend; App Router pattern in Next.js front-end
• Serverless functions (Next.js app/api) for auth and file-upload webhook
• Containerized micro-services behind Nginx gateway
d. Key Technologies
• Next.js 13 (React + App Router + NextAuth + Tailwind + shadcn/ui)
• Express.js + Node.js + Mongoose + JWT
• MongoDB Atlas (or local)
• Cloudinary for media storage
• Docker, Docker Compose, Nginx
• Prisma (for schema if used), Google OAuth
• Legacy React SPA (CRA with React Router + Axios)