轻量 Web 应用Lightweight web app· 2026
Note
工程化做透的轻量备忘录A lightweight memo app with engineering discipline
用单文件 Flask 应用证明:小项目也可以有数据保护、测试、类型和安全扫描。A small note app used to practice completeness: CRUD, tests, screenshots, docs, and deployable structure.

案例摘要Case summary
目标用户Audience
需要本地轻量记录工具,同时关注数据安全和工程质量的个人用户。Individual users who need a lightweight local note tool while caring about data safety and engineering quality.
我的角色Role
负责应用范围、数据完整性规则、测试隔离和 CI 质量门的决策与验收;全部代码由 AI 编程工具完成。Owned decisions and acceptance for app scope, data-integrity rules, test isolation, and CI quality gates; all code was produced with AI coding tools.
交付结果Outcome
形成单文件应用 + 四阶段质量门的完整示例。Produced a single-file app with a four-stage quality gate as a complete example.
产品洞察Product insight
工程能力不只体现在大项目。小项目如果能把数据完整性、测试隔离、CI 和安全默认值做扎实,同样能证明真实交付意识。Engineering capability is not only shown in large projects. If a small project makes data integrity, test isolation, CI, and security defaults solid, it can still prove real delivery discipline.
项目简介Overview
Note 是一个轻量级备忘录应用,采用 Flask + JSON 持久化 + 文件锁 + 自动备份恢复,并配套 lint、类型检查、测试和安全扫描。Note is a lightweight memo app built as a single-file Flask application, with JSON persistence, file locking, automatic backup and recovery, plus lint, type checking, tests, and security scanning.
技术栈Tech stack
结果证据Evidence
README 记录双层数据完整性保护、跨平台文件锁和 CI 质量门。README documents two-layer data-integrity protection, cross-platform file locking, and CI quality gates.
tests/test_app.py 用临时目录和 monkeypatch 隔离真实数据。tests/test_app.py uses temporary directories and monkeypatch to isolate real data.
docs/screenshots 保留首页、详情、编辑、标签筛选和移动端截图。docs/screenshots keeps home, detail, edit, tag-filter, and mobile screenshots.
关键决策Key decisions
JSON 写入半截损坏可能导致数据全丢。A truncated JSON write could lose all data.
写入前备份,加载失败时从备份恢复,主文件和备份都坏才抛错。Back up before writing; recover from the backup if loading fails; only throw when both the main file and the backup are corrupted.
多维排序用 reverse=True 容易把置顶逻辑也反转。Multi-dimensional sorting with reverse=True can accidentally flip the pinned logic too.
利用稳定排序拆成两次排序,避免 tuple 维度被整体反转。Use stable sorting split into two passes, so tuple dimensions are not reversed as a whole.
想看完整的代码和实现细节?Want the full code and implementation details?
在 GitHub 上查看View on GitHub