|
# Miralabs Backend
|
|
|
|
## Overview
|
|
|
|
Miralabs Backend is a comprehensive back-end system that supports various services for the Miralabs platform. It includes services for AI, authentication, communication, document management, loans, and users.
|
|
|
|
## Folder Structure
|
|
|
|
Below is a brief overview of the key directories and files in this project:
|
|
|
|
```
|
|
miralabs-backend/
|
|
βββ .github/ # GitHub-specific files and actions
|
|
βββ .vscode/ # Visual Studio Code settings
|
|
βββ ai_service/ # AI service module
|
|
βββ auth-service/ # Authentication service module
|
|
βββ communication-service/ # Communication service module
|
|
βββ document_service/ # Document management service module
|
|
βββ loan_service/ # Loan service module
|
|
βββ user_service/ # User management service module
|
|
βββ .gitignore # Git ignored files
|
|
βββ .pre-commit-config.yaml # Pre Commit config file
|
|
βββ README.md # Project README file
|
|
βββ requirements.txt # Common dependencies
|
|
```
|
|
|
|
## Setup
|
|
|
|
### Prerequisites
|
|
|
|
- Python 3.x
|
|
- Database (e.g., PostgreSQL, MySQL)
|
|
|
|
### Installation
|
|
|
|
1. **Clone the repository:**
|
|
|
|
```sh
|
|
git clone <repository_url>
|
|
cd miralabs-backend
|
|
```
|
|
|
|
2. **Create and Activate VirtualEnv:**
|
|
|
|
- Create venv
|
|
```
|
|
python -m venv venv
|
|
```
|
|
- Activate in Mac
|
|
```
|
|
source .venv/bin/activate
|
|
```
|
|
- Activate in Windows
|
|
```
|
|
.venv/Source/Activate
|
|
```
|
|
|
|
3. **Install dependencies:**
|
|
|
|
Replace _[respective-service-folder-name]_ with any of the following available services:
|
|
|
|
- loan-service
|
|
- user-service
|
|
- document-service
|
|
- ai-service
|
|
|
|
```sh
|
|
pip install -r [respective-service-folder-name]/requirements.txt
|
|
```
|
|
|
|
4. **Run pre-commit install command**
|
|
|
|
Run this command at the root directory
|
|
|
|
```
|
|
pre-commit install
|
|
```
|
|
|
|
5. **Create .env file inside respective service folder**
|
|
|
|
```
|
|
cd loan-service
|
|
cp .env.example .env
|
|
```
|
|
|
|
6. **Run DB migrations:**
|
|
|
|
```sh
|
|
cd loan-service
|
|
alembic upgrade head
|
|
```
|
|
|
|
7. **Start the services:**
|
|
Each service can be started individually. For example, to start the `ai-service`:
|
|
```sh
|
|
cd ai-service
|
|
uvicorn app.main:app --reload --port 8002
|
|
```
|
|
|