A Spring Boot application providing secure monitoring and fortification services with JWT authentication, PostgreSQL persistence, and containerised deployment.
Ensure you have the following installed:
- Docker & Docker Compose (recommended for hassle-free setup)
- Java Development Kit (JDK) 21 (required for local development only)
- Apache Maven (required for local development only)
- PostgreSQL (only if running the database locally without Docker)
The easiest way to get up and running:
-
Clone the repository:
git clone https://github.com/Youssef-codin/smf.git cd smf -
Start the application:
docker compose up --build
This command will build and start both the PostgreSQL database and Spring Boot application containers.
-
Access the application:
- Application: http://localhost:8080
- API Documentation: http://localhost:8080/api-docs
-
Stop the application:
docker compose down
To remove all data volumes as well:
docker compose down -v
Requires PostgreSQL installed locally.
-
Create and configure the database:
createdb smf
-
Update
src/main/resources/application.properties:spring.datasource.url=jdbc:postgresql://localhost:5432/smf spring.datasource.username=your_username spring.datasource.password=your_password
-
Run the application:
mvn spring-boot:run
Note: The application runs on port 8000 locally.
- Access: http://localhost:8000
Best for local development and debugging with minimal setup.
-
Start only the database container:
docker compose up db -d
-
Update
src/main/resources/application.properties:spring.datasource.url=jdbc:postgresql://localhost:5431/smf spring.datasource.username=smf spring.datasource.password=smf
-
Run the application locally:
mvn spring-boot:run
Note: The application runs on port 8000 locally.
- Access: http://localhost:8000
View database logs with:
docker compose logs -f db
Core application logic is organised under src/main/java/com/smf:
controller– REST endpoints handling HTTP requestsdto– Data Transfer Objects organized by module (api, auth, device)model– JPA entities mapped to database tablesrepo– Spring Data JPA repository interfacessecurity– JWT utilities, authentication, and authorizationservice– Business logic and service layer orchestrationutil– Utility classes includingAppErrorfor global exception handling
Database schema migrations are managed with Flyway. Migration scripts are located in src/main/resources/db/migration/.
Note: Flyway is configured, however, we are not using it in development. The application is currently set to use Hibernate's create-drop feature for schema management during development.
The API specification is available in OpenAPI 3.0 format:
- Docker: http://localhost:8080/api-docs
- Local: http://localhost:8000/api-docs
You can view the raw JSON schema directly in your browser or import it into tools like Postman, Insomnia, or any OpenAPI-compatible client for interactive API exploration and testing.
- API Responses – All responses must use the
ApiResponseclass - API Prefix – All controllers must be mapped under
/api/v1 - Exception Handling – All exceptions must be handled by
GlobalExceptionHandlerusingAppError - Branching – Always work on a new feature branch, never commit directly to
main - Commit Messages – Keep them clear and descriptive
- Example:
feature: add device registration
- Example:
- Code Review – Contact Youssef for review before merging to
main