As part of the ChâTop project, this is the server part of the project. It is a RESTful API that is used to store and retrieve data from the Estate database protected by a JWT authentication system.
The front part is available here : Estate-Front forked from OpenClassRooms projects.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Get the git repository with the following command :
git clone https://github.com/ThomasBTR/estate-server.git
Go to the docker compose folder
cd docker
Run the following command to start the database and the minio server
docker-compose up -d
Go to the project folder
cd estate-server
Run the following command to install the project
mvn clean install
Run the following command to run the project
mvn spring-boot:run
What things you need to install the software and how to install them
You will need for this project :
To simulate the database and the minio server, we will use docker. Using a docker compose file, I set up the MySql database and a minio server to reproduce an object storage container. The minio server can be replaced by an AWS S3 bucket.
Everything is commented, so you can easily understand what is going on.
...
estate:
jwt:
expiration: 86400000 # 1 day
minio:
endpoint: http://localhost # Minio server url
port: 9000 # Minio server port
user: estate-admin # Minio root user
password: estate-minio-secret-key # Minio root password
bucket: estate-images # Minio bucket name
retentionHours: 24 # Minio bucket object retention hours
...
Go to ./docker/, run the following command :
docker-compose up -d
To stop the database and the minio server, run the following command :
docker-compose down
A step by step series of examples that tell you how to get a development env running
To quickly run all maven cycle on this project, run the following command :
mvn clean install
Run the following command to only package the project
mvn clean package
The documentation is based on the spring doc specification.
Configured endpoints are defined in the application.yaml as follows :
springdoc:
api-docs:
path: /api/v1/docs
swagger-ui:
path: /swagger-ui
A specific endpoint is defined in configuration to get the documentation of the API out of the security scope. This is done only for demonstration purpose, in a real world application, the documentation should be secured.
The documentation path is defined per se in spring-doc specification of the swagger-ui and api-docs endpoints.
For example, if you run on your machine without changing the server port, the documentation will be available here: http://localhost:3001/swagger-ui/index.html and you will get the API documentation from this link : http://localhost:3001/api/v1/docs
The security is based on spring security and JWT.
The security is configured in the SecurityConfig class. The security is configured to allow access to the documentation endpoints and the authentication endpoint. To access to the other estate endpoints, you will need to be an authenticated users. This is verified at each request with JWT token given in the Authorization header.
The only test implemented are unit tests for spring starting purpose. Unit test are not on the scope of this project.
mvn clean test
End to end or integration tests are not on the scope of this project.
Add additional notes about how to deploy this on a live system
ThomasBTR