Coder Social home page Coder Social logo

jorzel / opentable Goto Github PK

View Code? Open in Web Editor NEW
28.0 4.0 2.0 117 KB

Clean architecture python application sample, with domain layer protected

License: MIT License

Python 100.00%
ddd clean-architecture python3 sqlalchemy nameko hexagonal-architecture port-and-adapters learning-materials

opentable's Introduction

Overview

Open table app for training purposes.

The project implements Ports and Adapters architecture in DDD style, trying to keep domain layer agnostic of external dependencies (ORM/DB, External Services).

Inner layers should not have any knowledge about outer layers. Application core (domain + application), should provide orchestration of whole business process exploiting existing ports. There are two types of ports:

  • primary port, that is an entry exposing application core to outside world. It is usually a fascade called by a primary adapter (e.g. REST API, CLI, etc.),
  • secondary port, enables application core to communicate with external world (e.g. database, mail sender, etc). It is an interface that is implemented by a secondary adapter.

The crucial thing here is that our application core does not have any knowledge about infrastructure and API, it operates only on interfaces. If we need a database access, we should define a repository interface and injected it into our service. Or, if there is a need for notification sending, we should make a notification sender interface that can be implemented by SMS or Email sender adapter in the infrastructure layer. But inside the application core we know nothing about infrastructure implementations (thanks to it the application logic can be easily unit tested). And this is the main gain of using this architecture.

Alt text

Install packages

>> pip install -r requirements.txt

Run nameko application

>> nameko run --config src/api/nameko/config.yml src.api.nameko

Run tests

>> pip install -r test_requirements.txt
>> pytest

opentable's People

Contributors

jorzel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

opentable's Issues

Suggest to loosen the dependency on nameko

Hi, your project opentable(commit id: 726b99a) requires "nameko==2.13.0" in its dependency. After analyzing the source code, we found that the following versions of nameko can also be suitable, i.e., nameko 2.7.0, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.9.0rc0, 2.9.0, 2.9.0-rc0, 2.9.1rc0, 2.9.1, 2.9.1-rc0, 2.10.0, 2.11.0, 2.12.0, 2.14.0, 2.14.1, since all functions that you directly (4 APIs: nameko.extensions.Entrypoint.decorator, nameko.events.EventDispatcher.init, nameko.extensions.Entrypoint.decorator, nameko.testing.services.worker_factory) or indirectly (propagate to 2 nameko's internal APIs and 4 outsider APIs) used from the package have not been changed in these versions, thus not affecting your usage.

Therefore, we believe that it is quite safe to loose your dependency on nameko from "nameko==2.13.0" to "nameko>=2.7.0,<=2.14.1". This will improve the applicability of opentable and reduce the possibility of any further dependency conflict with other projects.

May I pull a request to further loosen the dependency on nameko?

By the way, could you please tell us whether such an automatic tool for dependency analysis may be potentially helpful for maintaining dependencies easier during your development?

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.