Giter Site home page Giter Site logo

inklabs / vote Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 0.0 117 KB

Demo application that implements Ranked Choice Voting in Go using a CQRS architecture

License: BSD 3-Clause "New" or "Revised" License

Go 97.51% Python 2.49%
cqrs cqrs-framework ddd go tdd

vote's Introduction

Ranked Choice Voting - Go CQRS

This is a demo application that implements Ranked Choice Voting, also known as Instant Runoff Voting, where voters rank candidates in order of preference, and a single winner is selected.

The sole purpose of this project is to demonstrate the capabilities of the (currently private) Go CQRS application framework.

Design

The architecture leverages Command Query Responsibility Segregation (CQRS). Business logic can be written in Commands, Queries, or Listeners.

Actions

Actions are Commands that modify state, or Queries that retrieve data. Commands can be asynchronously processed, with the status and log messages available for later retrieval.

Events

Events are used to remove temporal coupling between modules with separate responsibilities. Commands raise events and Listeners subscribe to them asynchronously.

  • Events
    • ElectionHasCommenced
    • ProposalWasMade
    • VoteWasCast
    • ElectionWasClosedByOwner
    • ElectionWinnerWasSelected

Listeners

Listeners subscribe to Events and execute code asynchronously.

Code Generation

The underlying Go CQRS application framework utilizes code generation to build the APIs and SDKs to execute this application. The Vote App uses go:generate directives to parse the domain and build various APIs. The generated output is not yet included in this project.

APIs

APIs are exposed through HTTP, gRPC, and CLI tooling.

Examples:

SDK

SDKs are auto-generated leveraging the gRPC clients.

Test

go generate .
go test ./...

Run

go run cmd/httpapi/main.go
go run cmd/grpcapi/main.go
go run cmd/cli-local/main.go --help

Test Python

go run cmd/grpcapi/main.go
python3 -m doctest python_test.py

vote's People

Contributors

pdt256 avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.