feat: 实现后端和管理后台基础架构
## 后端架构 (Go + Gin + GORM) - ✅ 完整的分层架构 (API/Service/Repository) - ✅ PostgreSQL数据库设计和迁移脚本 - ✅ JWT认证系统和权限控制 - ✅ 用户、照片、分类、标签等核心模型 - ✅ 中间件系统 (认证、CORS、日志) - ✅ 配置管理和环境变量支持 - ✅ 结构化日志和错误处理 - ✅ Makefile构建和部署脚本 ## 管理后台架构 (React + TypeScript) - ✅ Vite + React 18 + TypeScript现代化架构 - ✅ 路由系统和状态管理 (Zustand + TanStack Query) - ✅ 基于Radix UI的组件库基础 - ✅ 认证流程和权限控制 - ✅ 响应式设计和主题系统 ## 数据库设计 - ✅ 用户表 (角色权限、认证信息) - ✅ 照片表 (元数据、EXIF、状态管理) - ✅ 分类表 (层级结构、封面图片) - ✅ 标签表 (使用统计、标签云) - ✅ 关联表 (照片-标签多对多) ## 技术特点 - 🚀 高性能: Gin框架 + GORM ORM - 🔐 安全: JWT认证 + 密码加密 + 权限控制 - 📊 监控: 结构化日志 + 健康检查 - 🎨 现代化: React 18 + TypeScript + Vite - 📱 响应式: Tailwind CSS + Radix UI 参考文档: docs/development/saved-docs/
This commit is contained in:
76
backend/configs/config.yaml
Normal file
76
backend/configs/config.yaml
Normal file
@ -0,0 +1,76 @@
|
||||
app:
|
||||
name: "photography-backend"
|
||||
version: "1.0.0"
|
||||
environment: "development"
|
||||
port: 8080
|
||||
debug: true
|
||||
|
||||
database:
|
||||
host: "localhost"
|
||||
port: 5432
|
||||
username: "postgres"
|
||||
password: "password"
|
||||
database: "photography"
|
||||
ssl_mode: "disable"
|
||||
max_open_conns: 100
|
||||
max_idle_conns: 10
|
||||
conn_max_lifetime: 300
|
||||
|
||||
redis:
|
||||
host: "localhost"
|
||||
port: 6379
|
||||
password: ""
|
||||
database: 0
|
||||
pool_size: 100
|
||||
min_idle_conns: 10
|
||||
|
||||
jwt:
|
||||
secret: "your-secret-key-change-in-production"
|
||||
expires_in: "24h"
|
||||
refresh_expires_in: "168h"
|
||||
|
||||
storage:
|
||||
type: "local" # local, s3, minio
|
||||
local:
|
||||
base_path: "./uploads"
|
||||
base_url: "http://localhost:8080/uploads"
|
||||
s3:
|
||||
region: "us-east-1"
|
||||
bucket: "photography-uploads"
|
||||
access_key: ""
|
||||
secret_key: ""
|
||||
endpoint: ""
|
||||
|
||||
upload:
|
||||
max_file_size: 52428800 # 50MB
|
||||
allowed_types: ["image/jpeg", "image/png", "image/gif", "image/webp", "image/tiff"]
|
||||
thumbnail_sizes:
|
||||
- name: "small"
|
||||
width: 300
|
||||
height: 300
|
||||
- name: "medium"
|
||||
width: 800
|
||||
height: 600
|
||||
- name: "large"
|
||||
width: 1200
|
||||
height: 900
|
||||
|
||||
logger:
|
||||
level: "debug"
|
||||
format: "json"
|
||||
output: "file"
|
||||
filename: "logs/app.log"
|
||||
max_size: 100
|
||||
max_age: 7
|
||||
compress: true
|
||||
|
||||
cors:
|
||||
allowed_origins: ["http://localhost:3000", "https://photography.iriver.top"]
|
||||
allowed_methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"]
|
||||
allowed_headers: ["Origin", "Content-Length", "Content-Type", "Authorization"]
|
||||
allow_credentials: true
|
||||
|
||||
rate_limit:
|
||||
enabled: true
|
||||
requests_per_minute: 100
|
||||
burst: 50
|
||||
Reference in New Issue
Block a user