{"id":23298903,"url":"https://github.com/dnafication/event-driven-coffee","last_synced_at":"2025-04-06T20:28:45.273Z","repository":{"id":98631231,"uuid":"547321889","full_name":"dnafication/event-driven-coffee","owner":"dnafication","description":"Full stack coffee ordering app with Svelte for frontend and event driven architecture for backend using AWS services","archived":false,"fork":false,"pushed_at":"2022-11-11T04:32:30.000Z","size":2939,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T02:36:37.099Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/dnafication.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}},"created_at":"2022-10-07T13:45:26.000Z","updated_at":"2024-05-14T20:30:52.000Z","dependencies_parsed_at":"2023-03-07T10:30:31.597Z","dependency_job_id":null,"html_url":"https://github.com/dnafication/event-driven-coffee","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnafication%2Fevent-driven-coffee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnafication%2Fevent-driven-coffee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnafication%2Fevent-driven-coffee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnafication%2Fevent-driven-coffee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnafication","download_url":"https://codeload.github.com/dnafication/event-driven-coffee/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247546185,"owners_count":20956298,"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","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":[],"created_at":"2024-12-20T08:13:09.584Z","updated_at":"2025-04-06T20:28:45.253Z","avatar_url":"https://github.com/dnafication.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# event-driven-coffee\n\nFull stack coffee ordering app with Svelte for frontend and event driven architecture for backend using AWS services. This is just a demo app to showcase the event driven integration pattern.\n\n## Architecture\n\n![Architecture Diagram](./architecture.png)\n\n### Components\n\n- **Frontend**: Svelte\n- **Backend API**:\n  - GraphQL API (Apollo on ECS)\n\n- **Backend Internal Services**:\n  - SNS - SQS Fanout Architecture to handle asynchronous events\n  - Event Bus (AWS EventBridge)\n  - Order management microservice (AWS Lambda)\n  - Payment microservice (AWS Lambda)\n  - Fulfilment microservice (AWS Lambda)\n\n## Deployment\n\nFor serverless deployment, serverless framework is used. I am using my custom AWS profile for deployment. You can change it in `serverless.yml` file.\n\n```yml\nprovider:\n  name: aws\n  runtime: nodejs16.x\n  stage: dev\n  region: ap-southeast-2\n  profile: dina # replace dina with your profile name or delete this if default profile is used\n```\n\n## Microservices\nThere are multiple disparate microservices that are deployed as AWS Lambda functions. These microservices expose sync HTTP endpoints that allow consumers to interact with them. They also listen to events published on an SNS topic and perform actions based on the event.\n\n### Order Management Microservice\nThis microservice is responsible for managing orders. It exposes the following endpoints:\n\n- `GET /coffees` - Get all coffees\n- `POST /order` - Create a new order\n- `GET /order/:id` - Get an order by id\n- `GET /order?date={today by default}` - Get all orders\n- `GET /order?customerId={id}` - Get all orders\n- `PATCH /order/:id` - Update an order by id, eg: cancel order\n\n### Payment Microservice\nThis microservice is responsible for processing payments. It exposes the following endpoints:\n\n- `POST /payment` - Create a payment for an order\n- `GET /payment/:id` - Get a payment by id\n- `GET /payment?date={today by default}` - Get all payments\n\n### Fulfilment Microservice\nThis microservice is responsible for fulfilling orders. It exposes the following endpoints:\n\n- `GET /fulfilment/:id` - Get a fulfilment by id\n- `GET /fulfilment?date={today by default}` - Get all fulfilments\n- `PATCH /fulfilment/:id` - Update status of a fulfilment by id\n\n## Events\n\nEvent object will have following interface:\n\n```ts\nexport type OrderStatus =\n  | 'ORDER_CREATED'\n  | 'ORDER_IN_PROGRESS'\n  | 'ORDER_CANCELLED'\n  | 'ORDER_COMPLETED'\n\nexport type PaymentStatus =\n  | 'PAYMENT_PENDING'\n  | 'PAYMENT_CREATED'\n  | 'PAYMENT_SUCCESSFUL'\n  | 'PAYMENT_FAILED'\n  | 'PAYMENT_REFUNDED'\n\nexport type FulfilmentStatus =\n  | 'FULFILMENT_PENDING'\n  | 'FULFILMENT_CREATED'\n  | 'FULFILMENT_COMPLETED'\n  | 'FULFILMENT_REJECTED'\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnafication%2Fevent-driven-coffee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnafication%2Fevent-driven-coffee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnafication%2Fevent-driven-coffee/lists"}