Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏬 API Ecoverse 🏬

Vercel Deploy GitHub release GitHub license

GitHub last commit Code Size

Node.js Node.js

📑 Table of Contents

📖 Overview

The Ecoverse API is a robust back-end service built to manage product catalogs persistently through a JSON file-based database system.

The project was developed with a focus on Clear Architecture, using MSC (Model-Service-Controller) architecture. This ensures that business logic is encapsulated in the Service layer, while the Model handles data persistence and the Controller manages the request/response flow.

🛠 Technologies

The following technologies were used to build this project:

  • Node.js

  • Express

  • CORS

  • Layered Architecture: Folder-based organization to decouple concerns and responsibilities.

  • MSC (Model-Service-Controller): Architectural pattern that decouples business logic (Service) from data access (Model) and request handling (Controller), ensuring high maintainability and testability.

  • ES Modules (ESM): Native import/export support and absolute path resolution via import.meta.url.

  • Environment Variables: Environment-specific configuration using dotenv for better security and flexibility.

  • RBAC (Role-Based Access Control): Granular access control with ADMIN and CUSTOMER roles.

  • Secure Authentication: Password hashing using bcrypt and stateless session management with JWT.

  • Data Integrity: Migration scripts to normalize and maintain legacy JSON data.

🚀 Demo

Coming soon

📦 Install and Use

Prerequisites: Node.js (v22.x) or higher installed.

  1. Clone the repository:
git clone https://github.com/Epiled/api-ecoverse.git
cd api-ecoverse
  1. Install the dependencies:
npm install
  1. Run the development environment (Server):
npm run start

or

npm run dev

📡 Endpoints

🔐 Authentication

Method Endpoint Description
POST /api/auth/login Authenticate user and receive JWT Token

👤 Users

Method Endpoint Description
GET /api/users List all users
GET /api/users/:id Get user by ID
POST /api/users Register a new user
PATCH /api/users/:id Update user data
DELETE /api/users/:id Remove a user

📦 Products

Method Endpoint Description
GET /api/products List all products
POST /api/products Create a new product (Automatic UUID generation)
PATCH /api/products/:id Partial product update
DELETE /api/products/:id Remove a product from the catalog

📁 Categories

Method Endpoint Description
GET /api/categories List all categories
GET /api/categories/:id Get category by ID
POST /api/categories Create a new category
PATCH /api/categories/:id Update category details
DELETE /api/categories/:id Delete a category

📂 Subcategories

Method Endpoint Description
GET /api/subcategories List all subcategories
GET /api/subcategories/:id Get subcategory by ID
POST /api/subcategories Create a new subcategory
PATCH /api/subcategories/:id Update subcategory details
DELETE /api/subcategories/:id Delete a subcategory

Example of Product Object:

{
  "id": "a8155895-b643-41d7-8ecb-d725f5a314c3",
  "productName": "Iphone 11 PRO MAX",
  "price": 15000,
  "category": "technology",
  "subcategory": "phone",
  "createdAt": "2026-05-10T20:00:00.000Z",
  "updatedAt": "2026-05-10T20:45:00.000Z"
}

📂 File Structure

Below is the project architecture. All development should be done inside the src/ folder.

api-ecoverse/
├── docs/               # API documentation and Postman collections
├── scripts/            # Migration and database normalization tools
├── src/                # API source code
│   ├── constants/      # Global constants and static values
│   ├── controllers/    # Request processing logic
│   ├── db/             # Data storage (JSON)
│   │   ├── categories.json
│   │   ├── products.json
│   │   ├── subcategories.json
│   │   └── users.json
│   ├── middlewares/    # Authentication (JWT) and Role validation logic
│   ├── models/         # Data access and business logic
│   ├── routes/         # Endpoint definitions
│   ├── services/       # Reusable business logic and data processing
│   └── app.js          # Express configuration
├── .env.example        # Environment variables template
├── server.js           # Server initialization (Entry point)
├── vercel.json         # Vercel deployment settings
└── package.json        # Dependencies and scripts

👨‍💻 Author and Contact

Felindo
Felipe De Andrade

Made with ❤️ by Felipe De Andrade 👋🏽 Get in touch!

LinkedIn CodePen Gmail

About

A robust and lightweight REST API for product catalog management. Built with Node.js, Express, and MSC architecture using JSON-based persistence.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages