goddd

command module
Version: v0.0.0-...-70f07a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2016 License: MIT Imports: 15 Imported by: 0

README

GoDDD

Build Status GoDoc License MIT

This is an attempt to port the DDD Sample App to idiomatic Go. This project aims to:

  • Demonstrate how the tactical design patterns from Domain Driven Design may be implemented in Go.
  • Serve as an example of a modern production-ready enterprise application.
Important note

This 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.

Porting from Java

The 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.

I 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.

Running the application

Start the application on port 8080 (or whatever the PORT variable is set to).

go run main.go

If 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 running and start the application with ROUTINGSERVICE_URL (default: http://localhost:7878).

Docker

You can also run the application using Docker.

# Start routing service
docker run --name some-pathfinder marcusolsson/pathfinder

# Start application
docker run --name some-goddd \
  --link some-pathfinder:pathfinder \
  -p 8080:8080 \
  -e ROUTINGSERVICE_URL=http://pathfinder:8080 \
  marcusolsson/goddd

Try it!

# Check out the sample cargos
curl localhost:8080/booking/v1/cargos

# Book new cargo
curl localhost:8080/booking/v1/cargos -d '{"origin": "SESTO", "destination": "FIHEL", "arrival_deadline": "2016-03-21T19:50:24Z"}'

# Request possible routes for sample cargo ABC123
curl localhost:8080/booking/v1/cargos/ABC123/request_routes

REST API

Each application service is exposed as a API. If you want to try it out for yourself, the documentation is available here:

Additional resources

The 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:

pathfinder

To accompany this application, there is also an AngularJS-application to demonstrate the intended use-cases.

dddelivery-angularjs

Also, if you want to learn more about Domain Driven Design, I encourage you to take a look at the Domain Driven Design book by Eric Evans.

Documentation

The Go Gopher

There is no documentation for this package.

Source Files

Directories

Path Synopsis
Godeps
_workspace/src/code.google.com/p/go-uuid/uuid
The uuid package generates and inspects UUIDs.
The uuid package generates and inspects UUIDs.
_workspace/src/github.com/afex/hystrix-go/hystrix
Package hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable.
Package hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable.
_workspace/src/github.com/go-kit/kit/log
Package log provides basic interfaces for structured logging.
Package log provides basic interfaces for structured logging.
_workspace/src/github.com/go-kit/kit/log/term
Package term provides tools for logging to a terminal.
Package term provides tools for logging to a terminal.
_workspace/src/github.com/gorilla/context
Package context stores values shared during a request lifetime.
Package context stores values shared during a request lifetime.
_workspace/src/github.com/gorilla/mux
Package gorilla/mux implements a request router and dispatcher.
Package gorilla/mux implements a request router and dispatcher.
_workspace/src/github.com/sony/gobreaker
Package gobreaker implements the Circuit Breaker pattern.
Package gobreaker implements the Circuit Breaker pattern.
_workspace/src/github.com/streadway/handy/breaker
Package breaker implements a circuit breaker with configurable failure thresholds.
Package breaker implements a circuit breaker with configurable failure thresholds.
_workspace/src/golang.org/x/net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
_workspace/src/golang.org/x/net/context/ctxhttp
Package ctxhttp provides helper functions for performing context-aware HTTP requests.
Package ctxhttp provides helper functions for performing context-aware HTTP requests.
_workspace/src/gopkg.in/check.v1
Package check is a rich testing extension for Go's testing package.
Package check is a rich testing extension for Go's testing package.
_workspace/src/gopkg.in/logfmt.v0
Package logfmt implements utilities to marshal and unmarshal data in the logfmt format.
Package logfmt implements utilities to marshal and unmarshal data in the logfmt format.
_workspace/src/gopkg.in/stack.v1
Package stack implements utilities to capture, manipulate, and format call stacks.
Package stack implements utilities to capture, manipulate, and format call stacks.
Package booking provides the use-case of booking a cargo.
Package booking provides the use-case of booking a cargo.
Package cargo contains the heart of the domain model.
Package cargo contains the heart of the domain model.
Package handling provides the use-case for registering incidents.
Package handling provides the use-case for registering incidents.
Package inspection provides means to inspect cargos.
Package inspection provides means to inspect cargos.
Package location provides the Location aggregate.
Package location provides the Location aggregate.
Package repository provides implementations of all the domain repositories.
Package repository provides implementations of all the domain repositories.
Package routing provides the routing domain service.
Package routing provides the routing domain service.
Package tracking provides the use-case of tracking a cargo.
Package tracking provides the use-case of tracking a cargo.
Package voyage provides the Voyage aggregate.
Package voyage provides the Voyage aggregate.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL