explaingit

spring-projects/spring-petclinic

9,212CSSAudience · developerComplexity · 2/5Setup · easy

TLDR

A sample veterinary clinic web app built with Spring Boot, maintained by the Spring team as a teaching reference for Java developers learning how to structure a real Spring application.

Mindmap

mindmap
  root((repo))
    What it does
      Vet clinic records
      Owner and pet tracking
      Visit history
    Tech Stack
      Spring Boot
      Java 17
      Bootstrap frontend
    Storage Options
      In-memory default
      MySQL persistent
      PostgreSQL persistent
    Learning Paths
      Local quick start
      GitHub Codespaces
      Architecture variant forks
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Run the app locally with a single command to study how a complete Spring Boot project is structured end to end.

USE CASE 2

Switch from the default in-memory database to MySQL or PostgreSQL to learn how to add persistent storage to a Spring Boot app.

USE CASE 3

Use one of the linked variant forks to compare microservices, reactive, or alternative-database architectural styles against the baseline.

Tech stack

JavaSpring BootHTMLCSSBootstrapMySQLPostgreSQL

Getting it running

Difficulty · easy Time to first run · 30min

Requires Java 17 or later, can run instantly in GitHub Codespaces with zero local setup.

In plain English

Spring PetClinic is a sample web application maintained by the Spring team at VMware. It models a simple veterinary clinic where staff can manage records for pet owners and their animals, track visits, and look up vets. The app exists primarily as a teaching tool and reference project for Java developers learning the Spring framework, which is one of the most widely used platforms for building Java-based server applications. The application is built with Spring Boot, a version of the Spring framework that reduces setup and configuration work. It uses Java on the backend and stores data in a database. By default it uses an in-memory database that resets each time the app restarts, but it can also be configured to use MySQL or PostgreSQL for persistent storage. The front end is standard HTML with some styling applied using Bootstrap. Developers can run the project locally by cloning the code, installing Java 17 or later, and starting it with a single command. It then runs in a browser at a local address. It can also be opened directly in GitHub Codespaces or Gitpod, which are cloud-based coding environments, without any local setup. Instructions are provided for IntelliJ IDEA, Eclipse, Spring Tools Suite, and VS Code. Beyond the main version, the README lists several forks and variants of PetClinic that demonstrate different architectural styles, such as splitting the app into microservices, using reactive programming, or swapping in alternative databases. These variants are maintained separately and serve as comparison points for developers exploring different design approaches. This project is intended for developers, not general users. It does not solve a real business problem on its own but illustrates how a real Spring-based application is structured.

Copy-paste prompts

Prompt 1
I cloned spring-petclinic and started it with ./mvnw spring-boot:run. How do I switch from the default in-memory H2 database to a persistent PostgreSQL setup, including the application.properties changes?
Prompt 2
Using spring-petclinic as a reference, show me how the Owner-to-Pet one-to-many relationship is modeled in Spring Data JPA, the entity classes, repository, and relevant annotations.
Prompt 3
I want to add a new 'Medication' entity to spring-petclinic with its own CRUD pages. Walk me through adding the model, repository, service, and Thymeleaf controller from scratch.
Open on GitHub → Explain another repo

← spring-projects on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.