展示HN:基于FastAPI、PostgreSQL发布/订阅和UV的实时应用启动器
实时Web应用的启动模板,使用现代Python/JS工具和PostgreSQL的LISTEN/NOTIFY,而不是外部消息队列。
技术栈:
- UV(Python包管理器 - 非常快速)
- FastAPI,支持全异步/等待
- PostgreSQL触发器 + LISTEN/NOTIFY用于发布/订阅
- Bun用于前端构建
- 适当的连接池和生命周期管理
GitHub: [https://github.com/garage44/plank](https://github.com/garage44/plank)
这个项目源于在多个项目中重建相同的模式。我找到的大多数示例都是玩具演示,未能处理重连、死客户端或正确的关闭。
包括一个实时更新的前端示例,当数据库发生变化时会即时更新。提供Docker Compose设置以便于测试。
适合:管理仪表板、监控工具、需要即时推送当前状态的协作应用。不适合:保证消息传递或作业队列。
查看原文
Starter template for real-time web apps using modern Python/JS tooling and PostgreSQL's LISTEN/NOTIFY instead of external message queues.<p>Stack:
- UV (Python package manager - incredibly fast)
- FastAPI with full async/await
- PostgreSQL triggers + LISTEN/NOTIFY for pub/sub
- Bun for frontend builds
- Proper connection pooling and lifecycle management<p>GitHub: <a href="https://github.com/garage44/plank" rel="nofollow">https://github.com/garage44/plank</a><p>This came from rebuilding the same pattern across projects. Most examples I found were toy demos that didn't handle reconnection, dead clients, or proper shutdown.<p>Includes working frontend example that updates in real-time when database changes. Docker Compose setup for testing.<p>Good for: admin dashboards, monitoring tools, collaborative apps where you just need current state pushed immediately. Not for: guaranteed message delivery or job queues.