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
Clone this repository to your local machine:
https://github.com/miralabsai/document-service.git
Navigate to the project directory:
cd document-service
Create a virtual environment (recommended) using
venv
orvirtualenv
:# Using venv python -m venv venv # Activate the virtual environment source ./venv/Scripts/activate
Install the required dependencies:
pip install -r requirements.txt
Setting up Environment Variables
Copy the
.env.example
file to create a new.env
file:cp .env.example .env
Edit the
.env
file and provide appropriate values for the environment variables.
Running the service
To run the service, use the following command:
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.