I want this repository to be able to create a server that can handle HTTP requests, WebSocket requests, and gRPC in less than one day. This codebase should be available for immediate use whenever I have ideas related to AI or GPT. I have a funny example, check it out
A clear and fast Python codebase for building services that handle HTTP, SSE, and WS requests. In the fastapi-base-service, I have developed the following features, with ongoing features in the pipeline using the FastAPI framework. This framework provides robust features that enable developers to create web/apps quickly, within 1-2 days:
- Support for managing logs (Format, Output, Level).
- Support for database operations (RDBMS like Postgres, MongoDB).
- Support for Authentication with JWT (Sample Payload, Create, GetClaims).
- 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 utility features with datetime, async, sync, loop.
- Helpful documentation for learning Python clearly.
- Support for GRPC.
- Support for WebSocket.
Context : I have a wrapper chat GPT backend, give user request and send to LLM to get answer then stream for user. I will use this base service to built 2 main APIs : User can chat with LLM - SSE, User search message in chat history, some APIs users...
- Support standard authentication functions (Sign In, Sign Up, Change Password, Get Profile, Change API Key).
- Support full-text search using Elasticsearch's API to search messages for users.
- Support chat with LLM
- API documentation.
- Python and FastAPI documentation (configurations, conventions, HTTP).
This version improves readability and maintains your original format and intent.
# must run
Python 3.11.4
python3 -m venv venv
source venv/bin/active
# For dev
make install
make run
# for deploy
- What generator run ? async generator run ?
- what is block in asyncio ? bestpractice with even-loop ?
- Should we create connection pool like session in endpoints ?
- Why something openAPI docs not works ?
- Why I not used env file
- Python AsyncIO, a dificult things !
I was inspired by the repository : fastapi-best-practices