
Mini lesson 29 of 30 · Run and maintain your website
Choose what the backup protects
Who is this for?
People who want to understand and verify website-data recovery. The first exercise runs in a browser with ready data; PostgreSQL, Bash and migration commands are optional advanced study.
Website code and stored records are different things.
Purpose of this lesson
- Create a downloadable backup rather than relying on saved website code.
- Restore into a separate practice target and compare actual records.
- State which real website data and permissions the exercise does not cover.
Explanation, worked example and practice
Before you start
A browser and the supplied local backup practice. No account, private data or database installation is needed for that exercise. An actual hosted-site backup additionally needs your own provider’s supported tools and access; the optional database workshop uses disposable targets only.
Estimated time: 24–41 min
Estimates for the supplied starter files with prerequisite accounts and tools ready. Setup, deployment queues and delivery/DNS waits take additional time. This is a one-table logical export exercise, not a complete production backup/PITR solution. Database accounts and tool installation take additional time.
Understand the idea
Open practice/index.html and inspect the supplied source records and the separate empty restore target. These are fictional local records, not your real website database.
Saving the website repository alone does not establish that form records or uploads are recoverable. Name the exact data this exercise covers.
A concrete example
A site’s code may be in Git while its customer records exist only in another service.
The local source starts with two fictional notes: ID 1, “Practice note: first visitor task”, and ID 2, “Practice note: saved contact preference”. The Add control supplies ID 3, “Restore check: turquoise notebook”. These exact English sample values are data to compare, not code to write.
Open the supplied local backup practice. Help me download the source-record backup, restore it into its separate empty target and compare exact IDs/text. Explain the local scope honestly: this is not a completed hosted database backup. If I later use the optional PostgreSQL scripts, inspect the source/empty target with me first and never run destructive commands or touch production.Files for this step
Open or download the files below. When saving a project, keep the folder paths shown in the filenames.
Try it yourself
What data is in the supplied source, and what real website data is outside this exercise?
Show a worked solution
The local source starts with ID 1, “Practice note: first visitor task”, and ID 2, “Practice note: saved contact preference”. The exercise can export those notes; it does not include my hosted database, uploaded images or user access rules. Keeping the website’s code in Git would not automatically back up any of those records.
What a sound answer includes
- Identifies the two supplied notes as the local source data.
- Distinguishes the browser exercise from hosted data, uploaded files and account permissions.
How it works (optional)
Back up data by proving you can restore it
A backup file is useful only if its contents can produce the state you need.
Your Git repository may recover the website code while containing none of its database records or uploaded files. Data recovery needs its own plan.
This lesson exports one small PostgreSQL application table and restores it into a separate empty database. Keeping the scope narrow makes the first recovery test understandable; the scope table makes clear what it does not protect.
Worked example
The known note is “Restore check: turquoise notebook”. After restoration, we must read that exact value and its ID from the target, not merely see a nonempty dump file.
Extra implementation exercise
Your source code is in Git. Does that prove you can recover yesterday's form submissions?
Show a worked solution
No. The records live in a database outside the code repository. You need a data recovery source and evidence that it restores the expected records.
- Separates application code from stored data.
- Requires a data backup and restore check.

Step 1 · How to back up and restore your website data
Download a backup you can inspect
Create an actual file before clearing or changing any target.
Explanation, worked example and practice
Understand the idea
Choose “Download backup” in the local practice. It creates practice-backup.json from the source notes. Keep that downloaded file; ask your assistant or a plain viewer to show the two record IDs and texts without changing them.
The source and restore target live only in this open page. Download before leaving or reloading, because the sample page is not persistent hosted storage. The next step restores your downloaded file into the separate target.
A concrete example
Before adding a record, the exported file should contain two notes: IDs 1 and 2 with the exact source texts. A familiar filename with different or missing records is not the desired backup.
Files for this step
Open or download the files below. When saving a project, keep the folder paths shown in the filenames.
Try it yourself
Which file did you export, and which records did you confirm it contains?
Show a worked solution
The exercise downloads practice-backup.json. Before using Add, I expect it to contain ID 1 “Practice note: first visitor task” and ID 2 “Practice note: saved contact preference”. I would inspect those exact values in my downloaded file and keep it before closing the page.
What a sound answer includes
- Identifies the actual downloaded JSON file and its source-record contents.
- Confirms the two IDs/texts rather than treating the filename alone as proof.
How it works (optional)
Export the intended scope
Choose the data deliberately and keep the archive and credentials private.
Follow START-HERE.txt to prepare two disposable databases. Run seed.sql only in the source, then export.sh with its private connection URL. The custom archive contains the named table; the contents list lets you inspect that scope.
The scripts use no-owner/no-privileges for portability. They do not recreate account roles or a production permission model. Keep archives private because they may contain sensitive data in a real application, and use compatible database tools.
Read backups/contents.txt before restoration. For this fixture, look for entries naming TABLE public backup_practice_notes and TABLE DATA public backup_practice_notes, plus its primary-key constraint. Numeric archive IDs and wording vary by tool version. A list containing only another table is not evidence that this table was exported.
Worked example
A checksum can help detect a later file change. It does not prove that the archive contains all required tables or that anyone can restore it.
PostgreSQL: pg_dump · Supabase: database backup scope
Extra implementation exercise
The archive's checksum is valid. What two major questions remain?
Show a worked solution
Was all required data included, and can it be restored correctly into the intended environment? Integrity of a file is different from completeness and recoverability.
- Asks whether the required scope was included.
- Requires an actual restore and data/permission checks.

