How to make it easy to leave your SaaS

By

Updated

Tagged: Business

Design a useful SaaS export with stable IDs, attachments, and import checks, then handle account deletion through a durable, verifiable process.

If someone puts years of work into your app, they should be able to pack it up and leave whenever they want.

Plenty of apps drop an export button in settings and hand you a flat list of titles with none of your notes or files. If half the person’s work gets left behind, that export button isn’t doing its job.

In how to compete with software clones, I talked about why making it easy to leave matters. Let’s turn that into a real feature for a small reading-list app where people save articles into collections, write notes, and attach files.

We’ll design an export that another app can import cleanly, then walk through everything account deletion needs to finish before the account is truly gone.

Decide what belongs in the export

Start by picking one ordinary account and listing everything its owner created.

In our reading-list app, that’s saved article URLs, notes, collection membership, archive status, and attachment files. Keep the timestamps too. People often want to sort by the day they saved something once they move their library somewhere else.

Leave credentials and session tokens out. Don’t just dump every database table tied to a user ID because it’s easy. Internal moderation records or another person’s private notes belong to different people, so you have to think through ownership before putting them in the bundle.

Write a short format doc listing every field you include, and version the format from day one. When the schema changes later, any importer reading an older export can tell which version it’s dealing with.

Preserve relationships with stable identifiers

Use JSON for the full structured export. If people want to open their article list in a spreadsheet, offer a separate CSV download instead of trying to cram nested data into flat rows.

Here’s the layout we’ll use for the archive:

reading-list-export/
  data.json
  FORMAT.md
  attachments/
    file_8.txt

And here’s a small, complete data.json showing how the pieces link together:

{
  "formatVersion": 1,
  "exportedAt": "2026-10-17T10:00:00Z",
  "collections": [
    { "id": "collection_3", "name": "JavaScript" }
  ],
  "articles": [
    {
      "id": "article_12",
      "url": "https://flaviocopes.com/javascript/",
      "title": "The JavaScript Handbook",
      "savedAt": "2026-10-15T09:30:00Z",
      "archived": false,
      "collectionIds": ["collection_3"],
      "notes": "Return to the section about functions.",
      "attachmentIds": ["file_8"]
    }
  ],
  "attachments": [
    {
      "id": "file_8",
      "path": "attachments/file_8.txt",
      "originalName": "study-notes.txt",
      "mediaType": "text/plain",
      "bytes": 12
    }
  ]
}

In this fixture, file_8.txt holds Read again. followed by a newline. Put the real attachment file inside the archive instead of leaving a hosted URL that stops working the moment the account closes.

Make it clear in your format doc that these IDs identify records inside the export. Whatever app imports the file can generate its own database IDs and keep a lookup map from old to new. Don’t link records by display name, because two collections can share the same name, and joining on names will lose information.

In production, add checksums for every attached file so an importer can catch corruption right away. On the import side, treat archive paths as untrusted: reject absolute paths and any path that tries to escape the destination directory.

Make export generation restartable

For a small account, you could build the archive right inside the HTTP request. Larger accounts with lots of notes and attachments will time out, so you need a background job.

Something like this is all the API needs:

RequestResult
POST /api/exportsCreate a job; return its ID and pending status
GET /api/exports/export_42Return pending, running, ready, or failed
GET /api/exports/export_42/downloadAuthorize the owner and return the private archive

Save the job state in your database, not in worker memory. Persist each batch as it finishes, and write the archive to temporary storage before you flip the job to ready. If a worker crashes halfway through, the next one should be able to resume or restart cleanly, with a retry limit and a visible failure state when retries run out.

You also need to decide what happens if the user edits an article while the export is still running. A consistent export should reflect one point in time. Take a database snapshot or write out a materialized copy of the export data first. Storing a list of record IDs up front isn’t enough, because the rows behind those IDs can keep changing while the job runs.

