Architecture
This section describes the architectural design of the MEAN Stack Contacts application.
Components
The application consists of the following main components:
- MongoDB Database: Stores user and contact data
- Express.js API: Provides RESTful endpoints for the frontend
- Angular Frontend: User interface for the application
- Nginx: Serves as a reverse proxy and load balancer (in production setup)
Container Structure
The application can be deployed in two configurations:
2-Container Setup
- Frontend and API combined in one container
- MongoDB in a separate container
4-Container Setup (Production Recommended)
- Angular frontend container
- Express.js API container
- MongoDB container
- Nginx load balancer container
Communication Flow
- Client requests are received by Nginx (in production setup)
- Nginx routes requests to either the Angular frontend or the Express.js API
- The Angular frontend makes API calls to the Express.js backend
- The Express.js API interacts with the MongoDB database for data operations