Giter Site home page Giter Site logo

book-review-api's Introduction

Book Review API 📖🪶

Introduction:books:

Are you ready to embark on a journey to learn about the powerful world of APIs? An API, or Application Programming Interface, is a collection of protocols, routines, and tools that enable software applications to communicate and exchange information with one another. The goal of this mini project is to build a robust backend using Spring Boot and its various modules to create a Book Review API. The building approach for this project is monolithic, utilizing PostgreSQL as the database and deploying the app on the Tomcat server.

Installation

First, you will need to install the following:

  1. First, download IntelliJ IDE if you don't have it on your computer.
  2. Next, download PostgreSQL and create a database called "bookapi".
  3. Then, download Postman to test the API.
  4. Also, make sure to include the Spring dependencies in your pom.xml file.
  5. After downloading your tools, clone this repository.
  6. Open the files in IntelliJ and run the application.

Technical Requirements

For this project, the following technologies were included:

  • The PostgreSQL database includes five models: Author, Book, Review, User, and User Profile:white_check_mark:
  • The environment settings are set up using Spring Profiles:white_check_mark:
  • A combination of Spring Security and JWT tokens used to authenticate and personalize the API endpoints:white_check_mark:
  • API endpoints and their functionality included to complete CRUD operations (create, read, update, and delete):white_check_mark:
  • Additional API endpoints are included to perform CRUD tasks based on the business logic and user stories:white_check_mark:
  • CRUD routes built on rest conventions are provided:white_check_mark:
  • Various exception handles are included to handle unexpected occurrences with the appropriate message:white_check_mark:
  • The controllers and services are separate to conform to the MVC design pattern:white_check_mark:

The Planning Process🖋️

To keep track of the project's progress, I created a Kanban board in Github projects. The user stories were added to the board and broken down into smaller tasks. The tasks were then assigned to the appropriate milestone and due date. This allowed me to also map out the API endpoints and the database models.

kanban

User Stories:busts_in_silhouette:

The following user stories included:

  • As a user, I want to search for books and book reviews by using various parameters.
  • As a user, I want to retrieve a list of book reviews by other readers like myself.
  • As a user, I want to retrieve a list of all book review ratings.
  • As a user, I want to securely find another fellow reader by their email address.
  • As a user, I want to securely update a review that I;ve previously written if I make a mistake.
  • As a user, I want to securely update my user profile and information.
  • As a user, I want to securely log in to my account.
  • As a user, I want to securely register another profile for a family member.
  • As a user, I want to securely delete a previously written book review when I'm logged in the app.

API Endpoints

api

Technologies & Tools Used🛠️

    Project Management 📋Github Projects (Kanban Board) Version Control
  • 🕛GitHub
  • 🔹Git Bash (Command Line)
  • Wireframe
  • 🔹Diagrams.net
  • Backend Tools
  • 🔹IntelliJ (IDE)
  • 🔹PostgreSQL (Database)
  • 🔹Postman (API Testing)
  • 🔹Spring Boot (Framework)
  • 🔹Spring Data JPA (ORM)
  • 🔹Spring Security (Authentication)
  • 🔹Spring Web (RESTful Web Services)
  • 🔹JWT (Token)
  • 🔹Tomcat (Server)
  • 🔹Java (Programming Language)
  • 🔹Maven (Dependency Management)

My Thought Process:brain:

My primary objective for this project was to develop an MVP that satisfied the technical requirements and user stories. During the planning stage, I used diagrams.net to map out the models and database tables. While there were many approaches and options available, I chose to keep the project diagrams as simple as possible. As a result, here is the ERD diagram that I created for the database tables in PostgreSQL:

api

One-to-Many Relationship(Book & Author Entities)

  • One author can have many books.
  • One book can only have one author.
  • The author_id column is a foreign key.
  • The author_id column references the id column in the authors table.

Many-to-One Relationship(Book & Review Entities)

  • Many reviews can be written for a single book.
  • One review can have one user.
  • The book_id column is a foreign key.

One-to-One Relationship(User & User Profile)

  • Each user has one profile.
  • The name column is a foreign key.
  • CASCADE: Any changes made to the User entity will also be applied to the UserProfile.

Hurdles📚😖😣

◾As I was near the end of building out the project, I had some issues with the JWT Token. Before starting the project, I created a 'Hello World' endpoint to test out in Postman, which worked fine. After adding the security and JWT layers later, I received errors relating to the token authorization.

◾I created the 'createBookReview' method based on a user story, but I could not get the method to work. I was able to setup the parameters needed to create a new review. However, I could not implement this method in the 'ReviewService' and 'ReviewRepository' layers.

Wins:trophy::woman_cartwheeling:

◾One win was that I was able to troubleshoot most of the bean errors that I received while building the api. Another win was that I was able to research various exception handling procedures and status codes, and implement these exceptions in my code. I included them as separate exception classes under the exception package. Finally, working with the Postgre Database was a win for me because I was able to insert, update and query data from the tables.

Resources & Documentation Used⛑️

Credits / MVPS:star::star::star::star::star:

  • Our instructor Suresh Sigera for his lectures and code on creating REST APIs and JWT Tokens.
  • Thank you to Jeff Ou, Kevin Barrios, and Dominique Akers for the brainstorming process on Discord. It was fun!
  • Thank you to Dominique Collins for buying me coffee!

book-review-api's People

Contributors

vnpugh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.