技术笔记1 分钟阅读2026-07-25
Git-backed notes
A plan for upload, draft safety, commits, and production publishing.
目录
Git-backed notes
Markdown should remain portable. The database stores metadata, but the note body should be recoverable from Git.
The editing flow needs to be conservative: validate the Markdown, preserve a draft before risky writes, then update Git and database state together.
Failure handling
If Git writing fails, the draft should remain in note_drafts. If database writing fails, Git should not be committed. If publishing fails after content is saved, the note can stay saved with a pending publish state.
Metadata
Important metadata includes title, slug, category, tags, visibility, status, pinned state, sort order, reading time, and publication date.
type NoteStatus = "draft" | "published" | "archived";