一个让用户给未来的自己写信的Web应用。用户可以在页面留下想对自己说的话,设置未来的收信时间,系统会在指定时间自动发送邮件给用户。
git clone <repository-url>
cd timemail
pnpm install
cd api
pip install -r requirements.txt
.env)VITE_API_BASE_URL=http://localhost:8000
VITE_APP_NAME=时光邮局
VITE_APP_VERSION=1.0.0
api/.env)# 数据库配置
DATABASE_URL=sqlite:///./timemail.db # 开发环境
# DATABASE_URL=postgresql://user:password@localhost:5432/timemail # 生产环境
# 邮件服务配置 (需要真实的SMTP服务)
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=your-email@gmail.com
SMTP_PASSWORD=your-app-password
SMTP_FROM_NAME=时光邮局
SMTP_FROM_EMAIL=noreply@timemail.com
# API配置
API_HOST=0.0.0.0
API_PORT=8000
API_RELOAD=true
# 定时任务配置
SCHEDULER_INTERVAL_MINUTES=5
# 启动前端和后端(同时运行)
pnpm fullstack
# 启动前端
pnpm dev
# 启动后端(在api目录下)
cd api
python main.py
# 或者
python -m uvicorn main:app --reload --host 0.0.0.0 --port 8000
POST /api/time-letters
Content-Type: application/json
{
"content": "亲爱的未来的我,希望你还记得今天的心情...",
"delivery_email": "user@example.com",
"delivery_time": "2024-12-31T10:00:00Z"
}
GET /api/time-letters/history?email=user@example.com
pnpm run test
cd api
pytest
pnpm build
timemail/
├── src/ # 前端源代码
│ ├── components/ # 可复用组件
│ ├── pages/ # 页面组件
│ ├── services/ # API服务
│ ├── store/ # 状态管理
│ ├── utils/ # 工具函数
│ └── router.tsx # 路由配置
├── api/ # 后端源代码
│ ├── app/ # 应用代码
│ │ ├── models/ # 数据模型
│ │ ├── routers/ # API路由
│ │ ├── services/ # 业务逻辑
│ │ └── utils/ # 工具函数
│ ├── migrations/ # 数据库迁移
│ └── main.py # 应用入口
├── public/ # 静态资源
├── package.json # 前端依赖
├── requirements.txt # 后端依赖
└── README.md # 项目文档
欢迎提交Issue和Pull Request来改进这个项目!
MIT License - 详见 LICENSE 文件
💌 时光邮局 - 连接过去与未来的桥梁,让每一封信都成为珍贵的回忆。