Mobildata-server
Collecting, storing, processing and visualizing data from smart phones
This codebase was created to demonstrate a fully fledged fullstack application built with Kotlin + Spring including CRUD operations, authentication, routing, pagination, and more.
We've gone to great lengths to adhere to the Kotlin + Spring community styleguides & best practices.
For more information on how to this works with other frontends/backends, head over to the RealWorld repo.
Mobil Client
TODO
Collected data types
TODO
API
The Rest API documentation can be found on http://<IP-address>:8080/v2/api-docs
after
deploying and running the server. The Swagger UI is here: http://<IP-address>:8080/swagger-ui.html
The Json description is produced with Swagger
Architecture
The application uses Spring (Web, Data, AOP, Cache) and the Kotlin language.
+ client/
Some feign clients for testing
+ exception/
Exceptions by the application
+ jwt/
AOP advice that check for authentication using a defined @ApiKeySecured operation
+ model/
+ inout/
Object for REST in/out operations
JPA models
+ repository/
Spring repositories
+ service/
Spring services
+ web/
Spring controllers
- ApiApplication.kt <- The main class
Security
Instead of using Spring Security to implement an authenticator using JWT, I created a simple AOP advice that checks
the Authorization
header and put the user to be found in a ThreadLocal
(see UserService
).
The secret key and jwt issuer are stored in application.properties
.
Database
It uses PostgreSQL database.
Build and run
Before running the server, a database has to be configured. With the current configuration, a PostgreSQL database
is configured at the following url: jdbc:postgresql://localhost:5432/mobildata
You need Java and maven installed. Build & run the server with the following command:
mvn spring-boot:run