BASE3

BASE3 is a Python web framework based on Tornado asynchronous networking library, developed by Digital Cube team for internal use. It is also available to the open source community to use however they wish and contribute to.

Hello world

import base

@base.route("/")
class IndexHandler(base.Base):

    @base.api()
    async def get(self):
        return {"message": "Hello World"}

if __name__ == "__main__":
    base.run()

BASE principles

  • Implementation of code reusability for common operations (user management, registration, email sending, PDF generation)
  • Simple to use and get going
  • Great for onboarding new programmers (with and without Python experience)
  • Scalability and microservices

Main features

  • Methods and recipes for making REST API based application
  • Bundled Python tools for a seamless start
  • Python decorators for code reusability and common functionalities
  • Authentication using different identity providers (Google, Facebook…)
  • Tool for generating source code templates
  • Auto-generation of API specification
  • Flexibility in the scale and purpose of the application (small, template driven websites to complex async microservice application)
  • Education

Main goals

  • Making of REST APIs with focus on business and underlying logic rather than the tools themselves
  • Reduction of the amount of effort needed to bootstrap
  • Microservice organized architecture with common microservices already written and maintained for current and future projects
  • Automatic parameter validation with using Models as the schema
  • Test Driven Development
  • Use of template engines for simple server-side rendered websites

Technologies

  • Python 3.x
    • tornadoweb (web framework and asynchronous networking library)
  • Database:
    • Currently implemented PostgreSQL using SQLAlchemy ORM, but also other popular open source RDBMS will be supported soon
    • CRUD implementation in API calls (with the use of Models as types)
    • Reduction of the amount of duplicated code for simple CRUD operations
  • Redis
  • Docker

Common services

  • Implementing and maintaining common microservices to encourage code reuse
  • Users / Authentication
  • Sending emails
  • PDF generator
  • Blog
  • Multitenancy