Skip to content

RobinJosephDev/mean-crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧩 MEAN ERP β€” Small ERP System (MongoDB, Express, Angular, Node)

A full-stack ERP system built with the MEAN stack (MongoDB, Express.js, Angular, Node.js) and TypeScript β€” designed to demonstrate full production-grade skills for authentication, role-based access, CRUD operations, Docker, testing, and deployment.

This project is part of my full-stack portfolio β€” built from scratch step-by-step as a practical guide to creating a real-world small ERP.


πŸš€ Features (MVP)

πŸ” Authentication & Authorization

  • JWT-based auth with refresh tokens
  • Role-Based Access Control (RBAC) β€” Admin / Manager / Employee
  • Route guards on backend (Express) and frontend (Angular)

πŸ“¦ Inventory Module

  • CRUD operations for Products
  • Tracks stock quantity, SKU, price, reorder level
  • Pagination & search

πŸ’° Sales Module

  • Customers, Orders, Invoices (minimal MVP)
  • Order summary and sales tracking

πŸ“Š Dashboard

  • KPIs: Total sales (30d), low-stock items, recent orders
  • Charts & summaries (Angular Material / Chart.js)

🧠 Tech Stack

Layer Technologies Used
Frontend Angular 17+, TypeScript, Angular Material / Tailwind, RxJS
Backend Node.js (LTS), Express.js, Mongoose, JWT, bcrypt, helmet, morgan
Database MongoDB Atlas
Auth JWT (access + refresh tokens), role guards
Testing Jest, Supertest, Karma, Cypress
Deployment Vercel (Frontend), Render (Backend), Docker Compose (local)

πŸ—οΈ Project Structure

erp-mean/
β”‚
β”œβ”€β”€ backend/              # Node + Express + MongoDB
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ middleware/
β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── server.js
β”‚   β”œβ”€β”€ .env.example
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── package.json
β”‚
β”œβ”€β”€ frontend/             # Angular app
β”‚   β”œβ”€β”€ src/app/
β”‚   β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”œβ”€β”€ products/
β”‚   β”‚   β”œβ”€β”€ orders/
β”‚   β”‚   └── shared/
β”‚   └── angular.json
β”‚
└── docker-compose.yml

βš™οΈ Backend Setup

1️⃣ Install dependencies

cd backend
npm install

2️⃣ Environment Variables

Create a .env file (see .env.example):

PORT=5000
MONGO_URI=mongodb://localhost:27017/erp
JWT_ACCESS_SECRET=replace_with_strong_secret
JWT_REFRESH_SECRET=replace_with_strong_secret
CLIENT_URL=http://localhost:4200

3️⃣ Run backend (dev)

npm run dev

πŸ’» Frontend Setup

1️⃣ Create & install

cd frontend
npm install

2️⃣ Run Angular app

ng serve

Frontend runs on http://localhost:4200


🧱 Docker (optional, for local orchestration)

Docker Compose (dev)

version: '3.8'
services:
  mongo:
    image: mongo:8.0
    volumes:
      - mongo-data:/data/db
  backend:
    build: ./backend
    ports:
      - "5000:5000"
    environment:
      - MONGO_URI=mongodb://mongo:27017/erp
    depends_on:
      - mongo
volumes:
  mongo-data:

Run with:

docker compose up --build

πŸ§ͺ Testing

Backend

npm run test
  • Jest + Supertest for integration tests

Frontend

ng test
  • Angular TestBed / Karma for unit tests
  • Cypress for end-to-end

πŸ”’ Security Highlights

  • HTTPS-ready setup
  • Helmet, CORS, rate limiting
  • Strong password hashing (bcrypt 12 rounds)
  • JWT rotation and short expiry
  • Secure cookie handling for refresh tokens
  • Input validation with express-validator
  • Prevents NoSQL injection and XSS via sanitization

🧰 CI/CD

  • GitHub Actions or Render auto-deploy
  • Run backend tests on push
  • Auto build & deploy frontend to Vercel
  • Environment variables configured via dashboard

πŸš€ Deployment

Frontend

  • Deployed on Vercel
  • Zero-config Angular build (ng build --configuration production)

Backend

  • Deployed on Render
  • Environment variables configured in Render Dashboard
  • HTTPS, CORS allowed from frontend domain only

πŸͺ„ Demo (optional)


🧩 Architecture Overview

flowchart TD
A[Angular Frontend] -->|HTTP / JWT| B[Express API]
B --> C[(MongoDB Atlas)]
B --> D[Auth Middleware]
D -->|Access Control| E[Admin/Manager Routes]
Loading

🧠 References


πŸ‘€ Author

Robin Joseph
πŸ“§ robinjo1776@gmail.com
πŸ”— GitHub: RobinJosephDev

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published