{"id":25633775,"url":"https://github.com/arakakimath/order-logistics-api","last_synced_at":"2026-02-27T17:48:07.512Z","repository":{"id":278299832,"uuid":"931011755","full_name":"arakakimath/order-logistics-api","owner":"arakakimath","description":"Last challenge of Rocketseat Node.js course, in which the student has to develop an api, for a ficticious delivery company called FastFeet, to manage related issues","archived":false,"fork":false,"pushed_at":"2025-03-14T16:32:09.000Z","size":426,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-19T12:39:15.128Z","etag":null,"topics":["apprunner","aws","ci-cd","clean-architecture","ddd","docker","ecr","iac-terraform","mongodb","mongoose","nestjs","nodejs","semantic-release","solid-principles","swagger","tdd","test","typescript","vitest","zod"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arakakimath.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-11T15:24:32.000Z","updated_at":"2025-03-14T16:32:11.000Z","dependencies_parsed_at":"2025-07-07T16:37:26.922Z","dependency_job_id":"760bb198-1de9-43e6-9c90-f182cc9906bb","html_url":"https://github.com/arakakimath/order-logistics-api","commit_stats":null,"previous_names":["arakakimath/order-logistics-api"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/arakakimath/order-logistics-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arakakimath%2Forder-logistics-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arakakimath%2Forder-logistics-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arakakimath%2Forder-logistics-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arakakimath%2Forder-logistics-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arakakimath","download_url":"https://codeload.github.com/arakakimath/order-logistics-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arakakimath%2Forder-logistics-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29907096,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T17:28:36.873Z","status":"ssl_error","status_checked_at":"2026-02-27T17:28:20.970Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apprunner","aws","ci-cd","clean-architecture","ddd","docker","ecr","iac-terraform","mongodb","mongoose","nestjs","nodejs","semantic-release","solid-principles","swagger","tdd","test","typescript","vitest","zod"],"created_at":"2025-02-22T22:29:41.364Z","updated_at":"2026-02-27T17:48:07.494Z","avatar_url":"https://github.com/arakakimath.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Order Logistics API 🚛  \n\nThe **Order Logistics API** is the final challenge of Rocketseat's Node.js course, designed for managing deliveries in a fictional company called **FastFeet**. It provides features for **user authentication**, **order tracking**, **delivery management**, and **recipient notifications**, following best practices like **Clean Architecture, DDD, and TDD**.  \n\nThe project is built with **NestJS, TypeScript, MongoDB**, and **Docker**, ensuring **scalability and maintainability**. It uses **JWT authentication** with **public/private key encryption**, and the infrastructure is deployed using **AWS AppRunner** with a fully automated **CI/CD pipeline**.  \n\nThe API supports **role-based access control**, allowing **admins to manage deliveries** while **delivery personnel handle pickups and drop-offs**. It also includes a robust **testing suite** and **Swagger documentation** for easy integration.\n\n## 📌 Table of Contents\n\n- [🔍 About the Project](#about)  \n- [🚀 Technologies](#technologies)  \n- [⚙️ Getting Started](#getting-started)  \n- [🔑 Environment Variables](#env-vars)  \n- [✅ Functional Requirements](#functional-requirements)  \n- [📜 Business Rules](#business-rules)\n- [🧪 Running Tests](#running-tests)  \n- [🔗 API Endpoints](#api-endpoints)  \n- [🤝 Contributing](#contributing)  \n- [📜 License](#license)  \n- [📩 Contact](#contact)  \n\n---\n\n## 🔍 About the Project \u003ca id=\"about\"\u003e\u003c/a\u003e \n\nThe Order Logistics API is a system designed to manage deliveries for a fictitious company called FastFeet. It allows administrators to manage orders, delivery personnel, and recipients while providing delivery personnel with tools to track and complete deliveries efficiently.\n\nThe API includes authentication, role-based access control, order tracking, and notifications for recipients when an order's status changes.\n\n## 🚀 Technologies \u003ca id=\"technologies\"\u003e\u003c/a\u003e \n\n### **Tech Stack \u0026 Tools**\n\n- **🟢 NestJS (Express)** – Modular and structured Node.js framework for building efficient and scalable server-side applications.  \n- **📌 TypeScript** – Statically typed JavaScript for enhanced code quality and maintainability.  \n- **🍃 MongoDB + Mongoose** – NoSQL database with a schema-based ORM for flexible and scalable data persistence.  \n- **🐳 Docker** – Containerized infrastructure for consistent development and deployment environments.  \n- **📦 Clean Architecture** – Separation of concerns for a modular, testable, and scalable codebase.  \n- **🔐 JWT Authentication (ES256)** – Secure user authentication using private/public key encryption and ECDSA algorithm.  \n- **🛡️ Zod** – Schema-based validation for environment variables, request body, query, and params.  \n- **🧪 Vitest + Supertest** – Unit and integration testing for ensuring API reliability and robustness.  \n- **📝 ESLint** – Code formatting and linting for maintaining consistent code quality.  \n- **🔑 bcryptjs** – Password hashing and comparison for secure authentication.  \n- **📄 Swagger** – API documentation for easy testing and integration.  \n- **🚀 Semantic Release** – Automated versioning and changelog generation for streamlined releases.  \n- **🔗 OAuth 2.0 with GitHub** – Secure authentication via GitHub using OAuth 2.0 for user login.\n\n### **Infrastructure \u0026 Deployment**\n\n- **☁️ AWS ECR (Elastic Container Registry)** – Secure storage for Docker images.  \n- **🚦 AWS AppRunner** – Fully managed service for deploying containerized applications.  \n- **🛠️ Infrastructure as Code (IaC)** – Automated provisioning and management of AWS resources using IAM roles.  \n- **🔗 CI/CD Pipeline** – Automated workflow from code push to deployment:  \n  - **Push to Main (PR)** → **GitHub Actions** → **Docker Build** → **AWS ECR** → **AWS AppRunner**.\n\n### **Development Principles**\n\n- **🧩 Domain-Driven Design (DDD)** – Focus on core business logic and domain models.  \n- **🧪 Test-Driven Development (TDD)** – Write tests before implementation to ensure reliability.  \n- **🔧 SOLID Principles** – Design patterns for maintainable and scalable code.  \n- **📂 Modular Codebase** – Organized and reusable components for easier maintenance.\n\n## ⚙️ Getting Started \u003ca id=\"getting-started\"\u003e\u003c/a\u003e \n\n### Prerequisites  \n\nTo run this project, you need:  \n- 🐳 **[Docker](https://www.docker.com/)** – Runs the entire application (MongoDB and the built API image)  \n\n### Installation  \n\n1️⃣ Clone this repository:  \n`git clone https://github.com/your-username/order-logistics-api.git`  \n\n2️⃣ Enter the project directory:  \n`cd order-logistics-api`  \n\n3️⃣ Install dependencies:  \n`npm install`  \n\n### Running the Project  \n\n1️⃣ Start the services with Docker:  \n`docker-compose up -d`  \n\n2️⃣ Make HTTP requests to the base URL [http://localhost:3333](http://localhost:3333)\n\n## 🔑 Environment Variables \u003ca id=\"env-vars\"\u003e\u003c/a\u003e \n\n```\nPORT=3333\nNODE_ENV=\"dev\"\n\n# Database\nDATABASE_URL=\"mongodb://mongodb:docker@localhost:27017/order-logistics?authSource=admin\"\n\n# JWT Secrets =\u003e Generate ECDSA private key and then public key\nJWT_PRIVATE_KEY=\"jwt_ec_key\"\nJWT_PUBLIC_KEY=\"jwt_ec_public_key\"\n\n# Auth with GitHub\nGITHUB_CLIENT_ID=\"someID\"\nGITHUB_CLIENT_SECRET=\"someSecret\"\n```\n\n## ✅ Functional Requirements \u003ca id=\"functional-requirements\"\u003e\u003c/a\u003e \n\n- [x] Application must have two roles for users: admin and/or delivery person  \n- [x] It should be possible to sign in with CPF (National ID) and password  \n- [x] It should be possible to perform the CRUD of the delivery people  \n- [ ] It should be possible to perform the CRUD of the orders  \n- [ ] It should be possible to perform the CRUD of the recipients  \n- [ ] It should be possible to flag an order as awaiting (Available for pickup)  \n- [ ] It should be possible to pickup an order  \n- [ ] It should be possible to flag an order as delivered  \n- [ ] It should be possible to flag an order as returned  \n- [ ] It should be possible to list orders whose delivery addresses are close to the delivery person  \n- [x] It should be possible to change user's password  \n- [ ] It should be possible to list user's orders  \n- [ ] It should be possible to notify recipient on every order status change  \n\n## 📜 Business Rules \u003ca id=\"business-rules\"\u003e\u003c/a\u003e \n\n- [x] Only admin users can perform CRUD of the delivery people  \n- [ ] Only admin users can perform CRUD of the orders  \n- [ ] Only admin users can perform CRUD of the recipients  \n- [ ] A photo is needed to flag an order as delivered  \n- [ ] Only the delivery person who picked up the order can flag it as delivered  \n- [x] Only admin users can change an user's password  \n- [ ] It should not be possible for a delivery person to list another one's orders  \n\n## 🧪 Running Tests \u003ca id=\"running-tests\"\u003e\u003c/a\u003e  \n\nRun unit tests with:  \n\n```bash\nnpm test\n```  \n\nRun end-to-end (e2e) tests with:  \n\n```bash\nnpm run test:e2e\n```    \n\n## 🔗 API Endpoints \u003ca id=\"api-endpoints\"\u003e\u003c/a\u003e \n\n### Register delivery person - [POST] /users\n\n### Authenticate login - [POST] /auth\n\n### Authenticate with GitHub (OAuth 2.0) - [GET] /auth/github\nRedirects users to authorization github page and then to /auth/github/callback, which can link github with already created users or login into API  \n\n## 🤝 Contributing \u003ca id=\"contributing\"\u003e\u003c/a\u003e  \n\nWant to contribute? Follow these steps:  \n\n1. Fork the repository.  \n2. Create a new branch: `git checkout -b feature-branch`.  \n3. Make your changes and commit: `git commit -m \"Added new feature\"`.  \n4. Push to your fork: `git push origin feature-branch`.  \n5. Open a Pull Request.  \n\n## 📜 License \u003ca id=\"license\"\u003e\u003c/a\u003e  \nThis project is under the **MIT License** – see the [LICENSE](https://opensource.org/license/MIT) file for details.  \n\n## 📩 Contact \u003ca id=\"contact\"\u003e\u003c/a\u003e  \nFor support or inquiries, contact:  \n\n- **Email:** arakakimath@gmail.com  \n- **LinkedIn:** [Matheus Arakaki](https://linkedin.com/in/arakakimath)  \n- **GitHub:** [@arakakimath](https://github.com/arakakimath)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farakakimath%2Forder-logistics-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farakakimath%2Forder-logistics-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farakakimath%2Forder-logistics-api/lists"}