Technical Description

Our app is a basic store, in this case an eBook store. Logic and architecture starts in database.
Three main database tables are Book, Shopping List and Store User.
There are 2 tables connected with Book: Genre table, where are book genres, and Image table, that holds book images in bytea.
Shopping list table connects Book and User via Book ID and User ID. We use Postgres database that runs in a Docker container.

Backend uses repository-service-controller pattern to exchange data between database and client. All books are passed to database as an entity (class Book).
All books are given to client as DTO (class BookResponse), that contains image bytes and genre as string. Each database entity has an appropriate repository.
All repositories communicate with services. Services communicate with controllers.
Genre service-controller makes it possible to add genres and retrieve them. Book service-controller takes books in and also takes in appropriate image.
BookResponse service-controller is used to pass information to client. BookSearch and BookSorting service-controller manage book search and sorting.
Gradle is used as build automation tool, and Liquibase is used as database migration tool. For backend we use Spring Boot.

Frontend communicates with backend via HTTP. Client sends HTTP requests and recieves HTTP responses.
Vue is used as the frontend framework. In order to make website responsive and work well in mobile also, we used BootstrapVue. UI is divided into components. Components get their data with help of Axios library, used for making HTTP requests to the server. Objects between back and front end are passed and received as a JSON, images as multipart file.

Backend is secured with help of spring security. There are three roles in application: guest, user and admin. Some endpoints are available for all (guests) and some are secured, so only user with certain authority can attach them. We use JWT for authentication. When user logs in, a token (contains encrypted info about user) is generated, passed to frontend, and saved in backend (added to "allowlist"). When hitting protected endpoint user must add authorization header that contains token. Admin user is hard-coded in backend. Client is able to register as a user.

To make sign up and sign in possible for users, frontend forms were created. Frontend keeps JWT in local storage. Upon logout the token is cleared from frontend. Also session gets invalidated to prevent old tokens from being reused to perform requests (token is deleted from "allowlist").

To serve it online an AWS web server is used. The website is automatically deployed from git repositories.
The Spring app runs straight from Docker but the Node app is running on nginx.
For domain support a domain from FreeNom is used and Cloudflare is used to have https (sometime).