A Spring Boot REST API for managing smart waste collection operations.
The system coordinates bins, trucks, and collection routes through a unified API built on top of a generic Object model.
| Layer | Technology |
|---|---|
| Language | Java 25 |
| Framework | Spring Boot 4.1.0 |
| Database | PostgreSQL (via Docker Compose) - originally MongoDB, migrated mid-project |
| Build Tool | Gradle 9 |
| API Docs | OpenAPI / Swagger UI |
| Testing | JUnit 5 · AssertJ · TestContainers |
- Docker Desktop (running)
- JDK 25
Start PostgreSQL:
docker compose up -dStart the server:
./gradlew bootRunThe server starts on port 8084.
Swagger UI: http://localhost:8084/swagger-ui.html
For a full production deployment walkthrough (DDL-auto modes, first-run vs. subsequent-run config, seeded demo credentials), see
INSTRUCTIONS.MD.
./gradlew testTests use TestContainers - Docker must be running. The test suite spins up its own isolated PostgreSQL container automatically.
Static vanilla HTML/CSS/JS, served directly by Spring Boot from src/main/resources/static - no build step, no framework, no package.json.
| Page | Purpose |
|---|---|
index.html |
Login |
admin.html |
Admin console |
operator.html |
Operator dashboard |
driver.html |
Driver route view |
static/
├── index.html / admin.html / operator.html / driver.html
├── css/style.css
└── js/
├── core/ - config, HTTP client, session, UI helpers (loaded first)
├── services/ - userService, objectService, commandService (wrap the REST API)
└── pages/ - per-page logic (app, admin, operator, driver)
All endpoints require the API-Version: 1.4 header.
Base path: /ambient-invisible-intelligence
| Method | Path | Description |
|---|---|---|
| POST | /users |
Register a new user |
| GET | /users/login/{systemID}/{userEmail}?password= |
Login |
| PUT | /users/{systemID}/{userEmail}?password= |
Update user profile |
| Method | Path | Description |
|---|---|---|
| POST | /objects?userPassword= |
Create an object (Bin / Truck / Route) |
| GET | /objects/{systemID}/{objectId}?userSystemID=&userEmail=&userPassword= |
Get object by ID |
| GET | /objects?userSystemID=&userEmail=&userPassword=&size=&page= |
Get all objects (paginated) |
| PUT | /objects/{systemID}/{objectId}?userSystemID=&userEmail=&userPassword= |
Update an object |
| PUT | /objects/{parentSystemID}/{parentObjectId}/children?... |
Bind child to parent |
| GET | /objects/{parentSystemID}/{parentObjectId}/children?...&size=&page= |
Get children of an object |
| GET | /objects/{childSystemID}/{childObjectId}/parents?...&size=&page= |
Get parents of an object |
| GET | /objects/search/byAlias/{alias}?... |
Search objects by exact alias |
| GET | /objects/search/byAliasPattern/{pattern}?... |
Search objects by alias pattern |
| GET | /objects/search/byType/{type}?... |
Search objects by type |
| GET | /objects/search/byStatus/{status}?... |
Search objects by status |
| GET | /objects/search/byLocation/{lat}/{lng}/{distance}?units=&... |
Search objects within a distance of a location |
Non-paginated
@Deprecatedvariants of the get-all/children/parents endpoints are also kept for backward compatibility.
| Method | Path | Description |
|---|---|---|
| POST | /commands?userPassword= |
Invoke a command on a target object |
| Method | Path | Description |
|---|---|---|
| DELETE | /admin/users?userSystemID=&userEmail=&userPassword= |
Delete all users |
| DELETE | /admin/objects?... |
Delete all objects |
| DELETE | /admin/commands?... |
Delete all commands |
| GET | /admin/users?...&size=&page= |
Export all users (paginated) |
| GET | /admin/commands?...&size=&page= |
Export all commands history (paginated) |
Non-paginated
@Deprecatedvariants also exist for/admin/usersand/admin/commands.
{
"email": "user@example.com",
"password": "Secur3!",
"role": "END_USER",
"username": "John Doe",
"avatar": "J"
}Roles: ADMIN · OPERATOR · END_USER
Password rules: minimum 5 characters, at least one digit, at least one special character.
{
"userId": { "systemID": "2026b.tal.fridman", "email": "user@example.com" },
"role": "END_USER",
"username": "John Doe",
"avatar": "J"
}{
"id": { "systemID": "2026b.tal.fridman", "objectId": "<uuid>" },
"type": "BIN",
"alias": "Bin on Main St",
"status": "active",
"active": true,
"creationTimestamp": "2026-06-09T12:00:00Z",
"location": { "lat": 32.114, "lng": 34.796 },
"createdBy": { "userId": { "systemID": "2026b.tal.fridman", "email": "user@example.com" } },
"objectDetails": {}
}objectDetails is a free-form map (Map<String, Object>) - there are no dedicated BIN/TRUCK/ROUTE boundary classes, just a type string convention with these commonly-used keys:
BIN objectDetails:
{
"fillLevel": 0,
"binType": "general",
"capacity": 1100,
"address": "123 Main St",
"lastCollected": null,
"status": "active",
"errorStatus": null
}binType: general · plastic · paper · glass · organic
errorStatus: null · damaged · blocked · missed
TRUCK objectDetails:
{
"plateNumber": "12-345-67",
"driverEmail": null,
"driverName": null,
"status": "available",
"currentRouteId": null,
"collectedCount": 0,
"totalCapacity": 8000,
"currentLoad": 0
}ROUTE objectDetails:
{
"assignedTruckId": "truck-uuid",
"assignedDriverEmail": "driver@example.com",
"assignedDriverName": "Driver Name",
"status": "planned",
"binIds": ["bin-uuid-1", "bin-uuid-2"],
"completedBinIds": [],
"scheduledDate": "2026-06-08",
"startedAt": null,
"completedAt": null,
"approvedAt": null
}status: planned · in_progress · returning · completed · cancelled
{
"childId": {
"systemID": "2026b.tal.fridman",
"objectId": "<uuid>"
}
}{
"command": "collectBin",
"targetObject": { "id": { "systemID": "2026b.tal.fridman", "objectId": "<uuid>" } },
"invokedBy": { "userId": { "systemID": "2026b.tal.fridman", "email": "user@example.com" } },
"commandAttributes": {}
}src/test/java/ambient_invisible_intelligence/
├── TestContainersConfiguration.java - shared PostgreSQL container setup
├── admin/
│ └── AdminAndRoleMatrixTests.java - admin endpoints + role/permission matrix
├── apiversion/
│ └── ApiVersionTests.java - API-Version header enforcement
├── commands/
│ └── CommandTests.java - command invocation
├── objects/
│ ├── ObjectCrudTests.java - create, read, update
│ ├── ObjectRelationsTests.java - parent/child binding
│ └── ObjectSearchTests.java - search by alias/type/status/location
├── users/
│ └── UserTests.java - registration, login, update
├── support/
│ ├── BaseIntegrationTest.java - shared base class for integration tests
│ └── TestConstants.java - shared constants
└── rest/ - HTTP client interfaces and config
├── UserApi.java / UserApiConfig.java
├── ObjectApi.java / ObjectApiConfig.java
├── CommandApi.java / CommandApiConfig.java
└── AdminApi.java / AdminApiConfig.java
Database: smartcollect
User: postgres
Password: set via POSTGRES_PASSWORD env var (defaults to "secret")
Managed via compose.yaml and spring-boot-docker-compose - Spring Boot auto-connects on startup, no manual spring.datasource.* config needed.
Originally built on MongoDB; migrated to PostgreSQL mid-project as part of learning relational modeling with JPA/Hibernate.
- Group:
il.ac.afeka.integrative - Version:
1.4 - System ID:
2026b.tal.fridman