A Spring Boot 2.7 REST API for managing freight forwarding operations — carriers, manufacturers, trucks, trailers, drivers, cargo, and delivery contracts.
Live Demo: https://zaricu22.github.io/ForwardingAgentAngular/
Source: https://github.com/zaricu22/ForwardingAgentAngular
| Technology | |
|---|---|
| Language | Java 17 |
| Framework | Spring Boot 2.7.3 |
| Persistence | Spring Data JPA + PostgreSQL (CockroachDB in production) |
| Build | Maven |
| Containerization | Docker |
| Deploy | Render |
Schema and seed data scripts are in docs/db/:
| File | Purpose |
|---|---|
forwarder_init.sql |
Creates the forwarder database, public schema, and all tables |
forwarder_seed-data.sql |
Sample manufacturers, carriers, cargo, trucks, trailers, drivers, and contracts |
Run forwarder_init.sql first (as superuser to create the database), then forwarder_seed-data.sql.
Seed users
Username Password Role aaaaCARRIER bbbbMANUFACTURER hjkhjkMANUFACTURER
- Java 17+ —
java --version - Maven — or use the included
./mvnwwrapper
git clone https://github.com/zaricu22/ForwardingAgentBackendSpring.git
cd ForwardingAgentBackendSpring| Variable | Description | Example |
|---|---|---|
DB_URL |
PostgreSQL JDBC connection URL | jdbc:postgresql://localhost:5432/forwarder |
DB_USERNAME |
Database username | admin |
DB_PASSWORD |
Database password | secret |
./mvnw spring-boot:runThe application starts on http://localhost:8080/Transport.
Render is configured via the dashboard: Branch main, Dockerfile Path ./Dockerfile, Auto-Deploy: On Commit.
When a new commit is pushed to main, Render detects it, runs docker build using the Dockerfile, and redeploys the service.
The Dockerfile performs a full Maven build inside the container:
- Dockerfile — builds the JAR from source using
maven:3.9-eclipse-temurin-17-alpineand runs it on a slim JRE image
| Method | Path | Description |
|---|---|---|
POST |
/auth/login |
Login and receive credentials |
POST |
/auth/register |
Register a new user |
POST |
/auth/credExist |
Check if credentials already exist |
| Method | Path | Description |
|---|---|---|
GET |
/carr/getCarrier/{id} |
Get carrier by ID |
GET |
/carr/deliveryAll/{id} |
All deliveries for a carrier |
GET |
/carr/truckNum |
Total truck count |
GET |
/carr/truckAll/{idPrevoznik} |
All trucks for a carrier |
GET |
/carr/truckPage |
Paginated truck list |
GET |
/carr/trailerAll/{idPrevoznik} |
All trailers for a carrier |
GET |
/carr/trailerNum |
Total trailer count |
GET |
/carr/trailerPage |
Paginated trailer list |
GET |
/carr/driverNum |
Total driver count |
GET |
/carr/driverPage |
Paginated driver list |
POST |
/carr/createTruck/{idPrevoznik} |
Add a truck to a carrier |
PUT |
/carr/updateTruck |
Update truck details |
DELETE |
/carr/deleteTruck/{id} |
Delete a truck |
POST |
/carr/createTrailer/{idPrevoznik} |
Add a trailer to a carrier |
PUT |
/carr/updateTrailer |
Update trailer details |
DELETE |
/carr/deleteTrailer/{id} |
Delete a trailer |
POST |
/carr/createDriver/{idPrevoznik} |
Add a driver to a carrier |
PUT |
/carr/updateDriver |
Update driver details |
DELETE |
/carr/deleteDriver/{id} |
Delete a driver |
GET |
/carr/truckAge/{id} |
Average truck age for a carrier |
GET |
/carr/deliverySuccess/{id} |
Successful delivery rate |
GET |
/carr/salaryByMonth/{id} |
Monthly salary stats |
GET |
/carr/jobsByMonth/{id} |
Monthly job count |
| Method | Path | Description |
|---|---|---|
GET |
/manu/getManufacturer/{id} |
Get manufacturer by ID |
GET |
/manu/cargoAll/{id} |
All cargo for a manufacturer |
GET |
/manu/deliveryAll/{id} |
All deliveries for a manufacturer |
GET |
/manu/truckNum |
Total available truck count |
GET |
/manu/truckPage |
Paginated available trucks |
GET |
/manu/trailerNum |
Total available trailer count |
GET |
/manu/trailerPage |
Paginated available trailers |
GET |
/manu/driverAll |
All drivers |
GET |
/manu/driverJobs |
Driver job summaries |
GET |
/manu/driverJobsNum/{id} |
Job count for a driver |
GET |
/manu/goodsQuantityByMonth/{id} |
Monthly goods quantity |
GET |
/manu/deliveryCostsByMonth/{id} |
Monthly delivery costs |
GET |
/manu/cargoByType/{id} |
Cargo grouped by type |
src/main/java/app/
├── controllers/ # REST controllers (AuthController, CarrierController, ManufacturerController)
├── entities/ # JPA entities (Korisnik, Kamion, Prevoznik, Vozac, Ugovor, ...)
└── repositories/ # Spring Data repositories
docs/db/
├── forwarder_init.sql
└── forwarder_seed-data.sql