Metadata-Version: 2.4
Name: fastapi-mongo-base
Version: 0.10.5
Summary: A simple boilerplate application, including models and schemas and abstract router, for FastAPI with MongoDB
Author-email: Mahdi Kiani <mahdikiany@gmail.com>
Maintainer-email: Mahdi Kiani <mahdikiany@gmail.com>
License: Copyright (c) 2016 The Python Packaging Authority (PyPA)
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of
        this software and associated documentation files (the "Software"), to deal in
        the Software without restriction, including without limitation the rights to
        use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
        of the Software, and to permit persons to whom the Software is furnished to do
        so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/mahdikiani/fastapi-mongo-base-app
Project-URL: Bug Reports, https://github.com/mahdikiani/fastapi-mongo-base-app/issues
Project-URL: Funding, https://github.com/mahdikiani/fastapi-mongo-base-app
Project-URL: Say Thanks!, https://saythanks.io/to/mahdikiani
Project-URL: Source, https://github.com/mahdikiani/fastapi-mongo-base-app
Keywords: fastapi,mongodb,beanie
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: pydantic>=2.0.0
Requires-Dist: httpx>=0.24.0
Requires-Dist: singleton_package
Requires-Dist: json-advanced
Requires-Dist: fastapi>=0.65.0
Requires-Dist: uvicorn[standard]>=0.13.0
Provides-Extra: image
Requires-Dist: Pillow>=9.0.0; extra == "image"
Provides-Extra: test
Requires-Dist: coverage; extra == "test"
Dynamic: license-file

# FastAPI MongoDB Base

A powerful boilerplate application for building FastAPI applications with MongoDB integration. This package provides a solid foundation with pre-configured models, schemas, and abstract routers to help you start your development project quickly.

## Features

- 🚀 **FastAPI Integration**: Built on top of FastAPI for high performance and easy-to-use API development
- 📦 **MongoDB Support**: Seamless integration with MongoDB using Beanie ODM
- 🔒 **Authentication Ready**: Built-in JWT authentication support
- 📝 **Pydantic Models**: Type-safe data validation and serialization
- 🎯 **Abstract Routers**: Pre-built abstract CRUD operations
- 🔄 **Caching Support**: Built-in caching mechanism for improved performance
- 🛠 **Task Management**: Background task handling capabilities
- 📸 **Image Processing**: Optional image processing support (requires Pillow)

## Installation

```bash
pip install fastapi-mongo-base
```

For image processing support:
```bash
pip install "fastapi-mongo-base[image]"
```

For development/testing:
```bash
pip install "fastapi-mongo-base[test]"
```

## Quick Start

1. Create a new FastAPI application:

```python
from fastapi import FastAPI
from fastapi_mongo_base import MongoBase

app = FastAPI()
mongo_base = MongoBase(app)

# Configure MongoDB connection
mongo_base.setup_mongodb(
    mongodb_url="mongodb://localhost:27017",
    database_name="your_database"
)
```

2. Create a model:

```python
from fastapi_mongo_base.models import BaseModel

class User(BaseModel):
    name: str
    email: str
```

3. Create a router:

```python
from fastapi_mongo_base.routes import BaseRouter

user_router = BaseRouter(User)
app.include_router(user_router, prefix="/users", tags=["users"])
```

## Requirements

- Python >= 3.9
- FastAPI >= 0.65.0
- Pydantic >= 2.0.0
- MongoDB
- Other dependencies as specified in pyproject.toml

## Project Structure

```
fastapi_mongo_base/
├── core/           # Core functionality and configurations
├── models.py       # Base models and database schemas
├── routes.py       # Abstract routers and endpoints
├── schemas.py      # Pydantic models for request/response
├── tasks.py        # Background task handling
├── cached.py       # Caching utilities
└── utils/          # Utility functions and helpers
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

## License

Distributed under the MIT License. See [LICENSE](LICENSE.txt) for more information.

## Author

- Mahdi Kiani - [GitHub](https://github.com/mahdikiani)

## Acknowledgments

- FastAPI team for the amazing framework
- MongoDB team for the powerful database
- All contributors who have helped shape this project
