This is a Redis starter template for Java and Spring Boot 4.
- Java 17+
- Docker
The project uses the included Maven wrapper, so a separate Maven install is optional.
Copy the sample environment file:
cp .env.example .envSupported variables:
REDIS_URLPORTLOG_LEVELLOG_STREAM_KEYNODE_ENV
.env is optional at runtime. Spring will use real environment variables and command-line properties first, then fall back to .env values when present.
.env.docker contains compose-safe defaults for the bundled Redis service.
docker compose up -dThis starts Redis 8 and the API server. The app is available at http://localhost:8080 unless PORT is overridden. Redis stays on the internal compose network by default, so it does not claim host port 6379.
Point REDIS_URL at Redis Stack / Redis Cloud, then start the app with:
./mvnw spring-boot:runGET /api/todoslists all todosGET /api/todos/search?name=<name>&status=<status>searches by name and/or statusGET /api/todos/{id}fetches a single todoPOST /api/todoscreates a todo from{ "name": "Sample todo" }PATCH /api/todos/{id}updates status from{ "status": "todo|in progress|complete" }DELETE /api/todos/{id}deletes a todo
Notes:
GET /api/todos/searchis the primary search route.- Trailing-slash route aliases are still accepted for compatibility.
- Error responses use
{ "status": <int>, "message": <string> }. - Todo timestamps are returned as
createdDateandupdatedDate.
Run the full test suite with:
./mvnw testTests use Testcontainers and start Redis automatically. You do not need a pre-running Redis server or a local .env file.
If you do not already have a database, start here:
Use the endpoint, username, and password from Redis Cloud to build a connection string such as:
REDIS_URL="redis://default:<password>@redis-#####.c###.us-west-2-#.ec2.redns.redis-cloud.com:#####"