- π 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!