{"id":29492594,"url":"https://github.com/valentinocarmonas/logistic_network","last_synced_at":"2026-05-04T20:35:44.945Z","repository":{"id":304565275,"uuid":"1019035187","full_name":"ValentinoCarmonaS/Logistic_Network","owner":"ValentinoCarmonaS","description":"Development of a RESTful API microservice for logistics network optimization with graphs","archived":false,"fork":false,"pushed_at":"2025-07-13T21:53:15.000Z","size":272,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-13T23:34:37.107Z","etag":null,"topics":["api","api-rest","graph","graph-algorithms","java","microservice","postgresql","restfull-api","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ValentinoCarmonaS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-07-13T15:43:11.000Z","updated_at":"2025-07-13T21:53:18.000Z","dependencies_parsed_at":"2025-07-13T23:44:49.607Z","dependency_job_id":null,"html_url":"https://github.com/ValentinoCarmonaS/Logistic_Network","commit_stats":null,"previous_names":["valentinocarmonas/logistic_network"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ValentinoCarmonaS/Logistic_Network","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinoCarmonaS%2FLogistic_Network","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinoCarmonaS%2FLogistic_Network/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinoCarmonaS%2FLogistic_Network/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinoCarmonaS%2FLogistic_Network/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ValentinoCarmonaS","download_url":"https://codeload.github.com/ValentinoCarmonaS/Logistic_Network/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinoCarmonaS%2FLogistic_Network/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265443205,"owners_count":23766365,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["api","api-rest","graph","graph-algorithms","java","microservice","postgresql","restfull-api","spring-boot"],"created_at":"2025-07-15T15:27:53.713Z","updated_at":"2026-05-04T20:35:44.897Z","avatar_url":"https://github.com/ValentinoCarmonaS.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RESTful API for Logistics Network Optimization with Graphs\n\nThis project is a backend microservice developed with Spring Boot that implements graph theory algorithms for logistics network optimization. Its primary goal is to demonstrate the practical application of complex data structures and algorithms in a modern backend development environment, using a RESTful API and PostgreSQL persistence.\n\n## 🚀 Technologies Used\n\n  * **Programming Language:** Java 17+\n  * **Framework:** Spring Boot 3.5.3\n  * **Database:** PostgreSQL (Neon recommended for cloud setup)\n  * **ORM:** Spring Data JPA / Hibernate\n  * **DB Migration Management:** Flyway\n  * **Validation:** Spring Boot Starter Validation (Hibernate Validator)\n  * **API Documentation:** Springdoc OpenAPI (Swagger UI)\n  * **Build Tool:** Apache Maven\n  * **Task Automation:** Makefile\n  * **Testing:** JUnit 5, Mockito\n\n## ✨ Key Features\n\n  * **Node and Edge Management:** Full CRUD operations to model a logistics network.\n  * **Optimal Path Calculation:** Implementation of shortest path algorithms (Dijkstra and Bellman-Ford) to find the most efficient routes based on distance, time, or cost.\n  * **Connectivity Analysis:** Use of BFS and DFS to explore the network and verify accessibility between points.\n  * **Task Sequencing:** Application of Topological Sort to plan processes with dependencies.\n  * **Network Resilience Analysis:** Identification of Articulation Points and Strongly Connected Components (SCCs) to detect bottlenecks and single points of failure.\n  * **Cost-Efficient Network Design:** Calculation of Minimum Spanning Trees (MST) to optimize infrastructure.\n  * **Data Validation:** Implementation of robust validations for API inputs.\n  * **Database Version Control:** Automatic database schema management with Flyway.\n  * **Interactive Documentation:** API documentation accessible via Swagger UI.\n\n## ⚙️ Prerequisites\n\nBefore you begin, ensure you have the following installed:\n\n  * **Java Development Kit (JDK) 17 or higher**\n  * **Apache Maven 3.x or higher**\n  * **A PostgreSQL instance**.\n  * **`make`** (usually pre-installed on Unix/Linux/macOS systems; for Windows).\n\n---\n\n## 🛠️ Project Setup\n\n### 1. Clone the Repositorybash\n\n``` bash\ngit clone [https://github.com/ValentinoCarmonaS/Logistic_Network.git](https://github.com/ValentinoCarmonaS/Logistic_Network.git)\ncd Logistic_Network\n```\n\n---\n\n### 2. Configuration in `application.properties`\n\nThe project uses `src/main/resources/application.properties` for configuration, including database connection details and other constants. Update this file with your specific settings:\n\n```properties\n# PostgreSQL Database Configuration\nspring.datasource.url=jdbc:postgresql://\u003cyour_db_host\u003e:\u003cyour_db_port\u003e/\u003cyour_db_name\u003e\nspring.datasource.username=\u003cyour_db_username\u003e\nspring.datasource.password=\u003cyour_db_password\u003e\n\n# JPA/Hibernate Properties\nspring.jpa.hibernate.ddl-auto=validate # Use 'validate' with Flyway for schema management\nspring.jpa.show-sql=true # Set to false for production\n\n# Flyway Configuration (optional, Flyway is enabled by default if flyway-core is on classpath)\nspring.flyway.enabled=true\nspring.flyway.baseline-on-migrate=true # Useful for existing databases\n\n# Other constants (example, you can add more as needed)\nserver.servlet.context-path=/api\n```\n---\n\n### 3\\. Database Migrations with Flyway\n\nFlyway will automatically manage the database schema upon application startup. SQL migration scripts are located in `src/main/resources/db/migration/`. Ensure your database is accessible with the credentials provided in the environment variables.\n\n## 🚀 Running the API\n\nYou can build and run the application using Maven directly or via the `Makefile` for convenience.\n\n### Using Maven\n\n1.  **Compile the Project:**\n    ```bash\n    mvn clean install\n    ```\n2.  **Run the Application:**\n    ```bash\n    mvn spring-boot:run\n    ```\n\n### Using Makefile\n\nThe `Makefile` provides quick commands for common operations:\n\n  * **`make build`**: Cleans and compiles the project, generating the JAR file.\n    ```bash\n    make build\n    ```\n  * **`make run`**: Executes the Spring Boot application.\n    ```bash\n    make run\n    ```\n  * **`make test`**: Runs all unit and integration tests.\n    ```bash\n    make test\n    ```\n  * **`make clean`**: Cleans up build artifacts.\n    ```bash\n    make clean\n    ```\n\nThe API will start by default on `http://localhost:8080`.\n\n## 📝 API Endpoints\n\nThe API exposes the following endpoints to interact with the logistics network.\n\n| URL | HTTP Method | Description |\n| :--- | :--- | :--- |\n| `/api/nodos` | `POST` | Creates a new node in the network. |\n| `/api/nodos/{id}` | `GET` | Retrieves details of a specific node. |\n| `/api/nodos/{id}` | `PUT` | Updates details of an existing node. |\n| `/api/nodos/{id}` | `DELETE` | Deletes a node and all associated edges. |\n| `/api/aristas` | `POST` | Creates a new edge between two nodes. |\n| `/api/aristas/{id}` | `GET` | Retrieves details of a specific edge. |\n| `/api/aristas/{id}` | `PUT` | Updates details of an existing edge. |\n| `/api/aristas/{id}` | `DELETE` | Deletes an edge. |\n| `/api/rutas/optima` | `GET` | Calculates the most optimal route between an origin and a destination, based on a criterion (distance, time, cost). Parameters: `origen`, `destino`, `criterio`. |\n| `/api/grafos/alcanzables/bfs` | `GET` | Performs a BFS traversal from an origin node and returns reachable nodes. Parameter: `origen`. |\n| `/api/grafos/alcanzables/dfs` | `GET` | Performs a DFS traversal from an origin node and returns reachable nodes. Parameter: `origen`. |\n| `/api/grafos/orden_topologico` | `GET` | Calculates a topological sort of the graph (if it's a DAG). |\n| `/api/grafos/puntos_articulacion` | `GET` | Identifies articulation points in the graph. |\n| `/api/grafos/sccs` | `GET` | Identifies strongly connected components in the directed graph. |\n| `/api/grafos/mst` | `GET` | Calculates the Minimum Spanning Tree of the graph. |\n\n## 💡 Usage Examples\n\nBelow are examples of how to interact with the API using `curl`. Ensure the API is running.\n\n### 1\\. Create a Node\n\n```bash\ncurl -X POST \"http://localhost:8080/api/nodos\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n  \"nombre\": \"Central Warehouse\",\n  \"latitud\": 40.7128,\n  \"longitud\": -74.0060,\n  \"tipo\": \"Warehouse\"\n}'\n```\n\n### 2\\. Get a Node by ID\n\nAssuming the ID of the created node is `a1b2c3d4-e5f6-7890-1234-567890abcdef`:\n\n```bash\ncurl -X GET \"http://localhost:8080/api/nodos/a1b2c3d4-e5f6-7890-1234-567890abcdef\"\n```\n\n### 3\\. Create an Edge\n\nAssuming you have two nodes with IDs `origin_id` and `destination_id`:\n\n```bash\ncurl -X POST \"http://localhost:8080/api/aristas\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n  \"origenId\": \"origin_id\",\n  \"destinoId\": \"destination_id\",\n  \"distanciaKm\": 15.5,\n  \"tiempoMin\": 20.0,\n  \"costoEur\": 5.25,\n  \"dirigida\": true,\n  \"descripcion\": \"Main Route\"\n}'\n```\n\n### 4\\. Calculate Optimal Route (Dijkstra/Bellman-Ford)\n\nAssuming you have node IDs `origin_id` and `destination_id`:\n\n```bash\ncurl -X GET \"http://localhost:8080/api/rutas/optima?origen=origin_id\u0026destino=destination_id\u0026criterio=tiempoMin\"\n```\n\nValid criteria are: `distanciaKm`, `tiempoMin`, `costoEur`.\n\n### 5\\. Connectivity Exploration (BFS)\n\n```bash\ncurl -X GET \"http://localhost:8080/api/grafos/alcanzables/bfs?origen=origin_id\"\n```\n\n### 6\\. Get Articulation Points\n\n```bash\ncurl -X GET \"http://localhost:8080/api/grafos/puntos_articulacion\"\n```\n\n## 🧪 Testing\n\nTo run the project's unit and integration tests, use the following command:\n\n```bash\nmake test\n```\n\nOr directly with Maven:\n\n```bash\nmvn test\n```\n\n## 📄 API Documentation (Swagger UI)\n\nOnce the application is running, you can access the interactive API documentation via Swagger UI in your browser:\n\n[http://localhost:8080/swagger-ui.html](https://www.google.com/search?q=http://localhost:8080/swagger-ui.html)\n\nHere you can see all available endpoints, their parameters, data models, and test requests directly from the interface.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinocarmonas%2Flogistic_network","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalentinocarmonas%2Flogistic_network","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinocarmonas%2Flogistic_network/lists"}