Skip to content

Epiled/api-ecoverse

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

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors