Skip to content

balakmran/stream-weaver

Repository files navigation

Stream Weaver 🧵

Stream Weaver is a high-performance, event-driven streaming platform built to demonstrate the capabilities of Java 25, Spring Boot 4, and GraalVM Native Images.

It simulates a robust AWS pipeline (Producer → Kinesis → Consumer → DynamoDB) running entirely on a local machine using LocalStack and OrbStack, achieving sub-second startup times and minimal memory footprint.

🏗️ Architecture

📖 See docs/architecture.md for a detailed diagram and resource breakdown.

  • Monorepo Structure: Gradle-based monorepo managing shared libraries and microservices.
  • Ingester Service: A Spring Cloud Stream application acting as both a REST Producer and a Kinesis Consumer.
  • Runtime: Compiled to a Native Linux Executable via GraalVM for instant startup (<50ms).
  • Infrastructure: Managed via Terraform (OpenTofu) and deployed to LocalStack.

⚡ Tech Stack

Component Technology Version
Language Java (Oracle GraalVM) 25 (LTS)
Framework Spring Boot 4.0.2
Cloud Spring Cloud AWS 4.0.0
Build Tool Gradle (Kotlin DSL) 9.3.0
Concurrency Project Loom Virtual Threads
IaC Terraform / OpenTofu 1.6+
Local Cloud LocalStack Latest

🛠️ Prerequisites

Ensure you have the following tools installed (optimized for macOS/Apple Silicon):

  1. Ghostty / Terminal: Your command center.

  2. SDKMAN!: For managing Java and Gradle.

sdk install java 25.0.2-graal
sdk install gradle 9.3.0
  1. OrbStack: The faster alternative to Docker Desktop.

  2. LocalStack Tools (managed via uv):

uv tool install awscli-local
uv tool install terraform-local

🚀 Quick Start Guide

  1. Start Infrastructure

Launch LocalStack in the background (detached mode).

localstack start -d
  1. Provision Resources

Use tflocal to deploy the Kinesis Stream (stream-weaver-events) and DynamoDB tables (StreamWeaverCheckpoints, StreamWeaverLocks).

cd infra/shared
tflocal init
tflocal apply --auto-approve
  1. Build Native Image

Compile the ingester-service into a native container. This uses Cloud Native Buildpacks to perform AOT (Ahead-of-Time) compilation.

# From the project root
cd services/ingester-service
../../gradlew bootBuildImage --imageName=ingester-service:0.0.1

☕ Grab a coffee—this takes ~2-3 minutes as GraalVM analyzes reachability.

  1. Run the Application

Start the microservice using Docker Compose. This ensures the native Linux container can talk to the LocalStack instance on your Mac host.

# From the project root
docker-compose up

Success Indicator: Look for a startup time of <0.1 seconds.

🧪 Verification

  1. Trigger the Flow

Send a REST request to the Ingester Service. It will wrap the message in an Event record and push it to Kinesis.

curl -X POST -H "Content-Type: application/json" \
     -d '{"message": "Hello-Native-World"}' \
     http://localhost:8080/api/v1/events
  1. Check Logs

Verify that the consumer picked up the event from Kinesis.

docker logs stream-weaver-app

📂 Project Structure

stream-weaver/
├── build.gradle.kts                    # Root Build Logic
├── CONTRIBUTING.md                     # Dev Workflow & Guidelines
├── gradle.properties                   # Project Config & JVM Args
├── gradlew                             # Gradle Wrapper
├── docker-compose.yml                  # Orchestrates the Native App
├── settings.gradle.kts                 # Monorepo Module Definitions
├── docs/                               # Documentation
│   └── architecture.md                 # Architecture Diagrams
├── infra/
│   └── shared/                         # Terraform for Kinesis/DynamoDB
│       ├── main.tf                     # Infrastructure Definition
│       └── providers.tf                # Provider Configuration
├── libs/
│   └── common-models/                  # Shared Java 25 Records (DTOs)
└── services/
    └── ingester-service/               # Spring Boot 4 Application
        ├── build.gradle.kts
        └── src/main/
            ├── java/.../ingest/
            │   ├── api/                # HTTP Producer (REST)
            │   └── consumer/           # Kinesis Consumer Bean
            └── resources/
                └── application.yaml    # App & Cloud Config

🤝 Contributing

Want to modify the code? Check out CONTRIBUTING.md for the fast JVM-based development workflow.

📜 License

Distributed under the MIT License. See LICENSE for more information.

✍️ Author

Balakumaran Manoharan

About

Next-gen Event Streaming platform built with Java 25 (Loom), Spring Boot 4, and GraalVM Native Images. Features a complete local AWS pipeline (Kinesis → DynamoDB) using LocalStack and Terraform.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors