Skip to content

ismael-benitez/ddd-playground

 
 

Repository files navigation

DDD Playground

Wallet API in Symfony following DDD (Domain Driver Design). Still a wip.

Examples in the repo

  • User authentication based in JWT
  • UUID as binary to improve the performance and create a nightmare for the dba.
  • Automated tasks with ant.
  • Dev and CI environments in Docker. Boosting build speed with docker cache layers in pipeline. Orchestrating with Docker Compose.
  • An example of table inheritance and discriminator strategy
  • How to deal with EAV (Entity-Attribute-Value) with Json data type.
  • Code structured in layers as appears in DDD in php book.
  • Test for api in behat accessing via web server (Acceptance tests).
  • Integration test with Lakion api test case and Alice for fixtures and how to integrate it with behat.
  • Command Bus implementation
  • DomainEvents
  • Events to RabbitMQ
  • Events stored in ElasticSearch and Kibana for reading in :5601  

The folder structure

src
  \
   |\ Application     `Contains the Use Cases of the domain system and the Data Transfer Objects`
   |
   |\ Domain          `The system business logic layer`
   |
   |\ Infrastructure  `Its the implementation of the system outside the model. I.E: Persistence, serialization, etc`
   |
    \ UI              `User Interface. This use to be inside the Infrastructure layer, but I don't like it.`

The tests

The tests follow the same structure and the phpunit tests are tagged with group tags: unit or functional.

The aceptation tests are inside the test UI layer and attack the application from outside using Guzzle.

The Environment

The environment is in PHP7.1 and the development containers are on etc/infrastructure/dev/docker-compose.yml

Run the environment with: docker-compose -f etc/infrastructure/dev/docker-compose.yml up -d

Start async listeners: docker-compose -f etc/infrastructure/dev/docker-compose.yml exec fpm bin/console rabbitmq:multiple-consumer events

  • Rabbit Management: :15672 Rabbit

  • Kibana: :5601 Kibana

CI/CD

Follow the Jenkinsfile or the gitlab-ci.yml file, it's clear enough and contains a simply workflow to:

  • build the isolated environment
  • docker-compose -p to avoid parallel jobs conflicts
  • provision the environment
  • run the test
  • extract reports
  • Build and store the artifacts (Docker images)
  • Clean the environment

About

DDD playground PHP project in symfony

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 94.7%
  • Gherkin 2.2%
  • HTML 1.8%
  • ApacheConf 1.3%