Process that snapshot in ordered batches using a stable cursor. Offset pagination over a live table that’s still changing will skip rows or repeat them. Include the snapshot timestamp so the user knows which later edits didn’t make it into the file.

Keep downloads private

Check that the signed-in user owns the account on every endpoint: creating the export, checking its status, and downloading the archive. Don’t rely on a hard-to-guess job ID to protect someone’s data.

If your app has team workspaces, check workspace export permissions specifically. A regular member shouldn’t be able to swap an ID in a request and walk away with an admin’s view of the workspace.

Keep generated archives in private storage. If you hand out short-lived signed links, remember that S3 treats presigned URLs as bearer tokens: anyone holding the URL can download the file until it expires. Keep those links out of your logs and never embed them on public pages.

Show the expiration time in the UI and let the owner generate a fresh export once an old one expires. Run a cleanup job to delete expired files, and make sure the cleanup job and the download endpoint agree on whether an archive still exists.

If you also want an API for ongoing copies, give users revocable read-only credentials and use the same stable IDs. Document how pagination works and how clients spot deletions, like a change feed with deletion markers. Without that, a client can run list requests all day and still keep records the owner deleted. Treat incremental sync as its own feature, separate from snapshot exports.

Fig 1 · 1/3Export, download, and restore
Snapshot captured

Prove someone can use the files

Don’t call the export done until you’ve written a small import fixture and tested a real round-trip.

Import the archive into an empty test account. Check that the article count matches, the notes come back character-for-character, collection membership and archive status line up, and every attachment has the exact same contents. Include awkward edge cases too: non-English text, an empty collection, and an article that belongs to several collections at once.

Test enough records to span more than one page, kill a worker mid-export to make sure it recovers, and try downloading an expired link. If an attachment file is missing from storage, the job should fail visibly instead of handing over an archive with silent gaps.

Finally, hit the status and download endpoints while signed in as another account. Both should come back denied.

Give deletion a durable job too

Deleting an account shouldn’t happen by accident. Ask for a fresh sign-in and a clear confirmation, and spell out what will disappear, what happens to any shared workspace, and what happens to billing before the owner confirms.

Offer an export first. If someone chooses to export and then delete, finish the export and let them download it before starting deletion. Keep those two choices separate, though, so a plain deletion request doesn’t force anyone to download an archive they don’t want.

Once they confirm, create a durable deletion job in your database before invalidating their sessions. Stop new writes and outgoing automations right away. Cancel future billing through your billing provider, verify that it worked, and keep enough state on the job to retry if the provider is down. Keep in mind that deleting an account, canceling a subscription, and issuing a refund are three different operations.

Then wipe everything the user owns: records, files, generated exports, search index entries, and caches. Shared records need to follow your ownership rules so a departing member doesn’t wipe out a workspace everyone else still uses.

Make each step safe to retry, and save progress after each one. If the worker crashes halfway through, you won’t be left with an invisible half-deleted account. Keep the leftover job record minimal and lock down who can access it.

Here’s how that plays out in our reading-list app. Someone with 300 saved articles, a paid plan, and a membership in a colleague’s shared collection deletes their account. The job revokes their sessions and records that step. The billing provider times out, so the job waits and retries until the cancellation is confirmed. Next it deletes their articles, notes, attachment files, last export archive, and search index entries. The shared collection stays because the colleague owns it, and only the departing person’s membership and their notes inside it go away.

Explain separately how you handle backups and any records you have to retain. Deleting live rows doesn’t erase older backups. Your restore procedure also needs to reapply completed deletions before restored data becomes accessible again.

Test the whole flow in a disposable environment with a fake billing provider. Interrupt the worker right after billing cancels, restart it, and make sure it finishes wiping the data without charging them again or letting them log back in. Don’t tell the user their account is deleted until every step finishes; if something is still left, show them the current status and a way to get help.

Want me to talk about your product? You can sponsor this site.

Related posts about business: