{"id":26777893,"url":"https://github.com/tyler-pritchard/rr-store","last_synced_at":"2026-05-09T06:02:39.537Z","repository":{"id":263077917,"uuid":"889283993","full_name":"Tyler-Pritchard/rr-store","owner":"Tyler-Pritchard","description":"Microservice for managing product catalog, inventory, and RESTful APIs for an e-commerce platform, built with Spring Boot, JPA, and PostgreSQL.","archived":false,"fork":false,"pushed_at":"2025-04-13T20:54:41.000Z","size":5180,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-25T05:00:00.770Z","etag":null,"topics":["architecture","backend-de","ecommerce","inventory-management","java","jpa","microservice","postgresql","product-catalog","restful-api","software-dev","spring-boot","spring-data"],"latest_commit_sha":null,"homepage":"https://www.robrich.band/shop/products","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tyler-Pritchard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-16T01:28:33.000Z","updated_at":"2025-04-13T20:54:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"6cee70a6-f896-45d6-9de9-2f4b68a69ab8","html_url":"https://github.com/Tyler-Pritchard/rr-store","commit_stats":null,"previous_names":["tyler-pritchard/rr-store"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Tyler-Pritchard/rr-store","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tyler-Pritchard%2Frr-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tyler-Pritchard%2Frr-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tyler-Pritchard%2Frr-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tyler-Pritchard%2Frr-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tyler-Pritchard","download_url":"https://codeload.github.com/Tyler-Pritchard/rr-store/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tyler-Pritchard%2Frr-store/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32809147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["architecture","backend-de","ecommerce","inventory-management","java","jpa","microservice","postgresql","product-catalog","restful-api","software-dev","spring-boot","spring-data"],"created_at":"2025-03-29T05:18:43.996Z","updated_at":"2026-05-09T06:02:39.478Z","avatar_url":"https://github.com/Tyler-Pritchard.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# E-Store Microservice\n\n## Overview\n\nThe E-Store Microservice is a backend service engineered for enterprise-grade e-commerce platforms. It facilitates efficient product catalog management, leveraging Spring Boot to provide robust, secure, and scalable RESTful APIs. The service adheres to modern microservice architecture principles, ensuring high maintainability and performance. It is containerized for portability and deployed via Docker and Kubernetes, with full observability provided through Prometheus and Grafana.\n\n![Products](./misc/Screen%20Shot%202024-12-04%20at%201.22.30%20AM.png)\n![Product](./misc/Screen%20Shot%202024-12-04%20at%201.23.16%20AM.png)\n## Features\n\n### Core Capabilities\n\n- **Product Management**: Full CRUD operations for product records.\n- **Catalog Browsing**: Retrieve products with advanced filtering and pagination.\n- **Search and Filtering**: Query products by name, category, price range, and stock levels.\n- **Error Handling**: Consistent and structured API responses for predictable client behavior.\n- **Security**: Role-based access control and authentication with Spring Security.\n- **Database Integration**: Supports PostgreSQL for production and H2 for testing and local development.\n\n### Design Principles\n\n- **Scalability**: Designed with a microservice-first architecture to support horizontal scaling and service independence.\n- **Testability**: High test coverage enabled by modular code structure, unit tests (JUnit 5), and integration tests with Mockito.\n- **Performance**: Efficient database interactions using Hibernate ORM with tuned entity relationships and query execution.\n\n## Technology Stack\n- **Framework**: Spring Boot (v3.3.6)\n- **Language**: Java 17\n- **Database**: PostgreSQL (production), H2 (development/testing)\n- **Build Tool**: Maven\n- **Testing Frameworks**: JUnit 5, Mockito\n- **Security**: Spring Security with role-based access control\n- **Serialization**: Jackson (JSON processing)\n- **Utilities**: Lombok for code reduction, Hibernate for ORM\n\n## API Documentation\n\n**Base URL**: ``http://localhost:8080/api/products``\n\n### Endpoints\nHTTP Method | Endpoint | Description | Authentication | Example Status\n- GET ``/api/products`` Fetch all products Public ``200 OK``\n- POST ``/api/products`` Create a new product Admin ``201 Created``\n- GET ``/api/products/{id}`` Fetch a product by ID Public ``200 OK``\n- PUT ``/api/products/{id}`` Update an existing product by ID Admin ``200 OK``\n- DELETE ``/api/products/{id}`` Delete a product by ID Admin ``204 No Content``\n\nFor detailed request/response payloads, see the [API Reference](#api-documentation).\n\n## Project Structure\n```\nsrc/\n├── main/\n│   ├── java/com/rr/store/\n│   │   ├── controller/     # RESTful API controllers\n│   │   ├── domain/         # Business domain models\n│   │   ├── service/        # Business logic services\n│   │   ├── repository/     # JPA repositories\n│   │   ├── config/         # Security and application configurations\n│   │   └── exception/      # Custom exception handlers\n│   ├── resources/\n│       ├── application.yml          # Consolidated configuration\n│       ├── data/merch.json          # Sample product data\n└── test/\n    ├── java/com/rr/store/           # Unit and integration tests\n```\n\n## Local Development\n\n### Prerequisites\n- Java 17 or higher\n- Maven\n- PostgreSQL (for production)\n\n### Setup\n1. **Clone the Repository**:\n\n```\ngit clone https://github.com/username/e-store-microservice.git\ncd e-store-microservice\n```\n\n2. **Run the Application:**\n\n- Use the development profile:\n```\n./mvnw spring-boot:run \\\n  -Dspring-boot.run.profiles=dev \\\n  -Dspring-boot.run.mainClass=com.rr.store.RrStoreApplication\n\n```\n\n3. **Access the API**:\n\n- Base URL: ``http://localhost:8080/api/products``\n- Swagger (if enabled): ``http://localhost:8080/swagger-ui.html``\n  \n4. **Run Tests**:\n```\n./mvnw test\n```\n\n## Deployment\n\n### Railway Deployment\n- Configure environment variables:\n\n``DB_HOST``, ``DB_USERNAME``, ``DB_PASSWORD``, and ``SPRING_PROFILES_ACTIVE=prod``.\n\n- Deployment command:\n```\nmvn package\njava -jar target/rr-store-0.0.1-SNAPSHOT.jar\n```\n\n### Docker Deployment\n\n#### Running E-Store Microservice with Docker\n\nThe E-Store Microservice can be containerized and run using Docker, ensuring a consistent environment for development and deployment.\n\n#### Prerequisites\n- Install Docker on your system\n- Ensure PostgreSQL is set up in a Docker network\n\n#### Building the Docker Image\nTo build the Docker image, run:\n```\ndocker build -t rr-store .\n```\n\n#### Running the Docker Container\nTo start the container:\n```\ndocker run -d --name rr-store \\\n  --network shared_network \\\n  -p 8080:8080 \\\n  -e SPRING_PROFILES_ACTIVE=dev \\\n  -e DB_HOST=postgres-db \\\n  -e DB_USERNAME=postgres \\\n  -e DB_PASSWORD=your_secure_password \\\n  rr-store\n```\n\n#### Running with Docker Compose\nAlternatively, use Docker Compose to manage dependencies:\n\n1. Ensure ``docker-compose.yml`` is correctly configured.\n2. Run the following command:\n```\ndocker-compose up -d --build\n```\n\n#### Stopping and Restarting\nTo stop the container:\n```\ndocker stop rr-store\n```\nTo restart the container:\n```\ndocker start rr-store\n```\nTo remove the container:\n```\ndocker rm -f rr-store\n```\n\n## Kubernetes Deployment\n\nThis service is production-ready and optimized for deployment in containerized environments using Kubernetes. The deployment architecture supports scalability, resilience, and full-stack observability through Prometheus and Grafana.\n\n### Prerequisites\n- Minikube or Kubernetes cluster\n- Docker installed and configured\n- Helm (for Prometheus/Grafana setup)\n\n### Step-by-Step Deployment\n\n1. **Start Minikube and Enable Add-ons:**\n   ```bash\n   minikube start\n   minikube addons enable ingress\n   minikube addons enable metrics-server\n   ```\n\n2. **Build Docker Image Locally (Optional for Minikube):**\n   ```bash\n   eval $(minikube docker-env)\n   docker build -t rr-store:latest ./rr-store\n   ```\n\n3. **Apply Kubernetes Manifests:**\n   ```bash\n   kubectl apply -f rr-store/postgres-deployment.yaml\n   kubectl apply -f rr-store/rr-store-deployment.yaml\n   kubectl apply -f rr-store/rr-store-service.yaml\n   ```\n\n4. **Monitor Deployment Status:**\n   ```bash\n   kubectl get pods -A\n   kubectl get deployments -A\n   kubectl get svc -A\n   ```\n\n5. **Restart the Deployment (if needed):**\n   ```bash\n   kubectl rollout restart deployment rr-store\n   ```\n\n### Observability Integration\n\nThe deployment is annotated for Prometheus metrics scraping via `/actuator/prometheus`, and exposes health endpoints at `/actuator/health`. You can visualize metrics using a Grafana dashboard.\n\nTo install Prometheus and Grafana via Helm:\n```bash\nhelm repo add prometheus-community https://prometheus-community.github.io/helm-charts\nhelm repo update\nhelm install prometheus prometheus-community/kube-prometheus-stack --namespace monitoring --create-namespace\n```\n\nTo port-forward the Prometheus and Grafana dashboards:\n```bash\nkubectl port-forward -n monitoring svc/prometheus-kube-prometheus-prometheus 9090\nkubectl port-forward -n monitoring svc/prometheus-grafana 3000:80\n```\n\n### Verify Prometheus Metrics Endpoint\nOnce deployed, confirm `/actuator/prometheus` is reachable and serving metrics:\n\n`curl http://\u003cpod-ip\u003e:8080/actuator/prometheus`\n\nOr check Prometheus targets via http://localhost:9090/targets.\n\n\n## Testing\n\n### Test Coverage\n\n- **Unit Tests**:\n  - Validates core service logic and data transformations.\n- **Integration Tests**:\n  - Covers database operations and API endpoints with in-memory H2 database.\n\n### Commands\n\nRun all tests:\n```\n./mvnw test\n```\n\n## Future Enhancements\n\n- Add GraphQL support for flexible querying.\n- Implement rate limiting for enhanced security.\n- Introduce caching mechanisms (e.g., Redis) for frequently accessed data.\n- Add monitoring and observability tools (e.g., Prometheus, Grafana).\n\n## License\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.\n\n## Contact and Support\n\nFor questions or support, contact pritchard.tyler@gmail.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyler-pritchard%2Frr-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyler-pritchard%2Frr-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyler-pritchard%2Frr-store/lists"}