The Online Book Store Application is a web application built with Spring Boot. It uses JWT for authentication and PostgreSQL as the database.
- Ensure you have Java 17 installed on your machine.
- Clone the repository to your local machine.
- Navigate to the project directory.
- Run the command
mvn spring-boot:run
to start the application.
The application uses Spring Boot Starter for easy bootstrapping of the application. It uses Spring Security for authentication and authorization. JWT is used for maintaining the session. The application uses PostgreSQL as the database, and Spring Data JPA for ORM. Lombok is used to reduce boilerplate code. ModelMapper is used for object mapping.
The application exposes several endpoints:
/app/**
and/
: These are accessible to anyone and do not require authentication.- All other endpoints require authentication.
Please note that only authenticated users can access the majority of the endpoints.
The application uses the following dependencies:
- Spring Boot Starter Data JPA
- Spring Boot Starter Security
- Spring Boot Starter Validation
- Spring Boot Starter Web
- Spring Boot DevTools
- Spring Boot Starter Thymeleaf
- PostgreSQL
- Lombok
- ModelMapper
- jjwt-impl
- jjwt-jackson
- java-jwt
- Spring Boot Starter Test
- Spring Security Test
- Junit
The application uses the Spring Boot Maven Plugin for building the application.
You can test the application using a web browser. The application exposes the following endpoints:
/
: Endpoint to display the home page/app/add
: Endpoint to add a new book to the store./app/bookDetails
: Endpoint to view the details of a book./app/addBook
: Endpoint to show the page for adding a book./app/userPage
: Endpoint to show the user page./app/books
: Endpoint to show the page with a list of books./app/book/{id}
: Endpoint to show the page of a book by its ID./app/updateBook/{id}
: Endpoint to show the page for updating a book by its ID./app/removeBook/{id}
: Endpoint to remove a book by its ID.
The application also has the following endpoints for user registration and authentication:
/app/register
: Endpoint to show the registration form./app/login
: Endpoint to show the sign-in form./app/logout
: Endpoint to log out.
Please note that only the home, register, and login URLs are accessible by anyone. The remaining endpoints are for authenticated users.
The application uses the following properties. Please replace the placeholders with your own details:
spring.application.name=Online-Book-Store
# =================================================
# - JPA / HIBERNATE
# NOT ADVISABLE FOR USE IN PRODUCTION ENVIRONMENT
# =================================================
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto= update
#spring.jpa.show-sql=true
#spring.jpa.properties.hibernate.format_sql = true
spring.jpa.database=postgresql
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
# =================================================
# - Datasource (Postgres datasource Properties)
# =================================================
spring.datasource.url=jdbc:postgresql://localhost:5432/onlineBookstore-db
spring.datasource.username= <your-database-username>
spring.datasource.password= <your-database-password>
# =========================================================
# - JWT PROPERTIES
# =========================================================
lms.jwtExpirationMs=<your-jwt-expiration-time-in-ms>
lms.jwtSecretKey=<your-jwt-secret-key>
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
MIT