API for FastAPI Template - A platform for managing your projects with AI.
- Authentication: Secure user authentication using JWT.
- User Management: Create, read, update, and delete users.
- Chat Sessions: Real-time chat with session management.
- Code Context: Upload code repositories or zip files as context for AI chats.
- Asynchronous: Built with FastAPI for high performance.
- MongoDB: Uses MongoDB as the database.
- WebSocket Support: Real-time communication capabilities.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Python 3.12+
- uv
- Docker
-
Clone the repository:
git clone https://github.com/your-username/fastapi-template.git cd fastapi-template -
Run the installation script:
The
install.shscript will:- Install
poppler-utils. - Install Python and uv if they are not already installed.
- Install project dependencies using uv.
- Install Docker if it is not already installed.
- Pull and run MongoDB, Redis, and RabbitMQ Docker containers.
bash install.sh
- Install
To run the FastAPI application, use the following command:
make runThe application will be available at http://127.0.0.1:8000.
- Chat UI:
http://127.0.0.1:8000/static/chat_sessions.html - API Docs:
http://127.0.0.1:8000/docs - ReDoc:
http://127.0.0.1:8000/redoc
Comprehensive documentation is available in the docs/ folder:
- Code Context Feature - Complete guide to the code context feature
- Quick Start Guide - Step-by-step user guide
- Technical Documentation - API reference and implementation details
- All Documentation - Full documentation index
Test files are organized in the tests/ folder:
- Test Documentation - Testing guide and instructions
- Code Context Tests:
python3 tests/test_context_feature.py - WebSocket Tests:
python3 tests/test_websocket.py - Session Tests:
bash tests/test_sessions.sh
fastapi-template/
├── app/
│ ├── __init__.py
│ ├── main.py
│ ├── controllers/
│ │ └── users.py
│ ├── core/
│ │ └── settings.py
│ ├── dependencies/
│ │ └── auth.py
│ ├── middlewares/
│ │ └── cors_middleware.py
│ ├── models/
│ │ ├── base.py
│ │ ├── users.py
│ │ ├── chat_sessions.py
│ │ └── messages.py
│ ├── routers/
│ │ ├── auths.py
│ │ ├── users.py
│ │ ├── chat.py
│ │ └── chat_sessions.py
│ ├── schemas/
│ │ ├── auths.py
│ │ ├── users.py
│ │ ├── chat_sessions.py
│ │ └── messages.py
│ ├── static/
│ │ ├── chat.html
│ │ └── chat_sessions.html
│ └── utils/
│ ├── mongodb.py
│ └── superuser.py
├── docs/
│ ├── README.md
│ ├── FEATURE_README.md
│ ├── QUICK_START_GUIDE.md
│ └── CODE_CONTEXT_FEATURE.md
├── tests/
│ ├── README.md
│ ├── test_context_feature.py
│ └── test_websocket.py
├── docker-compose.yml
└── README.md
The project uses the following dependencies:
- fastapi: A modern, fast (high-performance), web framework for building APIs with Python 3.12+ based on standard Python type hints.
- uvicorn: A lightning-fast ASGI server implementation.
- motor: Asynchronous Python driver for MongoDB.
- python-jose: A JOSE implementation in Python.
- passlib: A library for hashing passwords.
- pydantic: Data validation and settings management using Python type annotations.
- google-auth: Google Authentication Library for Python.
- google-auth-oauthlib: Google Authentication Library for Python with OAuthlib integration.
- pydantic-settings: Pydantic settings management.
- python-multipart: A streaming multipart parser for Python.
- aiohttp: Asynchronous HTTP client/server framework.
- loguru: A library which aims to bring enjoyable logging in Python.
- aio-pika: An asynchronous AMQP client library for Python.
This project is licensed under the MIT License - see the LICENSE file for details.