pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/redis-developer/redis-starter-java

in="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-b55097560d244c08.css" /> GitHub - redis-developer/redis-starter-java: A starter project for working with Redis and Java · GitHub
Skip to content

redis-developer/redis-starter-java

Repository files navigation

This is a Redis starter template for Java and Spring Boot 4.

Requirements

  • Java 17+
  • Docker

The project uses the included Maven wrapper, so a separate Maven install is optional.

Environment

Copy the sample environment file:

cp .env.example .env

Supported variables:

  • REDIS_URL
  • PORT
  • LOG_LEVEL
  • LOG_STREAM_KEY
  • NODE_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.

Run with Docker

docker compose up -d

This 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.

Run locally

Point REDIS_URL at Redis Stack / Redis Cloud, then start the app with:

./mvnw spring-boot:run

API

  • GET /api/todos lists all todos
  • GET /api/todos/search?name=<name>&status=<status> searches by name and/or status
  • GET /api/todos/{id} fetches a single todo
  • POST /api/todos creates 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/search is 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 createdDate and updatedDate.

Tests

Run the full test suite with:

./mvnw test

Tests use Testcontainers and start Redis automatically. You do not need a pre-running Redis server or a local .env file.

Redis Cloud

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:#####"

Learn More

Releases

No releases published

Packages

 
 
 

Contributors

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy