{"id":13492337,"url":"https://github.com/marcusolsson/goddd","last_synced_at":"2025-09-28T21:30:49.332Z","repository":{"id":21400720,"uuid":"24718628","full_name":"marcusolsson/goddd","owner":"marcusolsson","description":"Exploring DDD in Go","archived":true,"fork":false,"pushed_at":"2021-10-12T20:26:50.000Z","size":4777,"stargazers_count":2398,"open_issues_count":15,"forks_count":274,"subscribers_count":82,"default_branch":"master","last_synced_at":"2024-10-15T09:15:54.701Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/marcusolsson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":"https://buymeacoffee.com/marcusolsson"}},"created_at":"2014-10-02T12:51:19.000Z","updated_at":"2024-10-05T05:08:45.000Z","dependencies_parsed_at":"2022-07-27T02:32:07.641Z","dependency_job_id":null,"html_url":"https://github.com/marcusolsson/goddd","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusolsson%2Fgoddd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusolsson%2Fgoddd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusolsson%2Fgoddd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusolsson%2Fgoddd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcusolsson","download_url":"https://codeload.github.com/marcusolsson/goddd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234563136,"owners_count":18853060,"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-07-31T19:01:05.073Z","updated_at":"2025-09-28T21:30:47.613Z","avatar_url":"https://github.com/marcusolsson.png","language":"Go","funding_links":["https://buymeacoffee.com/marcusolsson"],"categories":["Go","Sample Projects"],"sub_categories":["GO"],"readme":"# GoDDD \r\n\r\n[![Build Status](https://travis-ci.org/marcusolsson/goddd.svg?branch=master)](https://travis-ci.org/marcusolsson/goddd)\r\n[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/marcusolsson/goddd)\r\n[![Go Report Card](https://goreportcard.com/badge/github.com/marcusolsson/goddd)](https://goreportcard.com/report/github.com/marcusolsson/goddd)\r\n[![License MIT](https://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat)](LICENSE)\r\n![stability-unstable](https://img.shields.io/badge/stability-unstable-yellow.svg)\r\n\r\nThis is an attempt to port the [DDD Sample App](https://github.com/citerus/dddsample-core) to idiomatic Go. This project aims to:\r\n\r\n- Demonstrate how the tactical design patterns from Domain Driven Design may be implemented in Go. \r\n- Serve as an example of a modern production-ready enterprise application.\r\n\r\n### Important note\r\n\r\nThis project is intended for inspirational purposes and should **not** be considered a tutorial, guide or best-practice neither how to implement Domain Driven Design nor enterprise applications in Go. Make sure you adapt the code and ideas to the requirements of your own application.\r\n\r\n## Porting from Java\r\n\r\nThe original application is written in Java and much thought has been given to the domain model, code organization and is intended to be an example of what you might find in an enterprise system.\r\n\r\nI started out by first rewriting the original application, as is, in Go. The result was hardly idiomatic Go and I have since tried to refactor towards something that is true to the Go way. This means that you will still find oddities due to the application's Java heritage. If you do, please let me know so that we can weed out the remaining Java.\r\n\r\n## Running the application\r\n\r\nStart the application on port 8080 (or whatever the `PORT` variable is set to).\r\n\r\n```\r\ngo run main.go -inmem\r\n```\r\n\r\nIf you only want to try it out, this is enough. If you are looking for full functionality, you will need to have a [routing service](https://github.com/marcusolsson/pathfinder) running and start the application with `ROUTINGSERVICE_URL` (default: `http://localhost:7878`).\r\n\r\n### Docker\r\n\r\nYou can also run the application using Docker.\r\n\r\n```\r\n# Start routing service\r\ndocker run --name some-pathfinder marcusolsson/pathfinder\r\n\r\n# Start application\r\ndocker run --name some-goddd \\\r\n  --link some-pathfinder:pathfinder \\\r\n  -p 8080:8080 \\\r\n  -e ROUTINGSERVICE_URL=http://pathfinder:8080 \\\r\n  marcusolsson/goddd -inmem\r\n```\r\n\r\n... or if you're using Docker Compose:\r\n\r\n```\r\ndocker-compose up\r\n```\r\n\r\n## Try it!\r\n\r\n```\r\n# Check out the sample cargos\r\ncurl localhost:8080/booking/v1/cargos\r\n\r\n# Book new cargo\r\ncurl localhost:8080/booking/v1/cargos -d '{\"origin\": \"SESTO\", \"destination\": \"FIHEL\", \"arrival_deadline\": \"2016-03-21T19:50:24Z\"}'\r\n\r\n# Request possible routes for sample cargo ABC123\r\ncurl localhost:8080/booking/v1/cargos/ABC123/request_routes\r\n```\r\n\r\n## Contributing\r\n\r\nIf you want to fork the repository, follow these step to avoid having to rewrite the import paths.\r\n\r\n```shell\r\ngo get github.com/marcusolsson/goddd\r\ncd $GOPATH/src/github.com/marcusolsson/goddd\r\ngit remote add fork git://github.com:\u003cyourname\u003e/goddd.git\r\n\r\n# commit your changes\r\n\r\ngit push fork\r\n```\r\n\r\nFor more information, read [this](http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html).\r\n\r\n## Additional resources\r\n\r\n### For watching\r\n\r\n- [Building an Enterprise Service in Go](https://www.youtube.com/watch?v=twcDf_Y2gXY) at Golang UK Conference 2016\r\n\r\n### For reading\r\n\r\n- [Domain Driven Design in Go: Part 1](http://www.citerus.se/go-ddd)\r\n- [Domain Driven Design in Go: Part 2](http://www.citerus.se/part-2-domain-driven-design-in-go)\r\n- [Domain Driven Design in Go: Part 3](http://www.citerus.se/part-3-domain-driven-design-in-go)\r\n\r\n### Related projects\r\n\r\nThe original application uses a external routing service to demonstrate the use of _bounded contexts_. For those who are interested, I have ported this service as well:\r\n\r\n[pathfinder](https://github.com/marcusolsson/pathfinder)\r\n\r\nTo accompany this application, there is also an AngularJS-application to demonstrate the intended use-cases.\r\n\r\n[dddelivery-angularjs](https://github.com/marcusolsson/dddelivery-angularjs)\r\n\r\nAlso, if you want to learn more about Domain Driven Design, I encourage you to take a look at the [Domain Driven Design](http://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215) book by Eric Evans.\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcusolsson%2Fgoddd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcusolsson%2Fgoddd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcusolsson%2Fgoddd/lists"}