How atulmy/fullstack-javascript-architecture works
Project Components – Identify and represent the following main elements
• Backend Services:
⁃ API Service (Node.js and Express) under “backend/api”
▸ Runs on PORT 8000; uses JWT authentication and an RPC (or REST) pattern.
⁃ Database Service (MongoDB) inside “backend/database”
▸ Runs on PORT 27017.
⁃ Proxy Service (NGINX) under “backend/proxy”
▸ Listens on standard HTTP/HTTPS ports (80/443) and routes traffic to the appropriate internal services.
• Frontend Applications:
⁃ Landing Website (“frontend/landing”) – Uses React with server-side rendering (Next.js), Material UI, and is configured for PORT 3000.
⁃ Web Application (“frontend/app/web”) – A single-page React app with Redux and React Router, served from PORT 5000.
⁃ Mobile Application (“frontend/app/mobile”) – Built with React Native (for both iOS and Android) with separate native configurations.
• Deployment:
⁃ Docker & Docker Compose (“deployment/docker-compose.yml”)
Mapping Relationships and Interactions
⁃ External Requests: Client traffic accessing URLs like example.com (landing), app.example.com (web app), and api.example.com (API) will first hit the NGINX proxy.
⁃ Proxy forwarding: The NGINX container dispatches requests based on the domain/port to the corresponding backend or frontend container.
⁃ Frontend-to-API communication:
▸ The landing, web, and mobile apps all communicate with the API (using the specified API_URL) for data operations.
• Separate network layers for deployment inside Docker Compose, where the containers share an internal network.
Architectural Patterns & Design Principles
• Microservices Architecture: Each service (API, database, proxy, frontends) is isolated and can be scaled or updated independently. Emphasize this separation.
• Containerization: Highlight that services are containerized using Docker and orchestrated with Docker Compose.
• API Layer: The backend API encapsulates business logic and exposes endpoints via RPC (or REST) – note JWT authentication and seeding approaches.
• Frontend Separation: Emphasize the distinct concerns:
▸ Landing website for marketing and SEO (with server-side rendering).
▸ Web application for comprehensive user interactions.
▸ Mobile application for native iOS/Android experiences.
• Below, include the NGINX proxy as the entry point.
▸ One side shows the backend ecosystem: API service connected to MongoDB.
• A container/ orchestration block on the side representing Docker Compose, which encapsulates all these services.