SerVB / e-shop

A project to learn modern web technologies. MIT licence

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

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

Stages

1. 2020.02.08

Rest API:

  • Create a product.
  • Remove a product.
  • Return a list of products.
  • Return a product.
  • Edit a product.

"Product" entity:

  • Name.
  • ID.
  • Type.

Extra points:

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

2. 2020.02.15

  • Data storage in DB.

3. 2020.03.01

  • Docker-compose.

4. 2020.03.01

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

7. 2020.04.14

  • Replace token validation to gRPC variant.
  • Make protobuf files shared (extract to a module).
  • Hash passwords in storage.
  • 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.

About

A project to learn modern web technologies. MIT licence


Languages

Language:Kotlin 99.4%Language:Dockerfile 0.6%