/hogwarts-artifacts-online

Primary LanguageJavaApache License 2.0Apache-2.0

Hogwarts Artifacts Online - Spring Boot Application

GitHub Workflow Status (with event) GitHub Workflow Status (with event) Dynamic XML Badge Dynamic XML Badge Dynamic XML Badge

What is 🧙‍♂️ Hogwarts Artifacts Online 🧙‍♀️?

Welcome to Hogwarts Artifacts Online, a sample back-end application designed to demonstrate typical use cases and best practices in Spring Boot development. I wrote this sample application line-by-line from scratch in my YouTube course titled "Learn Spring Boot 3 with Bingyang" Static Badge.

Throughout the course, Hogwarts Artifacts Online serves as a running example and is developed progressively. That is, each episode introduces new Spring Boot features that add functionality or improvements to this project. This approach helps you see how different concepts fit together in a practical context.

In addition to exploring the features of Spring Boot, the course delves into essential software engineering practices. We will start by framing user stories, then move on to crafting REST APIs and applying object-oriented design principles. Embracing test-driven development, we will meticulously build and refine each feature. The culmination of this journey is setting up a comprehensive CI/CD pipeline, ensuring smooth deployment of the application.

Suitable for Muggles and Wizards Alike

Whether you're new to Spring Boot or an experienced developer looking to add some magic to your skillset, Hogwarts Artifacts Online is the perfect place to start. As you follow along with the videos, I encourage you to actively code alongside me. Engaging in hands-on practice is an excellent method for mastering programming skills. So grab your wand 🪄 (or keyboard ⌨️) and prepare to embark on a journey into "Learn Spring Boot 3 with Bingyang" Static Badge!

What Will You Learn?

Through my YouTube course, you will gain practical experience in:

  • Dependency Injection and the use of Spring Framework's core container.
  • Building the web layer with Spring MVC (Model-View-Controller).
  • Data persistence in relational databases using Spring Data JPA (Jakarta Persistence API).
  • User authentication and authorization with Spring Security and JWT (JSON Web Tokens).
  • Deploying a Spring Boot application to a cloud platform with Spring Cloud Azure.
  • Monitoring a running Spring Boot application in the production with Spring Boot Actuator.
  • Making requests to OpenAI API with RestClient.
  • And more.

Additionally, my course emphasizes good software engineering practices, such as:

  • Defining software requirements with User Stories.
  • Version control and project planning using Git and GitHub.
  • The API-First Approach in designing effective REST APIs.
  • Test-Driven Development (TDD): writing tests first, then coding to pass the tests, and refactoring.
  • Object-Oriented Design with UML.
  • CI/CD (Continuous Integration and Continuous Delivery) with GitHub Actions.

Documentation

Project User Stories

🔗 The mind map of the Hogwarts Artifacts Online user stories

API Documentation

🔗 Hogwarts Artifacts Online API Documentation

Run Hogwarts Artifacts Online Locally

Installation

  1. Clone the repository:

    git clone https://github.com/Washingtonwei/hogwarts-artifacts-online.git
  2. Navigate to the project directory:

    cd hogwarts-artifacts-online
  3. Run the application:

Since Hogwarts Artifacts Online is a Spring Boot application built using Maven, you can run it from Maven directly using the Spring Boot Maven plugin:

./mvnw spring-boot:run

Or on Windows:

.\mvnw.cmd spring-boot:run

Building a Container

There is a Dockerfile in this project. You can build a container image (if you have a docker daemon):

docker build .

Database Configuration

In its default configuration, Hogwarts Artifacts Online uses an in-memory database (H2) which gets populated at startup with data. The H2 console is available at http://localhost/h2-console, and it is possible to inspect the content of the database using the jdbc:h2:mem:hogwarts URL.

I have defined a class edu.tcu.cs.hogwartsartifactsonline.system.DBDataInitializer to populate the H2 database at startup.

Accessing the API Endpoints

Static Badge Run In Postman

Contributing

The issue tracker is the preferred channel for bug reports, feature requests, and submitting pull requests.

License

The Hogwarts Artifacts Online application is released under version 2.0 of the Apache License.

Acknowledgements

  • Inspired by the Spring PetClinic Sample Application.
  • Inspired by J.K. Rowling's Harry Potter series.

YouTube Videos

If you're looking to enhance your understanding of this Spring Boot tutorial, I highly recommend watching the accompanying YouTube video playlist. It provides a comprehensive walk-through of the concepts and code discussed here, complete with visual demonstrations and step-by-step explanations. Whether you're a visual learner or just prefer a more interactive approach, those videos are a valuable resource to solidify your grasp of Spring Boot.

Check them out now below to dive deeper into the world of Spring Boot development!

  1. Introduction to Spring Boot 3 Tutorial
  2. What is Spring?
  3. Inversion of Control and Dependency Injection
  4. What is Spring Boot?
  5. Spring Boot Quick Demo
  6. Spring Boot Project Structure
  7. Spring Boot Quick Demo Implementation
  8. pom.xml Demystified
  9. spring-boot-starter-parent
  10. Introduction to Hogwarts Artifacts Online
  11. Requirements of the Project
  12. Creating a Spring Boot Project and Pushing it to GitHub
  13. Project Planning Using GitHub Issues
  14. API-First Approach
  15. Creating a Feature Branch for Issue 1 Artifact CRUD
  16. Object-Oriented Design Using Class Diagram
  17. Object-Oriented Design Using Sequence Diagram
  18. Creating Controller, Service, and Repository for Artifacts
  19. Introduction to Test Driven Development (TDD)
  20. Implementing ArtifactService Using TDD
  21. Implementing ArtifactController Using TDD
  22. Populating the H2 Database with Test Data
  23. API Integration Testing, Postman, JSON Infinite Recursion, and Data Transfer Object (DTO)
  24. Implementing Find All Artifacts (User Story in GitHub Issue 1)
  25. Implementing Add an Artifact (User Story in GitHub Issue 1)
  26. Implementing Update an Artifact (User Story in GitHub Issue 1)
  27. Implementing Delete an Artifact (User Story in GitHub Issue 1)
  28. Pushing a Feature Branch to GitHub and Creating a Pull Request
  29. Homework (Wizard CRUD APIs, Issue 2)
  30. Wizard CRUD APIs (Issue 2) Homework Solution
  31. Code Refactoring
  32. Implementing Artifact Assignment (Issue 3)
  33. Implementing User CRUD APIs
  34. Introduction to Spring Security
  35. Implementing HTTP Basic Authentication in Spring Boot
  36. Introduction to JWT
  37. Generating JWTs in Spring Boot
  38. Handling Spring Security Exceptions Using @ControllerAdvice
  39. Testing with Spring Security
  40. Enabling CORS in Spring Boot
  41. Committing and Pushing to a GitHub Repo
  42. Introduction to Spring Boot Packaging and Deployment
  43. Packaging a Spring Boot Application into an Executable JAR
  44. Containerizing a Spring Boot Application
  45. Introduction to CI and CD with GitHub Actions
  46. Spring Boot Continuous Integration with GitHub Actions
  47. Deploying Spring Boot Applications to Azure with GitHub Actions
  48. Setting Up Staging Environments in Azure App Service
  49. Connecting Spring Boot to a MySQL Database with Azure Key Vault
  50. Spring Boot Actuator
  51. Observing a Spring Boot Application with Actuator, Prometheus, Grafana, and Zipkin
  52. Upgrading a Spring Boot Application