|
# Introduction
|
|
|
|
This microservice comprehensively manages all aspects pertaining to user documents. From creation to retrieval and updates, it efficiently handles all operations related to user documents, ensuring seamless functionality and accessibility.
|
|
|
|
## Tech Stack
|
|
|
|
### Backend Framework:
|
|
|
|
- **FastAPI:** Employed as the backend framework, FastAPI offers a high-performance, Python-based platform for crafting APIs. Its asynchronous capabilities enable efficient handling of concurrent requests, making it well-suited for modern web development.
|
|
|
|
### Database:
|
|
|
|
- **Azure Cosmos DB:** Selected as the database solution, Azure Cosmos DB provides a globally distributed, multi-model database service. Its scalability and flexibility empower seamless storage and management of diverse data types, facilitating the development of robust and adaptable applications.
|
|
- **Azure Blob Storage:** Azure Blob Storage is utilized for storing documents and files, complementing the system's capabilities to efficiently manage and organize non-relational data.
|
|
|
|
### Monitoring:
|
|
|
|
- **Azure Application Insights:** Integrated for monitoring the application, Azure Application Insights provides comprehensive insights into application performance, usage, and issues, enabling proactive management and optimization.
|
|
|
|
## Functionality
|
|
|
|
- **User Document CRUD:** Seamlessly handles CRUD operations for user documents, providing essential functionalities such as creation, retrieval, updating, and deletion. Access these APIs via the router at `/file` .
|
|
|
|
## Installation
|
|
|
|
1. Clone this repository to your local machine:
|
|
|
|
```bash
|
|
https://github.com/miralabsai/document-service.git
|
|
```
|
|
|
|
2. Navigate to the project directory:
|
|
|
|
```bash
|
|
cd document-service
|
|
```
|
|
|
|
3. Create a virtual environment (recommended) using `venv` or `virtualenv`:
|
|
|
|
```bash
|
|
# Using venv
|
|
python -m venv venv
|
|
|
|
# Activate the virtual environment
|
|
source ./venv/Scripts/activate
|
|
```
|
|
|
|
4. Install the required dependencies:
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
## Setting up Environment Variables
|
|
|
|
1. Copy the `.env.example` file to create a new `.env` file:
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
2. Edit the `.env` file and provide appropriate values for the environment variables.
|
|
|
|
## Running the service
|
|
|
|
To run the service, use the following command:
|
|
|
|
```bash
|
|
python -m uvicorn app.main:app --reload --port 5001
|
|
```
|
|
|
|
This will start the server on http://localhost:5001.
|
|
|
|
You can now access the Swagger UI for interactive documentation at http://localhost:5001/docs.
|
|
|
|
|
|
|
|
|
|
|