通过资产关系管理、日常支出追踪、投资分析,帮助家庭实现 FIRE(财务独立/提前退休)
| 模块 | 功能 |
|---|---|
| 资产分类 | 四维度分类(性质/用途/持有/流动性)+ 自由标签 + 自定义分类 |
| 生命周期 | 六种轨迹:折旧/消耗/到期/增值/波动/稳定 |
| 资产关系 | 10种关系类型,可视化关系图谱 |
| FIRE引擎 | 净资产/储蓄率/FIRE数字/蒙特卡洛模拟 |
| 投资追踪 | A股+美股+加密货币+基金,实时价格 |
| 负债管理 | 房贷/车贷/信用卡/消费贷,月供计算 |
| 收支管理 | 月度预算/年度统计/收支模板 |
| 家庭协作 | 邀请码加入,防重复提醒,权限管理 |
| 文档管理 | 说明书/保修书在线预览 |
| 通知系统 | 到期提醒/变动通知/实时推送 |
git clone https://github.com/cnomel/family-fire.git
cd family-fire
chmod +x deploy.sh
./deploy.sh脚本支持:
- 内网部署(局域网访问)
- 公网部署(域名+SSL)
- 自动配置数据库、Redis、MinIO
- 自动构建APK
# 后端
cd backend
uv sync --all-extras
uv run python scripts/init_db.py
uv run uvicorn app.main:app --reload
# 前端
cd frontend
flutter pub get
flutter rundocker-compose up -d部署完成后访问:
- API 文档: http://localhost:8000/docs
- 默认管理员: admin / Admin@123456
- APK下载: http://localhost/downloads/family-fire-latest.apk
| 层级 | 技术 |
|---|---|
| 后端 | FastAPI + SQLModel + PostgreSQL + Redis + MinIO |
| 前端 | Flutter 3.x + Riverpod + fl_chart |
| 任务队列 | Celery + Redis |
| 包管理 | uv (Python), pub (Flutter) |
| 容器化 | Docker + Docker Compose |
| 反向代理 | Nginx |
family-fire/
├── backend/ # FastAPI 后端
│ ├── app/
│ │ ├── auth/ # 认证 (JWT/RBAC)
│ │ ├── users/ # 用户管理
│ │ ├── families/ # 家庭管理
│ │ ├── assets/ # 资产管理 (含生命周期/关系/分类)
│ │ ├── finance/ # 财务 (收支/投资/FIRE/预算)
│ │ ├── documents/ # 文档管理
│ │ └── notifications/ # 通知系统
│ ├── scripts/ # 初始化脚本
│ └── tests/ # 182+ 测试
├── frontend/ # Flutter 前端
│ └── lib/
│ ├── features/ # 功能模块
│ │ ├── assets/ # 资产管理
│ │ ├── finance/ # 财务管理
│ │ ├── home/ # 首页仪表盘
│ │ └── settings/ # 设置
│ └── shared/ # 共享组件
├── nginx/ # Nginx配置
├── scripts/ # 部署脚本
├── downloads/ # APK下载目录
├── deploy.sh # 一键部署脚本
├── docker-compose.yml # 开发环境
└── docker-compose.prod.yml # 生产环境
- 🔴 红涨绿跌(红色=盈利,绿色=亏损)
- 💰 ¥货币格式 + 万/亿大数单位
- 📋 标准中文支出/收入分类(参考支付宝/随手记)
- 👤 用户名+邮箱双登录
- 🔒 隐私模式(默认隐藏金额)
构建APK前,需要配置后端API地址。编辑 frontend/lib/config/env.dart:
class EnvConfig {
// 生产环境:填入你的域名或IP
static const String apiBaseUrl = 'http://your-domain.com';
static const String wsUrl = 'ws://your-domain.com';
}| 场景 | apiBaseUrl |
|---|---|
| 生产环境 | http://your-domain.com |
| Android模拟器 | http://10.0.2.2:8000 |
| iOS模拟器 | http://localhost:8000 |
| 真机调试 | http://<电脑IP>:8000 |
构建APK:
cd frontend
flutter build apk --release详细部署文档请参考 DEPLOY.md
# 一键部署
./deploy.sh
# 单独构建APK
./scripts/build_apk.sh# 查看服务状态
docker compose -f docker-compose.prod.yml ps
# 查看日志
docker compose -f docker-compose.prod.yml logs -f
# 停止服务
docker compose -f docker-compose.prod.yml down
# 重启服务
docker compose -f docker-compose.prod.yml restart./scripts/backup.sh备份内容:
- PostgreSQL 数据库(dump + SQL 格式)
- MinIO 文件数据
- 配置文件(.env.prod、docker-compose、nginx)
备份文件存储在 backups/ 目录,自动压缩为 .tar.gz,自动清理 30 天前的旧备份。
./scripts/restore.sh- 列出所有可用备份
- 交互式选择要恢复的备份
- 恢复前确认提示
- 自动停止/重启相关服务
./scripts/setup_backup.sh可选频率:
- 每天凌晨 2 点(推荐)
- 每天凌晨 3 点
- 每周日凌晨 2 点
- 自定义 cron 表达式
查看定时任务:crontab -l
欢迎贡献!请阅读 CONTRIBUTING.md。
本项目基于 MIT 协议 开源。
| Module | Features |
|---|---|
| Asset Classification | 4-dimension classification + free tags + custom categories |
| Lifecycle | 6 trajectories: depreciating/consumable/expiring/appreciating/volatile/stable |
| Relationships | 10 relationship types, visual graph |
| FIRE Engine | Net worth/savings rate/FIRE number/Monte Carlo simulation |
| Investment | A-shares + US stocks + crypto + funds, real-time prices |
| Liabilities | Mortgage/auto loan/credit card/consumer loan |
| Budget | Monthly budget / yearly stats / budget templates |
| Family | Invite codes, duplicate alerts, permission management |
| Documents | Online preview for manuals/warranties |
| Notifications | Expiry reminders, change alerts, real-time push |
git clone https://github.com/cnomel/family-fire.git
cd family-fire
chmod +x deploy.sh
./deploy.shThe script supports:
- Internal network deployment (LAN access)
- Public network deployment (domain + SSL)
- Auto-configure database, Redis, MinIO
- Auto-build APK
# Backend
cd backend
uv sync --all-extras
uv run python scripts/init_db.py
uv run uvicorn app.main:app --reload
# Frontend
cd frontend
flutter pub get
flutter rundocker-compose up -dAfter deployment:
- API Docs: http://localhost:8000/docs
- Default Admin: admin / Admin@123456
- APK Download: http://localhost/downloads/family-fire-latest.apk
| Layer | Technology |
|---|---|
| Backend | FastAPI + SQLModel + PostgreSQL + Redis + MinIO |
| Frontend | Flutter 3.x + Riverpod + fl_chart |
| Task Queue | Celery + Redis |
| Package Manager | uv (Python), pub (Flutter) |
| Containerization | Docker + Docker Compose |
| Reverse Proxy | Nginx |
For detailed deployment instructions, see DEPLOY.md
# One-click deploy
./deploy.sh
# Build APK separately
./scripts/build_apk.sh# Check service status
docker compose -f docker-compose.prod.yml ps
# View logs
docker compose -f docker-compose.prod.yml logs -f
# Stop services
docker compose -f docker-compose.prod.yml down
# Restart services
docker compose -f docker-compose.prod.yml restart./scripts/backup.shBackup contents:
- PostgreSQL database (dump + SQL format)
- MinIO file data
- Configuration files (.env.prod, docker-compose, nginx)
Backup files are stored in backups/ directory, automatically compressed as .tar.gz, and auto-clean backups older than 30 days.
./scripts/restore.sh- List all available backups
- Interactive selection of backup to restore
- Confirmation before restore
- Auto stop/restart related services
./scripts/setup_backup.shOptions:
- Daily at 2 AM (Recommended)
- Daily at 3 AM
- Weekly on Sunday at 2 AM
- Custom cron expression
View scheduled tasks: crontab -l
Contributions are welcome! Please read CONTRIBUTING.md.
This project is licensed under the MIT License.