{"id":30385278,"url":"https://github.com/bruce-mig/axon-cqrs","last_synced_at":"2025-08-21T02:11:53.239Z","repository":{"id":297188458,"uuid":"993284870","full_name":"bruce-mig/axon-cqrs","owner":"bruce-mig","description":"CQRS Design Pattern using Axon Framework","archived":false,"fork":false,"pushed_at":"2025-06-04T08:39:29.000Z","size":985,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-04T14:58:27.482Z","etag":null,"topics":["axon","axon-framework","cqrs","event-driven-architecture"],"latest_commit_sha":null,"homepage":"","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/bruce-mig.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-05-30T14:24:21.000Z","updated_at":"2025-06-04T08:39:31.000Z","dependencies_parsed_at":"2025-06-04T14:58:33.825Z","dependency_job_id":"c51f3375-1814-4a03-98b9-d27589fdda18","html_url":"https://github.com/bruce-mig/axon-cqrs","commit_stats":null,"previous_names":["bruce-mig/axon-cqrs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bruce-mig/axon-cqrs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruce-mig%2Faxon-cqrs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruce-mig%2Faxon-cqrs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruce-mig%2Faxon-cqrs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruce-mig%2Faxon-cqrs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bruce-mig","download_url":"https://codeload.github.com/bruce-mig/axon-cqrs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bruce-mig%2Faxon-cqrs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271415496,"owners_count":24755639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"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":["axon","axon-framework","cqrs","event-driven-architecture"],"created_at":"2025-08-21T02:11:51.323Z","updated_at":"2025-08-21T02:11:53.229Z","avatar_url":"https://github.com/bruce-mig.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CQRS using Axon Framework\n\nThis repository implements the **Command Query Responsibility Segregation (CQRS)** design pattern using the Axon Framework. The application is focused on a products service, providing a clear example of how to structure Java applications with CQRS and Event Sourcing.\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Architecture](#architecture)\n- [Features](#features)\n- [Tech Stack](#tech-stack)\n- [Getting Started](#getting-started)\n- [Project Structure](#project-structure)\n- [Usage](#usage)\n- [Contributing](#contributing)\n- [License](#license)\n\n---\n\n## Overview\n\nCQRS is a design pattern that separates the models for reading and writing data, allowing better scalability, maintainability, and clear responsibilities in your codebase. This project demonstrates how to use Axon Framework to implement CQRS and Event Sourcing in a Java application managing product information.\n\n## Architecture\n\n- **Commands**: Write operations (e.g., create, update, delete products)\n- **Events**: Represent state changes (e.g., ProductCreatedEvent)\n- **Queries**: Read operations (fetch product details, list products)\n- **Aggregates**: The domain objects (e.g., ProductAggregate) handling commands and applying events\n- **Event Store**: Persist events (using Axon’s event store)\n- **Projections**: Build and maintain read models from events\n\n![CQRS Architecture Diagram](cqrs-api.png)\n\n## API Flow\n\n![](api-flow.png)\n\n## Features\n\n- Java implementation of CQRS pattern with Axon Framework\n- Event Sourcing for immutable history of state changes\n- RESTful API for product management\n- Simple in-memory or persistent event store (Axon-configurable)\n- Example projections for querying products\n- Clean separation of command and query models\n\n## Tech Stack\n\n- **Java 17+**\n- **Axon Framework**\n- **Spring Boot**\n- **Maven**\n- Optional: **Postgres Database** (for projections/read models), **Axon Server** (for event store)\n\n## Getting Started\n\n### Prerequisites\n\n- JDK 17 or newer\n- Maven 3.9+\n- Docker\n\n### Running the Application\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/bruce-mig/axon-cqrs.git\n   cd axon-cqrs\n   ```\n2. **Run docker compose**\n    ```bash\n   docker compose up -d\n   ```\n\n3. **Build the project**\n   ```bash\n   # Command Service\n   cd cmd-service\n   mvn clean install\n   \n   # Query Service\n   cd query-service\n   mvn clean install\n   ```\n4. **Run the application**\n   ```bash\n   # Command Service\n   cd cmd-service\n   mvn spring-boot:run\n   \n   # Query Service\n   cd query-service\n   mvn spring-boot:run\n   ```\n\n   The command application will start on `http://localhost:8081`.\n   The query application will start on `http://localhost:8085`.\n\n### Configuration\n\n- You can configure Axon event store and projections in `src/main/resources/application.yaml`.\n- To use Axon Server, ensure it’s running and set the appropriate properties.\n\n## Project Structure\n\n- **commands/** – Command objects and handlers\n- **events/** – Event objects and handlers\n- **queries/** – Query objects and handlers\n- **aggregates/** – Domain aggregates (e.g., ProductsAggregate)\n- **projections/** – Read models and view updaters\n- **controllers/** – REST API endpoints\n\n## Usage\n\n### Example Command API Endpoints\n\n- `POST /commands/products` – Create a new product (Command)\n\n- `PATCH /commands/products/{productId}` – Update product details (Command)\n\n- `DELETE /commands/products/{productId}` – Update product details (Command)\n\n### Example Query API Endpoints\n\n- `GET /products/{productId}` – Get product details (Query)\n- `GET /products` – List all products (Query)\n\nUse tools like [Postman](https://www.postman.com/) or `curl` to interact with the API.\n\n## TODO\n\nA comprehensive list of technical TODOs is maintained in [TODO.md](./TODO.md).\n\n### High-level tasks\n\n- [ ] Handle errors more gracefully throughout the application\n- [ ] Create Dockerfiles for the command and query services\n- [ ] Implement a CI pipeline to build Docker images and publish them to a container registry\n\n## Contributing\n\nContributions are welcome! Feel free to fork the repo and submit a pull request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/YourFeature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin feature/YourFeature`)\n5. Open a pull request\n\n## License\n\nThis project is open source under the [MIT License](LICENSE).\n\n---\n\n\u003e **CQRS and Event Sourcing with Axon Framework provide a robust foundation for scalable, maintainable, and evolvable Java applications.**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbruce-mig%2Faxon-cqrs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbruce-mig%2Faxon-cqrs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbruce-mig%2Faxon-cqrs/lists"}