Initial commit: ERV Platform MVP - FastAPI + React

This commit is contained in:
AI Assistant
2025-10-24 12:02:17 +03:00
commit 8af23e90fa
19 changed files with 1700 additions and 0 deletions

172
README.md Normal file
View File

@@ -0,0 +1,172 @@
# 🚀 ERV Insurance Platform
**Современная платформа для страховых обращений**
- **Backend**: Python FastAPI (async)
- **Frontend**: React 18 + TypeScript
- **Database**: PostgreSQL + MySQL + Redis
- **Queue**: RabbitMQ
- **Storage**: S3 Timeweb Cloud
---
## 🎯 Быстрый старт
### 📍 **Визуальный доступ:**
После запуска доступны по адресам:
```
Frontend (форма):
http://147.45.146.17:5173/
Backend API:
http://147.45.146.17:8100/
API Документация (Swagger UI):
http://147.45.146.17:8100/docs ← Интерактивная!
Gitea (Git репозиторий):
http://147.45.146.17:3002/
```
---
## 🔧 Установка и запуск
### **Backend (FastAPI):**
```bash
cd backend
# Создаём виртуальное окружение
python3 -m venv venv
source venv/bin/activate
# Устанавливаем зависимости
pip install -r requirements.txt
# Запускаем сервер
uvicorn app.main:app --reload --host 0.0.0.0 --port 8100
```
### **Frontend (React):**
```bash
cd frontend
# Устанавливаем зависимости
npm install
# Запускаем dev сервер
npm run dev -- --host 0.0.0.0 --port 5173
```
---
## 📊 Архитектура
### **Поток данных:**
```
React (5173) → FastAPI (8100) → [Redis, RabbitMQ, PostgreSQL]
OCR Service (8001)
OpenRouter AI
FlightAware API
PHP Bridge → Vtiger CRM
```
### **Что НЕ трогаем:**
✅ CRM Vtiger (работает как работала)
✅ MySQL полисы (только READ)
✅ Существующий PHP код
---
## 🗄️ Базы данных
| База | Назначение | Хост |
|------|------------|------|
| PostgreSQL | Логи, метрики, новые данные | 147.45.189.234:5432 |
| MySQL | Проверка полисов (READ) | localhost:3306 |
| Redis | Кеш, Rate Limiting | localhost:6379 |
---
## 📁 Структура проекта
```
erv_platform/
├─ backend/ ← Python FastAPI
│ ├─ app/
│ │ ├─ main.py
│ │ ├─ api/
│ │ ├─ services/
│ │ └─ models/
│ └─ requirements.txt
├─ frontend/ ← React TypeScript
│ ├─ src/
│ │ ├─ components/
│ │ ├─ pages/
│ │ └─ api/
│ └─ package.json
└─ .env ← Конфигурация
```
---
## 🔌 API Endpoints
### **Документы:**
- `POST /api/v1/documents/upload` - Загрузка в S3
- `POST /api/v1/documents/scan` - OCR + Vision
### **Рейсы:**
- `GET /api/v1/flights/check` - Проверка статуса
### **Обращения:**
- `POST /api/v1/claims/submit` - Создание обращения
### **Полисы:**
- `GET /api/v1/policies/verify` - Проверка полиса
---
## 🐛 Отладка
### **Логи:**
```bash
# FastAPI
tail -f backend/logs/app.log
# PostgreSQL логи
SELECT * FROM logs ORDER BY created_at DESC LIMIT 50;
```
---
## 📝 Git
```bash
# Репозиторий
http://147.45.146.17:3002/negodiy/erv-platform
# Клонирование
git clone http://147.45.146.17:3002/negodiy/erv-platform.git
# Push изменений
git add .
git commit -m "Your message"
git push origin main
```
---
**Автор**: AI Assistant + Фёдор
**Дата**: 24.10.2025