{"id":13714222,"url":"https://github.com/charly3pins/eShop","last_synced_at":"2025-05-07T01:32:49.776Z","repository":{"id":89437451,"uuid":"335563941","full_name":"charly3pins/eShop","owner":"charly3pins","description":" E-Commerce project using Hexagonal Architecture (Ports-and-adapters) as a proof-of-concept applying DDD in Go","archived":false,"fork":false,"pushed_at":"2021-02-07T17:08:15.000Z","size":11,"stargazers_count":38,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-03T23:30:00.002Z","etag":null,"topics":["ddd","e-commerce","go","golang","hexagonal-architecture","microservices","ports-and-adapters"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/charly3pins.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-02-03T08:59:26.000Z","updated_at":"2024-04-27T12:08:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"eb0f7266-6f19-41ea-95e4-6c36a5b0ad83","html_url":"https://github.com/charly3pins/eShop","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/charly3pins%2FeShop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charly3pins%2FeShop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charly3pins%2FeShop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charly3pins%2FeShop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/charly3pins","download_url":"https://codeload.github.com/charly3pins/eShop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224551182,"owners_count":17330092,"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":["ddd","e-commerce","go","golang","hexagonal-architecture","microservices","ports-and-adapters"],"created_at":"2024-08-02T23:01:55.089Z","updated_at":"2024-11-14T01:30:49.959Z","avatar_url":"https://github.com/charly3pins.png","language":"Go","funding_links":[],"categories":["Repositories"],"sub_categories":[],"readme":"# 🛒🌐 eShop\n\nThe aim of this project is to be a proof-of-concept using `Hexagonal Architecture` (Ports-and-adapters) applying `DDD` in `Go` 🔥\n\nThe code will be reviewed over time to time while I will introduce new concepts about the Hexagonal Architecture or DDD and new features  to it; so for sure will be refactored several times.\n\n## 👩‍💻 Project\n\nThe idea of this project is to support an E-Commerce called `eShop` (super original 🙄). It has to provide a user management system and an order and product catalogue.\n\nThe language chosen for this has been `Go` and the database `PostgreSQL`. For the simplicity of the case I've added a `docker-compose` to create the db automatically and a `Makefile` with a few commands described above ✨\n\n## 📐 Architecture\n\nAs mentioned before, the project it's using the Hexagonal Architecture and the layers are 📁\n\n- application - it contains the `application services` (the use cases).\n- domain - it defines the core of our applications; it contains the `entities`, the `factories` and the `repositories interfaces`.\n- infrastructure - it contains the implementation of the `repositories` defined in the domain and the `api` definition (router and handlers).\n\n- cmd - the multiple commands offered by the project.\n\n## 📝 Commands\n\nUse `docker-compose up` to start the database.\nUse `make run` to start the server.\nUse `make migrations` to run the migrations.\n\n### Sign In User\n\nEndpoint: /users\nRequest: POST\n\n```\ncurl -X POST http://localhost:8080/users -d '{\"email\":\"charly@eshop.com\", \"name\":\"charly3pins\"}'\n```\n\n### Add products to Order\n\nEndpoint: /orders\nRequest: POST\n\nCreating an Order (empty `order_id`)\n```\ncurl -X POST http://localhost:8080/orders -d '{\"user_id\":\"48c20124-824a-4cf6-a377-d2efdc789bf3\", \"products\":[{\"name\":\"DDD book\", \"unit_price\": 35, \"currency\": \"EUR\", \"quantity\": 1}, {\"name\":\"post-it\", \"unit_price\": 2, \"currency\": \"EUR\", \"quantity\": 3}, {\"name\":\"pen\", \"unit_price\": 1, \"currency\": \"EUR\", \"quantity\": 5}]}'\n```\n\nAdding a new product to an existing Order (with `order_id`)\n```\ncurl -X POST http://localhost:8080/orders -d '{\"user_id\":\"48c20124-824a-4cf6-a377-d2efdc789bf3\", \"order_id\": \"47fafa06-a73a-4733-966b-60914d1dd8ff\", \"products\":[{\"name\":\"IDDD book\", \"unit_price\": 55, \"currency\": \"EUR\", \"quantity\": 1}]}'\n```\n\nUpdating an existing product to an existing Order (with `order_id` and `product_id`)\n```\ncurl -X POST http://localhost:8080/orders -d '{\"user_id\":\"48c20124-824a-4cf6-a377-d2efdc789bf3\", \"order_id\": \"47fafa06-a73a-4733-966b-60914d1dd8ff\", \"products\":[{\"product_id\":\"c92ca476-adcd-4843-a5a3-8c442c2f7d4e\", \"name\":\"post-it\", \"unit_price\": 2, \"currency\": \"EUR\", \"quantity\": 10}]}'\n```\n\n## 🤝 Contributing\n\nAs with all my projects you are more than welcome to contribute. You can open an issue, a pull request or just send me a message and we can chat about the topic you want 🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharly3pins%2FeShop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharly3pins%2FeShop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharly3pins%2FeShop/lists"}