estate-server

GitHub release (latest SemVer including pre-releases) GitHub tag (latest by date) GitHub repo size

GitHub

Estate-Server

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.

Getting Started

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.

Prerequisites

What things you need to install the software and how to install them

You will need for this project :

The database and minio server

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.

What you will found

Environment variables

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
...

Running and stopping the database and the minio server with docker compose

Installing the project

A step by step series of examples that tell you how to get a development env running

Getting started with the API

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 fair warning :

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

About the security

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.

Running the tests - currently not implemented

The only test implemented are unit tests for spring starting purpose. Unit test are not on the scope of this project.

Break down into end-to-end tests - currently not implemented

End to end or integration tests are not on the scope of this project.

Deployment -currently not implemented

Add additional notes about how to deploy this on a live system

Built With

Contributing

ThomasBTR