Coder Social home page Coder Social logo

shehanishanka / flask_restapi_clean_architecture Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chonhan/flask_restapi_clean_architecture

0.0 0.0 0.0 77 KB

A Clean Architecture Practice with Flask REST API

License: MIT License

Shell 0.43% Python 99.57%

flask_restapi_clean_architecture's Introduction

Flask REST API Clean Architecture Practice

A Clean Architecture Practice with Flask REST API.

This is a practice project I used to learn Clean Architecture by implementing the REST API with a full Authentication/Authorization Protocols, Dependency Injection and furthermore the Swagger documentation.

Basic Folder Structure

application.py

The major application declaration file.

apps

The Application Layer that defines API controller endpoint, global exceptions and also Request/Response/Presenter/Validator adapters.

config

Application Configuration files are here.

core

The core concept of the Clean Architecture practice. The kernel part is about the interface and abstract class definitions. The core part contains the business logic and the domains objects such as entity, value object, use case and also the repository.

extensions

Some configuration and plugins I used, to make the application itself cleaner.

infra

The Infrastructure Layer that provides the actual implementation of network, persistent, cache layer... etc.

tests

Test folder, not implemented yet.

Dependencies

  • flask: Base Web Framework
  • werkzeug: Utility Library under Flask
  • authlib: OpenID Connect Provider Library
  • flask-restplus = REST API, Swagger Library
  • flask-injector = Dependency Injection
  • attrs = Data Classes Utility LIbrary
  • cattrs = Serialization / Deserialization

Run the project

> pipenv sync

Enter Shell

> pipenv shell

Start App

> flask run

Sample API request

API Documentation

TODO Items for POC

  • Apply Clean Architecture
  • Layer Abstraction
  • Dependency Injection
  • UseCase Implementation
  • Serialization / Deserialization
  • Mock Repo Implementation
  • Handle Exceptions
  • Response Marshalling
  • Review usecase.execute() with Req/Resp
  • Review API Documentation
  • Implement Full Story with Entity, ValueObject
  • Request Validation with Marshmallow
  • Deal with Date/DateTime
  • Database with SQLAlchemy
  • Logging
  • OAuth2 with Authlib Implementation
  • Authentication to Resource API
  • Dev/Prod Configuration
  • Apply Tests
  • WSGI Settings

Reference

flask_restapi_clean_architecture's People

Contributors

chonhan avatar dependabot[bot] 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.