|
| 1 | + |
| 2 | + |
1 | 3 | # ArchiveNote |
| 4 | + |
| 5 | +一款支持文件、笔记双向关联的轻量级管理系统 |
| 6 | + |
| 7 | +[在线演示](https://demo.archivenote.org/) |
| 8 | + |
| 9 | +## 🚀 部署 |
| 10 | + |
| 11 | +### 使用 Docker |
| 12 | + |
| 13 | +```bash |
| 14 | +# 构建并启动容器 |
| 15 | +docker pull ghcr.io/qwasfun/archivenote:latest |
| 16 | + |
| 17 | +docker run -d -p 2601:2601 -v $(pwd)/data:/app/data -e SECRET_KEY=your-production-secret-key ghcr.io/qwasfun/archivenote:latest |
| 18 | +``` |
| 19 | + |
| 20 | +访问 http://localhost:2601 |
| 21 | + |
| 22 | +### Docker Compose |
| 23 | + |
| 24 | +创建 `docker-compose.yml`: |
| 25 | + |
| 26 | +```yaml |
| 27 | +services: |
| 28 | + archivenote: |
| 29 | + image: ghcr.io/qwasfun/archivenote:latest |
| 30 | + container_name: archivenote |
| 31 | + ports: |
| 32 | + - "2601:2601" |
| 33 | + volumes: |
| 34 | + - ./data:/app/data |
| 35 | + environment: |
| 36 | + - SECRET_KEY=your-production-secret-key |
| 37 | + # - DATABASE_URL: postgres://postgres:password@localhost:5432/postgres |
| 38 | + restart: unless-stopped |
| 39 | +``` |
| 40 | +
|
| 41 | +运行: |
| 42 | +
|
| 43 | +```bash |
| 44 | +docker-compose up -d |
| 45 | +``` |
| 46 | + |
| 47 | +## 🔐 账户 |
| 48 | + |
| 49 | +第一位注册用户自动成为系统管理员,其他注册用户为普通用户 |
| 50 | + |
| 51 | +## 💻 本地开发 |
| 52 | + |
| 53 | +### 前置要求 |
| 54 | + |
| 55 | +- Python 3.13 |
| 56 | +- Node.js 24 |
| 57 | +- npm |
| 58 | + |
| 59 | +### 环境配置 |
| 60 | + |
| 61 | +创建 `api/.env` 文件配置环境变量: |
| 62 | + |
| 63 | +```env |
| 64 | +# 数据库配置 |
| 65 | +DATABASE_URL=sqlite+aiosqlite:///./data/app.db |
| 66 | +# DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/dbname |
| 67 | +
|
| 68 | +# JWT 配置 |
| 69 | +SECRET_KEY=your-secret-key-here |
| 70 | +ACCESS_TOKEN_EXPIRE_MINUTES=30 |
| 71 | +REFRESH_TOKEN_EXPIRE_DAYS=7 |
| 72 | +ALGORITHM=HS256 |
| 73 | +``` |
| 74 | + |
| 75 | +### 后端设置 |
| 76 | + |
| 77 | +```bash |
| 78 | +cd api |
| 79 | + |
| 80 | +# 创建虚拟环境 |
| 81 | +python -m venv .venv |
| 82 | +source .venv/bin/activate # Windows: .venv\Scripts\activate |
| 83 | + |
| 84 | +# 安装依赖 |
| 85 | +pip install uv |
| 86 | +uv sync |
| 87 | + |
| 88 | +# 运行数据库迁移 |
| 89 | +alembic upgrade head |
| 90 | + |
| 91 | +# 启动开发服务器 |
| 92 | +python main.py |
| 93 | +``` |
| 94 | + |
| 95 | +后端将在 http://localhost:8000 运行 |
| 96 | + |
| 97 | +### 前端设置 |
| 98 | + |
| 99 | +```bash |
| 100 | +cd web |
| 101 | + |
| 102 | +# 安装依赖 |
| 103 | +npm install |
| 104 | + |
| 105 | +# 启动开发服务器 |
| 106 | +npm run dev |
| 107 | +``` |
| 108 | + |
| 109 | +前端将在 http://localhost:5173 运行 |
| 110 | + |
| 111 | +## 📖 API 文档 |
| 112 | + |
| 113 | +启动后端服务后,访问以下地址查看自动生成的 API 文档: |
| 114 | + |
| 115 | +- Swagger UI: http://localhost:8000/docs |
| 116 | +- ReDoc: http://localhost:8000/redoc |
| 117 | + |
| 118 | +## 📚 数据库迁移 |
| 119 | + |
| 120 | +```bash |
| 121 | +cd api |
| 122 | + |
| 123 | +# 创建新迁移 |
| 124 | +alembic revision --autogenerate -m "描述" |
| 125 | + |
| 126 | +# 应用迁移 |
| 127 | +alembic upgrade head |
| 128 | + |
| 129 | +# 回滚迁移 |
| 130 | +alembic downgrade -1 |
| 131 | +``` |
| 132 | + |
| 133 | +## 🤝 贡献 |
| 134 | + |
| 135 | +欢迎贡献!请遵循以下步骤: |
| 136 | + |
| 137 | +1. Fork 本仓库 |
| 138 | +2. 创建特性分支 (`git checkout -b feature/AmazingFeature`) |
| 139 | +3. 提交更改 (`git commit -m 'Add some AmazingFeature'`) |
| 140 | +4. 推送到分支 (`git push origin feature/AmazingFeature`) |
| 141 | +5. 开启 Pull Request |
| 142 | + |
| 143 | +## 📄 许可证 |
| 144 | + |
| 145 | +本项目采用 MIT 许可证 - 查看 [LICENSE](LICENSE) 文件了解详情 |
| 146 | + |
| 147 | +## 📧 联系方式 |
| 148 | + |
| 149 | +如有问题或建议,请提交 Issue 或 Pull Request。 |
| 150 | + |
| 151 | +--- |
| 152 | + |
| 153 | +⭐ 如果这个项目对您有帮助,请给个 Star! |
0 commit comments