Một ứng dụng chat được hỗ trợ bởi AI với khả năng tích hợp các mô-đun MCP, streaming audio, MQTT, và nhiều tính năng advanced khác.
git clone <repository-url>
cd open_source
cp .env.example .env
# Chỉnh sửa .env với cấu hình của bạn
# Development mode
make dev
# Hoặc chạy trực tiếp
docker compose up -d
cd backend
# Tạo virtual environment
python -m venv venv
source venv/bin/activate
# Cài đặt dependencies
pip install -r requirements.txt
# Setup database
cd src
alembic upgrade head
# Chạy ứng dụng
cd ..
python run.py
cd frontend
# Cài đặt dependencies
npm install
# Chạy development server
npm run dev
.
├── backend/ # FastAPI backend
│ ├── src/
│ │ ├── app/ # Main application
│ │ │ ├── main.py # Entry point
│ │ │ ├── api/ # API routes
│ │ │ ├── models/ # SQLAlchemy models
│ │ │ ├── schemas/ # Pydantic schemas
│ │ │ ├── services/ # Business logic
│ │ │ ├── crud/ # Database operations
│ │ │ ├── core/ # Core utilities
│ │ │ ├── ai/ # AI/ML modules
│ │ │ └── middleware/ # Custom middleware
│ │ ├── migrations/ # Alembic migrations
│ │ └── alembic.ini
│ ├── tests/ # Test files
│ ├── scripts/ # Helper scripts
│ ├── requirements.txt
│ ├── requirements-dev.txt
│ ├── requirements-test.txt
│ ├── Dockerfile
│ ├── Makefile
│ └── README.md
│
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── hooks/ # Custom hooks
│ │ ├── services/ # API services
│ │ ├── store/ # Jotai state
│ │ ├── types/ # TypeScript types
│ │ ├── layouts/ # Layout templates
│ │ ├── locales/ # i18n translations
│ │ ├── App.tsx
│ │ └── main.tsx
│ ├── public/ # Static assets
│ ├── vite.config.ts
│ ├── tsconfig.json
│ ├── package.json
│ ├── Dockerfile
│ └── README.md
│
├── data/ # Data volumes
│ ├── backend/ # Backend data
│ ├── postgres/ # PostgreSQL data
│ ├── redis/ # Redis data
│ ├── mcp/ # MCP config
│ └── openmemory/ # Memory storage
│
├── scripts/ # Project scripts
│ └── init-volumes.sh # Initialize volumes
│
├── docker-compose.yml # Main compose file
├── docker-compose.dev.yml # Dev overrides
├── docker-compose.prod.yml # Production overrides
├── docker-compose.test.yml # Test overrides
├── default.conf # Nginx config
├── Makefile # Make commands
└── README.md # This file
make help # Hiển thị tất cả commands
make dev # Khởi động dev environment
make prod # Khởi động production environment
make down # Dừng tất cả containers
make ps # Liệt kê running containers
make logs # Xem logs tất cả services
make logs-backend # Xem logs backend
make logs-frontend # Xem logs frontend
make build # Build tất cả images
make rebuild # Rebuild without cache
make prune # Xóa unused resources
make shell # Truy cập shell backend
make backend # Khởi động backend service
make frontend # Khởi động frontend service
make db-shell # PostgreSQL shell
make redis-shell # Redis shell
make migrate # Run migrations
make db-backup # Backup database
make db-restore # Restore database
make health # Check services health
make test # Run tests
make coverage # Run tests with coverage
make lint # Lint code
make stop # Dừng services
make clean # Xóa containers
Xem backend/README.md để biết chi tiết:
Xem frontend/README.md để biết chi tiết:
# Khởi động test database
make docker-test-up
# Chạy tests
cd backend
make test
# Tests with coverage
make test-cov
# Cleanup
make docker-test-down
cd frontend
npm run test
# Database
DATABASE_URL=postgresql://user:password@postgres:5432/dbname
# Redis
REDIS_URL=redis://redis:6379
# JWT & Security
SECRET_KEY=your-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
# LLM Services
OPENAI_API_KEY=your-key
GOOGLE_API_KEY=your-key
# MQTT
MQTT_BROKER=mqtt
MQTT_PORT=1883
# Logging
LOG_LEVEL=INFO
VITE_API_BASE_URL=http://localhost:8000/api
Tất cả data được lưu trong data/ folder:
data/postgres/data/redis/data/backend/log/data/mcp/┌─────────────────────────────┐
│ Frontend (React) │
│ - UI Components │
│ - State Management (Jotai) │
│ - React Query │
└──────────────┬──────────────┘
│
┌──────▼──────┐
│ API Layer │
│ (Axios) │
└──────┬──────┘
│
┌──────────────▼─────────────────┐
│ Backend (FastAPI) │
│ - API Routes │
│ - Authentication │
│ - Business Logic │
│ - AI Integration │
└──────────────┬──────────────────┘
│
┌──────────┼──────────┐
│ │ │
┌───▼──┐ ┌────▼───┐ ┌──▼─────┐
│ DB │ │ Redis │ │ MQTT │
└──────┘ └────────┘ └────────┘
Frontend:
Backend:
DevOps:
make prod
File docker-compose.prod.yml chứa cấu hình production-optimized.
.env cho productionAPI documentation tự động tạo bởi FastAPI:
# Feature branch
git checkout -b feature/your-feature
# Commit with conventional commits
git commit -m "feat(backend): add new endpoint"
git commit -m "fix(frontend): fix button styling"
git commit -m "docs(readme): update setup guide"
# Push & create PR
git push origin feature/your-feature
Commit types: feat, fix, docs, style, refactor, test, chore
git checkout -b feature/amazing-featuregit commit -m "feat: description"git push origin feature/amazing-feature# Check PostgreSQL
make db-shell
# Or restart database
docker compose restart postgres
# Change ports in docker-compose.yml
# Or kill process
sudo lsof -i :3000 # for port 3000
# Fix script permissions
chmod +x scripts/*.sh
Nếu gặp vấn đề:
make logsXem file LICENSE để biết chi tiết.
Happy Coding! 🚀
Một ứng dụng chat được hỗ trợ bởi AI với khả năng tích hợp các mô-đun MCP, streaming audio, MQTT, và nhiều tính năng advanced khác.
git clone <repository-url>
cd open_source
cp .env.example .env
# Chỉnh sửa .env với cấu hình của bạn
# Development mode
make dev
# Hoặc chạy trực tiếp
docker compose up -d
cd backend
# Tạo virtual environment
python -m venv venv
source venv/bin/activate
# Cài đặt dependencies
pip install -r requirements.txt
# Setup database
cd src
alembic upgrade head
# Chạy ứng dụng
cd ..
python run.py
cd frontend
# Cài đặt dependencies
npm install
# Chạy development server
npm run dev
.
├── backend/ # FastAPI backend
│ ├── src/
│ │ ├── app/ # Main application
│ │ │ ├── main.py # Entry point
│ │ │ ├── api/ # API routes
│ │ │ ├── models/ # SQLAlchemy models
│ │ │ ├── schemas/ # Pydantic schemas
│ │ │ ├── services/ # Business logic
│ │ │ ├── crud/ # Database operations
│ │ │ ├── core/ # Core utilities
│ │ │ ├── ai/ # AI/ML modules
│ │ │ └── middleware/ # Custom middleware
│ │ ├── migrations/ # Alembic migrations
│ │ └── alembic.ini
│ ├── tests/ # Test files
│ ├── scripts/ # Helper scripts
│ ├── requirements.txt
│ ├── requirements-dev.txt
│ ├── requirements-test.txt
│ ├── Dockerfile
│ ├── Makefile
│ └── README.md
│
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── hooks/ # Custom hooks
│ │ ├── services/ # API services
│ │ ├── store/ # Jotai state
│ │ ├── types/ # TypeScript types
│ │ ├── layouts/ # Layout templates
│ │ ├── locales/ # i18n translations
│ │ ├── App.tsx
│ │ └── main.tsx
│ ├── public/ # Static assets
│ ├── vite.config.ts
│ ├── tsconfig.json
│ ├── package.json
│ ├── Dockerfile
│ └── README.md
│
├── data/ # Data volumes
│ ├── backend/ # Backend data
│ ├── postgres/ # PostgreSQL data
│ ├── redis/ # Redis data
│ ├── mcp/ # MCP config
│ └── openmemory/ # Memory storage
│
├── scripts/ # Project scripts
│ └── init-volumes.sh # Initialize volumes
│
├── docker-compose.yml # Main compose file
├── docker-compose.dev.yml # Dev overrides
├── docker-compose.prod.yml # Production overrides
├── docker-compose.test.yml # Test overrides
├── default.conf # Nginx config
├── Makefile # Make commands
└── README.md # This file
make help # Hiển thị tất cả commands
make dev # Khởi động dev environment
make prod # Khởi động production environment
make down # Dừng tất cả containers
make ps # Liệt kê running containers
make logs # Xem logs tất cả services
make logs-backend # Xem logs backend
make logs-frontend # Xem logs frontend
make build # Build tất cả images
make rebuild # Rebuild without cache
make prune # Xóa unused resources
make shell # Truy cập shell backend
make backend # Khởi động backend service
make frontend # Khởi động frontend service
make db-shell # PostgreSQL shell
make redis-shell # Redis shell
make migrate # Run migrations
make db-backup # Backup database
make db-restore # Restore database
make health # Check services health
make test # Run tests
make coverage # Run tests with coverage
make lint # Lint code
make stop # Dừng services
make clean # Xóa containers
Xem backend/README.md để biết chi tiết:
Xem frontend/README.md để biết chi tiết:
# Khởi động test database
make docker-test-up
# Chạy tests
cd backend
make test
# Tests with coverage
make test-cov
# Cleanup
make docker-test-down
cd frontend
npm run test
# Database
DATABASE_URL=postgresql://user:password@postgres:5432/dbname
# Redis
REDIS_URL=redis://redis:6379
# JWT & Security
SECRET_KEY=your-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
# LLM Services
OPENAI_API_KEY=your-key
GOOGLE_API_KEY=your-key
# MQTT
MQTT_BROKER=mqtt
MQTT_PORT=1883
# Logging
LOG_LEVEL=INFO
VITE_API_BASE_URL=http://localhost:8000/api
Tất cả data được lưu trong data/ folder:
data/postgres/data/redis/data/backend/log/data/mcp/┌─────────────────────────────┐
│ Frontend (React) │
│ - UI Components │
│ - State Management (Jotai) │
│ - React Query │
└──────────────┬──────────────┘
│
┌──────▼──────┐
│ API Layer │
│ (Axios) │
└──────┬──────┘
│
┌──────────────▼─────────────────┐
│ Backend (FastAPI) │
│ - API Routes │
│ - Authentication │
│ - Business Logic │
│ - AI Integration │
└──────────────┬──────────────────┘
│
┌──────────┼──────────┐
│ │ │
┌───▼──┐ ┌────▼───┐ ┌──▼─────┐
│ DB │ │ Redis │ │ MQTT │
└──────┘ └────────┘ └────────┘
Frontend:
Backend:
DevOps:
make prod
File docker-compose.prod.yml chứa cấu hình production-optimized.
.env cho productionAPI documentation tự động tạo bởi FastAPI:
# Feature branch
git checkout -b feature/your-feature
# Commit with conventional commits
git commit -m "feat(backend): add new endpoint"
git commit -m "fix(frontend): fix button styling"
git commit -m "docs(readme): update setup guide"
# Push & create PR
git push origin feature/your-feature
Commit types: feat, fix, docs, style, refactor, test, chore
git checkout -b feature/amazing-featuregit commit -m "feat: description"git push origin feature/amazing-feature# Check PostgreSQL
make db-shell
# Or restart database
docker compose restart postgres
# Change ports in docker-compose.yml
# Or kill process
sudo lsof -i :3000 # for port 3000
# Fix script permissions
chmod +x scripts/*.sh
Nếu gặp vấn đề:
make logsXem file LICENSE để biết chi tiết.
Happy Coding! 🚀