/train_train

Small POC with Elixir, Phoenix, Ecto, Commanded

Primary LanguageElixir

Build Status Coverage Status

TrainTrain

The goal here is to try to do a fully working event sourced system with elixir.

Used technologies

The steps

  • Having a working env
  • Having a working Phoenix and be able to display a page
  • Do a simple CRUD application
    • Create the table
    • Insert in the table
    • Display the elements of the table
    • Add modify and delete feature
    • Test everything, we are not that rude !
  • Add interfaces on top of the Ecto CRUD
  • add event sourcing on top of CRUD
    • Create an Aggregate
    • Be able to handle command
    • Be able to handle events
    • Be able to query a projection
    • Bind everything to a HTML GUI
    • Tests !!!
      • Test the aggregate
      • Test the projection
      • Test an event handler
  • Do some dependency injection
    • With Behaviour
  • Add some types with Typespec
  • Add travis-ci config
  • Add coveralls config
  • Learned skills by writing a software which handle train ticket reservation
  • Do some load tests, to see how it' goes

Notes

Ecto

To re-create the database, do :

mix ecto.drop
mix ecto.create
mix ecto.migrate

To create a new migration script, do : mix ecto.gen.migration

Dispatch an event : TrainTicket.Application.dispatch(%TrainTicket.Commands.Create{uuid: "4438a241-f50a-495c-b167-dd749aeb673f", name: "My event"})

Observer

Run the observer to display lot of information about the running elixir programs :observer.start

Tests

With ExUnit

  • run tests mix test
  • with coverage mix test --cover

Typings : typescpec

https://hexdocs.pm/elixir/typespecs.html

  • Create a type with @type
  • Create a signature with @spec
  • Verify everything with mix dialyzer