Architecture - vikric/MealPlanner GitHub Wiki

Application is build accordingly to a Three-Tier Architecture, which means that the system is divded by 3 separate layers.

1. Presentation Layer (Frontend)

  • Built with React
  • User interacts via interface
  • Sends HTTP requests to backend (Express)

2. Application Layer (Backend)

  • Built with Express.js (Node.js)
  • Handles API routes, logic, and communication with DB
  • Exposes REST API endpoints to frontend

3. Data Layer (Database)

  • Uses MongoDB Atlas
  • Accessed via Mongoose for schema-based models

Project structure

MealPlanner/
│
├── client/
│     ├── src/                # Main source files (components, hooks, etc.)
│     ├── public/             # Static public files
│     ├── build/              # Build output (after `npm run build`)
│     ├── index.html          # Main HTML template
│     ├── vite.config.js      # Vite configuration
│     ├── Dockerfile          # Docker setup for production
│     │── Dockerfile-dev      # Docker setup for development
│     ├── default.conf        # NGINX or other server configuration
│     ├── .env                # Frontend environment variables
│     ├── package.json        # React dependencies
│     └── eslint.config.js    # Eslint config 
│
├── server/
│     │── src/
│     │   │
│     │   ├── config/         # Configuration files (e.g., DB connection, env)
│     │   ├── controllers/    # Business logic for each route
│     │   ├── middleWare/     # Express middleware (auth, logging, etc.)
│     │   ├── models/         # Mongoose models for MongoDB collections
│     │   ├── routes/         # API route definitions
│     │   ├── tests/          # Unit and integration tests (Jest)
│     │   ├── util/           # Helper utilities
│     │   └── server.js       # App entry point
│     │
│     ├── .env                     # Environment variables
│     ├── Dockerfile               # Docker setup for production
│     ├── Dockerfile-dev           # Docker setup for development
│     └── package.json             # Node.js dependencies
│
├── package.json             # (To be able to start both frontend & backend simultaneously)
├── docker-compose.yml       # Docker orchestration file
├── docker-compose-dev.yml   # Docker orchestration file for development
├── .gitlab-ci.yml           # GitLab CI/CD pipeline configuration
└── README.md                # Project instructions

How to run the project

Start the project

In the terminal type the following and both the frontend and backend server will start:

git clone [email protected]:VikRic/MealPlanner.git

cd MealPlanner

npm run install-all

npm run dev