Step 2 · How to back up and restore your website data
Restore into the separate target
Verify the recovered values instead of only an import message.
Explanation, worked example and practice
Understand the idea
In “Separate restore target”, choose your downloaded practice-backup.json. Compare every restored ID and text with the still-visible source; the target should now contain the same two notes without changing the source.
Then use the supplied invalid-backup.json example, available through “Download an invalid example”. It should be rejected while leaving the already-restored target intact. You are testing that a bad file cannot replace good restored data.
A concrete example
A successful two-note restore has IDs 1 and 2 on both sides. After the invalid-file attempt, those same target notes should remain; an error followed by an empty target would fail the protection check.
Files for this step
Open or download the files below. When saving a project, keep the folder paths shown in the filenames.
Try it yourself
Restore the two-note backup, then try the invalid example. What should remain in the target and source after each attempt?
Show a worked solution
After the valid restore, the target should contain the same ID 1 and ID 2 texts as the source. After invalid-backup.json, the target should still contain those two notes and display an invalid-backup message. The source should remain unchanged in both attempts. These are the expected checks to compare with my own screen.
What a sound answer includes
- Compares exact restored IDs/texts and checks that the source remains unchanged.
- Verifies that invalid input leaves the existing valid target data intact.
How it works (optional)
Restore into a separate empty target
Recovery practice should not overwrite the only working copy.
Run restore.sh against the distinct empty target and inspect its printed database identity before confirming. It does not use --clean or DROP; an existing conflicting table should cause failure instead of being silently overwritten.
After restoration, inspect both rows and their exact values. Confirm the source is unchanged. For a real app, also verify indexes, constraints, relationships, roles and access policies; this small exercise intentionally does not claim those broader guarantees.
Worked example
A target with the same table already present is not the empty practice destination this script expects. Investigate rather than adding destructive flags just to silence the error.
Extra implementation exercise
Restore fails because the target table already exists. Should you immediately add --clean?
Show a worked solution
No. Confirm you selected the intended disposable empty database. Use a new empty target for this exercise rather than introducing a destructive option without understanding its impact.
- Checks target identity and intended state first.
- Avoids destructive overwrite as a troubleshooting shortcut.

Step 3 · How to back up and restore your website data
Repeat with one new record and state the gaps
A backup habit includes retesting a changed dataset.
Explanation, worked example and practice
Understand the idea
Choose “Add the third record”; the source gains ID 3, “Restore check: turquoise notebook”. Download a new backup and keep it distinct from the earlier two-note file. Choose “Empty target” before restoring the new file; the source must stay at three notes.
Compare all three restored IDs/texts. Then use recovery-plan.csv to list the extra coverage your real site would need: its actual database, uploaded files, relationships, permissions and provider recovery process. PostgreSQL scripts below are an optional, separate exercise for confirmed disposable databases.
A concrete example
The old file can correctly restore only IDs 1 and 2. To recover the newly added turquoise-notebook record, you need the new three-note export. A successful old-file restore is not proof that the newest data was backed up.
Files for this step
Open or download the files below. When saving a project, keep the folder paths shown in the filenames.
Try it yourself
Provide the new backup/restore observations and a scope checklist for a real website.
What to produce: The practice backup file, observed restored records and a clear local-versus-real-site scope note.
Show a worked solution
My new local backup should restore IDs 1 and 2 plus ID 3 “Restore check: turquoise notebook” into the emptied target. The earlier two-note file cannot recover ID 3. For a real site I would separately plan database and uploaded-file recovery, verify relationships/access rules and rehearse the provider’s restore path; none of those is established by this browser result.
What a sound answer includes
- Restores the new three-note export and verifies the exact ID 3 text alongside IDs 1 and 2.
- Names real-site data and recovery checks not covered by the local notes exercise.
How it works (optional)
Your assignment: test a new backup and document the gaps
Make recovery freshness and scope visible.
Add a third distinct note to the source, create a new archive and restore it into another empty target. Record its timestamp/hash, known IDs/values and how long restoration took.
Complete the recovery plan for a hypothetical site that also has uploaded images and signed-in users. Identify which provider tools or separate exports would cover those missing parts, and what checks would prove their restoration.
Worked example
A database row pointing to an image does not include the image's object bytes. Both may be necessary for the website to work after a recovery.
The complete reference walkthrough is available in reference/assignment-walkthrough.txt. Compare its steps with your own result; fill the test record from observations in your own project.
Extra implementation exercise
Prove the new note restores and write a realistic scope/recovery checklist.
Show a worked solution
Seed the two known rows only in the source practice database. Export the named table, inspect the archive contents for its table/data/constraint entries and retain its hash privately. This export does not include other tables, roles, grants, auth or uploaded file bytes.
Restore into a different empty disposable database after checking its identity. Read ID 1 and the exact note 'Restore check: turquoise notebook', plus ID 2. Verify the source remains unchanged. A table-already-exists error is a reason to use another empty target, not to add destructive cleanup flags.
Add ID 3 with a new distinctive note, make a new archive and restore into another fresh target. Check all three exact rows. Complete the separate recovery plan for missing uploads/auth/permissions; do not claim that this one-table exercise recovered those systems.
- New data is read from a distinct restored target.
- Missing files, auth and permissions are explicitly accounted for.
Was this lesson useful?
Leave a like, or share it with someone who could use it.