A RESTful Todo API built with Spring Boot that implements the TodoBackend specification.
- Full CRUD operations for todos
- PostgreSQL persistence with Flyway migrations
- CORS support for web clients
- Comprehensive test suite (unit + integration)
- Docker containerization
- Java 25 (EA) – make sure a compatible toolchain is installed locally
- Docker and Docker Compose
-
Clone this repository:
git clone <repo-url> cd spring-todo
-
Set the Java 25 environment. For example on macOS:
export JAVA_HOME=$(/usr/libexec/java_home -v 25)
-
Start PostgreSQL:
docker-compose up -d
-
Run tests:
./gradlew check
-
Start the application:
./gradlew bootRun -Dspring.profiles.active=dev
The API will be available at http://localhost:8080/todos
Test the API against the TodoBackend specification:
- Start the application in development mode
- Visit the TodoBackend test suite
- All tests should pass ✅
GET /todos- List all todosPOST /todos- Create a new todoGET /todos/{id}- Get a specific todoPATCH /todos/{id}- Update a todoDELETE /todos/{id}- Delete a specific todoDELETE /todos- Delete all todos
- Java 25 with Spring Boot 3.5.0
- PostgreSQL 15 for persistence
- Flyway for database migrations
- JUnit 5 for testing
- Gradle 9.1 for build automation
- Docker for containerization
Publishing the Database Docker image is a manual process at the moment. This enables CI to pull the image to run integration tests. To build and publish the custom PostgreSQL image for CI/CD:
-
Navigate to the postgres directory:
cd postgres -
Build the Docker image:
docker build -t saylerb/spring-todo-postgres:0.1.0 . -
Login to Docker Hub:
docker login
-
Push the image:
docker push saylerb/spring-todo-postgres:0.1.0