Soft delete
A soft delete marks a record as deleted, usually with a `deleted_at` timestamp, and hides it from every normal query instead of removing the row, so it can be restored and its history stays intact. The Meadowstack starter does not use it: people may delete only their own drafts, for good, after a confirmation, while submitted records are never deleted at all.
By Bohuslav PoláčekChecked
/** Deletes a draft for good; there is nothing to undo, so the screen asks first. */
export function deleteRequest(actor: Person, id: string) {
return request(() => {
check(actor, "request.delete", find(id));
db.requests = db.requests.filter((item) => item.id !== id);
db.events = db.events.filter((event) => event.requestId !== id);
queueMicrotask(feed.changed);Why it matters in a business app
In a business app, "delete" usually means one of three things: "I made a mistake, throw it away", "this is finished, take it off my list", or "this order was cancelled". Only the first is a real delete. The other two are states, and a status (archived, cancelled) with its own history entry says more than a hidden flag.
Soft delete earns its place when people need an undo across sessions or a recycle bin. It costs every query a deleted_at is null, unique constraints that must ignore deleted rows, and a clash with data protection law: where people have a right to erasure, a hidden row is still a stored row.
How Meadowstack handles it
The starter's rules, in domain/permissions.ts: request.delete is allowed only on a draft, by its author or an admin. Anything submitted stays, and its life is told by its status and its audit trail. Because a deleted draft cannot come back, the screen asks first (the kit's ConfirmButton and useConfirm), as the root AGENTS.md requires for irreversible steps.
The Supabase example does the same in the database: a delete policy for drafts only, and the history goes with the draft through on delete cascade. The kit has no soft-delete helper. If your app needs one, add the column and the condition to the same policies, so a hidden row is hidden from the api too, and keep docs/security.md's advice in mind: export and erase everything the app holds about one person must stay possible.
Common mistakes
- Soft delete as the only history. A flag says that something was removed, not who removed it or why. Write a history entry.
- Hidden in the interface only. If the api still returns deleted rows, so does anyone who calls it.
- Delete instead of cancel. A cancelled order is data; deleting it loses the reason it was cancelled.
- Undo that is not true. An Undo after a hard delete must restore everything, or it must not be offered.
Questions
Should a business app use soft delete or hard delete?
Use statuses for things that ended (cancelled, archived), hard delete for real mistakes such as an empty draft, and soft delete only where people need a recycle bin. The starter uses statuses and deletes drafts only.
Is soft delete compatible with the GDPR right to erasure?
A soft-deleted row is still stored personal data. Where the right to erasure applies, the app needs a real delete or anonymisation path; ask a lawyer what applies to your data.
Why does the starter ask before deleting a draft?
Because the delete is permanent: nothing can undo it, so the root rules require a confirmation for irreversible steps.
Two ways
Build it yourself, or have it built
Build it yourself
Build your app on the framework
Get the codebase these apps stand on and build yours with Claude Code, Cursor or Codex.
One payment, lifetime updates
Get the frameworkHave it built
Have us build your app
Tell us how your team works. We plan the app with you and build it on the same framework at a fixed price.
After launch, Care keeps it improving, from €99 a month.
from €1,990
Describe your app