A clearly fast Python's codebase for building a service to serve HTTP, SSE, WS requests. Built with love by me. In the python-base-service, I have developed the following features, with ongoing features in the pipeline with FastAPI framework. A framework give strongly features to help developer can make web/app as soon as possible in 1, 2 days.:
- Support for working with configurations (Dev, Production, Default Values) with TOML
- Support for managing logs (Format, Output, Level)
- Support tracing with OpenTelemetry
- Support for database operations (RDBMS, MongoDB)
- Support for Authentication with JWT (Sample Payload, Create, GetClaims)
- Support for working with Kafka (Schema, Broker, Consumer)
- Support for Redis operations (Connect, Get, Set, Invalidate)
- Support for AWS S3 operations (Connect, Get, Upload)
- Support for Elasticsearch (Connect, Insert, Search)
- Support for middleware (Rate Limit, Blocking)
- Easy integration with HTTP request handling (Status, Response, graceful shutdown)
- Support common utils features with datetime, async, sync, loop
- Some very helpful documentations for learn clearly PYTHON
- Support for GRPC
- Support for Websocket
- Support for Ethereum
I will demo a project with this structure with MVP: Chat system like Chat GPT
- Support standard authentication functions (Sign In, Sign Up, Change Password, Get Profile)
- Support admin functions : Get all users, Block IP, Upgrade role, Rate Limit
- Support full-text search using ES's API - search message for user
- Support post notifications for user - example Crypto currency like BTC, ETH, BNB with use Kafka
- API documentations
- Export Postman file
# must run
Python 3.11.4
python3 -m venv venv
source venv/bin/active
# For dev
make install
make run
# for deploy
This repo folow set of conventions of naming classes, attributes, methods, packages, files in PEP8
-
Classes : CamelCase convention, example : MyClass
-
Attributes (Instance Variables) and methods: lowecase words separated by underscores - snake_case, example: my_attribute or my_method()
-
Packages and Modules(Files): Keep package and module names to a single word if possible, example: mypacakage or my_module, time ...
-
Function, variable name: Function name should be lowercase, snake_case: my_function(), my_variable
-
Constants: MY_CONSTANT
Read more
I was inspired by the repository : fastapi-best-practices