Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bachiriy/sensorium

This is a secure REST API for managing an IoT sensor infrastructure, developed using Spring Boot. The platform allows for comprehensive management of IoT devices, measurements, and alerts with role-based access control.
https://github.com/bachiriy/sensorium

api-rest docker spring-security

Last synced: 15 days ago
JSON representation

This is a secure REST API for managing an IoT sensor infrastructure, developed using Spring Boot. The platform allows for comprehensive management of IoT devices, measurements, and alerts with role-based access control.

Awesome Lists containing this project

README

        

# IoT Sensor Monitoring Platform

## Project Overview

This is a secure REST API for managing an IoT sensor infrastructure, developed using Spring Boot. The platform allows for comprehensive management of IoT devices, measurements, and alerts with role-based access control.

## Technologies Used

- **Backend**: Spring Boot
- **Database**: MongoDB
- **Security**: Spring Security, JWT Authentication
- **DevOps**: Docker, Jenkins, GitHub Actions
- **Testing**: JUnit, Mockito
- **Documentation**: Swagger

## Key Features

### Device Management
- List devices with pagination
- Search devices by zone
- Add new devices (admin-only)

### Zone Management
- View zones
- Add new zones (admin-only)

### Measurement Tracking
- Record sensor measurements
- View measurements
- Export measurement data
- Pagination support

### Alert System
- Monitor and track sensor alerts
- Severity-based alert classification
- Temperature and humidity alert thresholds

### User Management
- User registration
- Role-based authentication
- User role management (admin-only)

## Security Specifications

- Stateless JWT Authentication
- Role-based Access Control
- `/api/admin/*` endpoints require ADMIN role
- `/api/user/*` endpoints require USER role
- BCrypt Password Encryption

## Environment Profiles

- Development Profile
- Production Profile

## CI/CD Pipeline

### GitHub Actions
- Automated quick checks:
- Unit testing
- Code syntax validation
- Style and convention checks
- Dependency vulnerability scanning
- Compilation verification

### Jenkins
- Complete build and deployment pipeline
- Docker image generation
- Deployment to Docker Hub

## Development Tools

- Version Control: Git
- Project Management: JIRA (Scrum)
- Code Quality: SonarLint
- API Testing: Postman
- API Documentation: Swagger

## Entity Relationships

- Devices belong to a Zone
- Zones can contain multiple Devices
- Devices can have multiple Measurements
- Devices can generate multiple Alerts

## Alert Thresholds

### Temperature Sensor Alerts
- CRITICAL: < -10°C or > 40°C
- HIGH: -5°C to -10°C or 35-40°C
- MEDIUM: 0°C to -5°C or 30-35°C
- LOW: 25-30°C
- NORMAL: 20-25°C

### Humidity Sensor Alerts
- CRITICAL: < 20% or > 90%
- HIGH: 20-30% or 80-90%
- MEDIUM: 30-40% or 70-80%
- LOW: 40-45% or 65-70%
- NORMAL: 45-65%

## Getting Started

### Prerequisites
- Java 8
- Maven
- Docker
- MongoDB

### Run the application
1. Clone the repository
2. Run `mvn clean package` to generate the jar file
3. Start the application
```bash
docker compose up -d --build
```
- Start interacting with the API at ```localhost:8080/api/*```

> NOTE: run ```docker compose down``` to shutdown the application.

## Testing

- Run unit tests: `mvn test`
- Run integration tests: `mvn verify`

## API Documentation

Access Swagger UI at: `http://localhost:8080/swagger-ui.html`

## Contributing

1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request