Skip to content

hahooy/todo-springboot-cassandra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Todo Service With Spring Boot

This repository showcases a simple todo application that demonstrates the implementation of a RESTful web service using Spring Boot and Cassandra.

Key technologies and features:

  • Spring Boot: Utilize Spring Boot as the framework for building web applications.
  • Cassandra: Utilize Cassandra as data storage.
  • Cassandra Schema Migration: Automatically manage database schema changes.
  • OpenAPI: Define APIs, auto-generate server stubs with bean validation, and produce Swagger documentation.
  • Docker: Containerize the service for deployment.
  • Docker Compose: Run the todo service docker image together with Cassandra.
  • Gradle: Employ Gradle as the build tool.
  • Lombok: Simplify development with Lombok annotations.

Local development

Prerequisites

This application depends on:

  • Java 17
  • Cassandra (or having docker to run a Cassandra container)

Run service locally

You need to have Cassandra running locally before you can start the service:

  1. Run cassandra locally in a container docker run --name cass_cluster -d -p 127.0.0.1:9042:9042 --rm cassandra:4.1.2
  2. Wait until the container is up and running, then use cqlsh to create a Cassandra keyspace for the service:
    docker exec -it cass_cluster cqlsh -e "CREATE KEYSPACE todo
        WITH REPLICATION = { 
         'class' : 'SimpleStrategy', 
         'replication_factor' : 1 
        };"
  3. Start the service ./gradlew bootRun

Run service using docker compose

Use this command to run the service together with its dependencies using docker compose docker compose -f service/docker-compose.yml up.

Build docker image

  • Run docker build -t todo-service service to build the docker image.
  • Run the image docker run --name todo-service -d -p 127.0.0.1:8944:8944 todo-service:latest

Other useful commands

  • Start the service in debug mode to attach a debugger ./gradlew bootRun --debug-jvm
  • List all gradle tasks ./gradlew tasks
  • Generate server stub ./gradlew openApiGenerate
  • Visit Swagger UI for API documentation

About

a simple todo app built with Spring Boot and Cassandra

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published