Skip to content

DavidZapata1312/fhl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚛 FHL Backend — Warehouse, Product, and Delivery Management

Backend developed in Node.js + TypeScript implementing JWT authentication, role control, and management of users, clients, products, warehouses, and delivery orders.
It uses Sequelize with PostgreSQL as the main database and is fully prepared to run in Docker.


🚀 Main Technologies

  • Node.js + Express.js – Server framework.
  • TypeScript – Static typing.
  • Sequelize (PostgreSQL) – ORM for database handling.
  • bcryptjs – Password encryption.
  • jsonwebtoken (JWT) – Authentication and authorization.
  • dotenv – Environment variables.
  • Nodemon – Auto-reload in development.
  • CORS – HTTP access control.
  • ESLint + Prettier – Code linting and formatting.
  • Docker + Docker Compose – Project containerization.

⚙️ Installation

Clone the repository and enter the directory:

git clone https://github.com/DavidZapata1312/fhl.git
cd fhl

Install dependencies:

npm install

🧩 Main Dependencies

npm install express sequelize pg pg-hstore bcryptjs jsonwebtoken dotenv cors

Development Dependencies

npm install -D typescript ts-node nodemon @types/express @types/node @types/bcryptjs @types/jsonwebtoken @types/cors eslint prettier eslint-config-prettier eslint-plugin-prettier

⚙️ Available Scripts

Command Description
npm run dev Starts the server in development mode with Nodemon
npm run build Compiles TypeScript to JavaScript (dist/ folder)
npm start Runs the compiled version
npm run lint Runs ESLint and Prettier analysis

🏗️ Project Structure

src/
├── config/
│   └── db.ts                 # Sequelize (PostgreSQL) configuration
│
├── controllers/
│   ├── user.controller.ts
│   ├── client.controller.ts
│   ├── product.controller.ts
│   ├── bodega.controller.ts
│   └── delivery.controller.ts
│
├── middleware/
│   ├── auth.ts               # JWT middleware
│   └── rolVerification.ts    # Role-based verification middleware
│
├── models/
│   ├── user.model.ts
│   ├── client.model.ts
│   ├── product.model.ts
│   ├── bodega.model.ts
│   ├── delivery.model.ts
│   └── associations.ts
│
├── routes/
│   ├── user.routes.ts
│   ├── client.routes.ts
│   ├── product.routes.ts
│   ├── bodega.routes.ts
│   └── delivery.routes.ts
│
├── services/
│   ├── user.service.ts
│   ├── client.service.ts
│   ├── product.service.ts
│   ├── bodega.service.ts
│   └── delivery.service.ts
│
├── seed/
│   └── seed.ts               # Initial data seeding
│
├── app.ts                    # Express main configuration
└── server.ts                 # Entry point

🧠 Environment Variables

Create a .env file in the root directory with:

PORT=3000
JWT_SECRET=supersecret
DB_NAME=fhl_db
DB_USER=david
DB_PASSWORD=perla
DB_HOST=localhost
DB_PORT=5432

🐳 Dockerization

🧱 Build image and start containers

docker-compose up --build

🧹 Stop containers

docker-compose down

Service available at: 👉 http://localhost:3000


🧪 Endpoint Testing (Postman)

A Postman collection is included with full CRUD routes for:

  • /auth → JWT login
  • /users → User management (admin only)
  • /clients → Clients
  • /products → Products
  • /bodegas → Warehouses
  • /deliveries → Delivery orders

You can import the collection from the /postman folder.

Recommended Variables:

DB_USER=david
DB_PASSWORD=perla
DB_NAME=fhl_database
DB_HOST=postgres
DB_PORT=5432
JWT_SECRET=mi_super_secreta_clave_1234

🧱 Database Seeding

Run the initial seed with:

npx ts-node src/seed/seed.ts

This will create example users, products, clients, and bodegas.


💡 Recommended VS Code Extensions

  • ESLint
  • Prettier
  • Docker
  • REST Client or Postman

📜 License

Project licensed under MIT License.


✨ Author

Created with ❤️ by David Zapata, Linus
Backend architecture for the logistics management platform (FHL).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors