e-shop icon indicating copy to clipboard operation
e-shop copied to clipboard

A project to learn modern web technologies. MIT licence

Build status Badge Tests status Badge

Docker-compose Badge jdbc postgresql Badge Swagger UI Badge

Kotlin Badge

Exposed Badge gRPC Badge Kotest Badge Ktor Badge Ktor-OpenAPI-Generator Badge Testcontainrs Badge

e-shop

A project to learn modern web technologies – backend for an online shop.

Running in Docker

You can run the project easily using Docker:

docker-compose up

After that, you can check Swagger UI at http://localhost:8080/swagger-ui and http://localhost:8081/swagger-ui for the API description.

Running locally

If you want to check it out locally, you should provide database like this:

docker run -it -e POSTGRES_PASSWORD=123 -e POSTGRES_USER=user -e POSTGRES_DB=mydb -p 5432:5432 postgres:9.6

After this, you can run ./gradlew :product:run and ./gradlew :auth:run. Don't forget about setting env like in docker-compose: DB_USER=user;DB_HOST=localhost;DB_PORT=5432;DB_DB=mydb;DB_PASSWORD=123;AUTH_PORT=8081;AUTH_HOST=localhost.

How does it work

Container diagram

Rules

  • [x] Public repo.
  • [x] Description.
  • [x] Architecture graph.
  • [x] Swagger UI.
  • [x] Docker-compose.

Stages

1. 2020.02.08

Rest API:

  • [x] Create a product.
  • [x] Remove a product.
  • [x] Return a list of products.
  • [x] Return a product.
  • [x] Edit a product.

"Product" entity:

  • Name.
  • ID.
  • Type.

Extra points:

  • [x] Pagination in list of products.
  • [x] Data storage in DB.
  • [x] Versioning.
  • [x] Logging.

2. 2020.02.15

  • [x] Data storage in DB.

3. 2020.03.01

  • [x] Docker-compose.

4. 2020.03.01

  • [x] Registration (via login+password).
  • [x] Auth (change login+password to access+refresh tokens).
  • [x] A way to change a refresh token to new access+refresh tokens.
  • [x] Validation endpoint.
  • [x] Products changing endpoints must be available only with auth tokens.

7. 2020.04.14

  • [x] Replace token validation to gRPC variant.
  • [x] Make protobuf files shared (extract to a module).
  • [x] Hash passwords in storage.
  • [x] Add roles: admin and user.
    • Admin can create, edit, remove, and view products. Also, they can create a new administrator (however, first admin can be created without admin rights).
    • User can view products.