- 📑 Table of Contents
- 📖 Overview
- 🛠️ Technologies
- 🚀 Demo
- 📦 Install and Use
- 📡 Endpoints
- 📂 File Structure
- 👨💻 Author and Contact
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.
The following technologies were used to build this project:
-
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
dotenvfor better security and flexibility. -
RBAC (Role-Based Access Control): Granular access control with
ADMINandCUSTOMERroles. -
Secure Authentication: Password hashing using
bcryptand stateless session management withJWT. -
Data Integrity: Migration scripts to normalize and maintain legacy JSON data.
Coming soon
Prerequisites: Node.js (v22.x) or higher installed.
- Clone the repository:
git clone https://github.com/Epiled/api-ecoverse.git
cd api-ecoverse- Install the dependencies:
npm install- Run the development environment (Server):
npm run startor
npm run dev| Method | Endpoint | Description |
|---|---|---|
POST |
/api/auth/login |
Authenticate user and receive JWT Token |
| 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 |
| 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 |
| 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 |
| 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 |
{
"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"
}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
Felipe De Andrade
Made with ❤️ by Felipe De Andrade 👋🏽 Get in touch!