Chapter 18 · Part 4: Keep it running
Stay safe and keep going
Nobody builds a perfectly safe app. What you can do is know what you've protected, know what you haven't, and know what to do when something goes wrong. That's a smaller job than it sounds, and you've already done most of it.
This chapter does three things. It looks back at what's protecting your app, and how we know. It covers the everyday habits that keep it that way. And it's honest about what we left out. Then it points you at where to go next.
What you've already built
Every row below is something you did in an earlier chapter, with the test we ran to see whether it held.
| What protects you | Where | How we checked |
|---|---|---|
| Passwords are stored as scrambled hashes by a well-used library, never by your own code | Chapter 12 | Looked at how it's stored: the person's own record has no password at all, and the password sits in a separate record as a long scrambled string, 161 characters of salt and hash |
| The app, not the form, decides who is the owner | Chapter 12 | Sent a sign-up that asked for the owner role, and got an ordinary waiting member |
| Every action checks who is calling | Chapters 12 to 15 | Copied each action's request and sent it as a stranger, a waiting person, a member, and the owner, and compared |
| Private records can't be asked for | Chapter 14 | Every query starts from the signed-in person, so there is nothing to ask for someone else's |
| The public page shows a short list of fields, and nothing else | Chapters 11 and 15 | Searched the page's raw HTML for private names, reviews, and emails |
| Secrets live in two places only: your .env.local and Vercel | Chapters 12 and 16 | Made a new secret for the live site, and replaced one that leaked |
| The database user can only touch your app's database | Chapter 16 | Asked for another database and was refused |
| The live site fails quietly and checks itself | Chapter 16 | Ran every page with no settings at all, and ran a 16-point check against the live address |
Notice what every one of those has in common: nobody assumed it worked. Each was tried. If you remember one habit from this guide, make it that one: ask Claude to try to break what it just built, and ask for the evidence.
1. Secrets: three rules, and a check
A secret lives in as few places as possible
Yours live in
.env.localon your computer and in Vercel's settings. Nowhere else: not in the code, not in a note to yourself, not in a message.You make them, and you don't show them
Make them in a terminal of your own, not in the chat. And remember what we found in Chapter 16: anything you highlight in your editor can travel with your next message to Claude.
A leaked secret gets replaced, not hidden
Changing a leaked secret takes a few minutes, and the steps are in Chapter 16. Hoping nobody noticed costs nothing today, and a lot if you're wrong.
You can also ask Claude to look for secrets that have already slipped into your project. Paste this:
Check this project for secrets that shouldn't be in it. Don't change anything, and never print the value of a secret: only say where you found one and how long it is. Look at: the files git is tracking, the whole git history, and anything in the project that git isn't ignoring. Look for connection strings that contain a password, long random-looking strings, and any .env file that isn't .env.example. Also confirm that .env.local is ignored by git. Tell me what you found, and what I should do about each thing.
On the reference app, the answer was the one you want. The file .env.local is ignored by git, and the only environment file git tracks is .env.example, which has blank settings. Across all 18 saved versions of the project, there were no connection strings with a password in them, and no long random-looking strings. Notice that the check looks at the history, not just today's files. A secret you committed once and deleted the next day is still in the history, and anyone who can read the repository can read it.
2. Keep your accounts safe
Your app has four keys: GitHub, Vercel, Atlas, and the email you signed up with. Whoever holds the GitHub key can change your live site, and whoever holds the Atlas key can read your data. So turn on two-factor authentication on all four, as you did for GitHub in Chapter 5. Vercel's own dashboard nudged us to do this, with an Enable 2FA prompt in the sidebar. It's worth ten minutes.
And use a password manager. One strong password per account is hard to do by hand and easy to do with one. The database password is the one most worth keeping in it, because you only ever paste it, you never type it.
3. Updates and known problems
The code you built on, such as Next.js, React, and Better Auth, gets fixes over time, and sometimes a fix is for a security problem. Two commands tell you where you stand:
npm audit
npm outdated
On the reference app, npm audit --omit=dev said 0 vulnerabilities in the code that actually runs for visitors. The full audit found 7 of moderate severity, every one in a development tool such as the code checker, which never leaves your computer. npm outdated listed small updates for React and Tailwind, and bigger jumps for TypeScript and ESLint.
Update the way you change anything else
Don't run npm audit fix --force because a screen told you to. That flag is allowed to make big changes. Instead, use the loop from Chapter 17. Ask Claude to update one package, run the tests, run the build, and show you what changed. Save it, ship it, check the live site from the outside, and keep the undo ready. Small updates, often, are much safer than one huge update after a year.
4. Back up your data
Your code is safe on GitHub. Your data, the restaurants, reviews, visits, and people, lives only in your database. If you lose it, nothing in this guide gets it back.
Free Atlas clusters have a rule that matters here. MongoDB's changelog (opens in a new tab) says a free cluster is paused after 30 days of no activity, and Atlas emails you 7 days before it does. A paused cluster doesn't answer. You can resume it, though there are exceptions, and MongoDB's documentation advises you to export a copy of your data if you won't be using the cluster for a while. Don't assume a free cluster keeps backups for you. Make your own.
Add a script that saves a copy of my data to my own computer as plain JSON files, and an npm script to run it. It should only read, never change the database. Save the restaurants, the reviews, the visits, and the list of people. Leave out the password records, the sign-in sessions, and the guess counters. Write the files into an exports folder, add that folder to .gitignore so it can never be committed, and print how many records of each kind it saved. Test it against the demo database, not my real one, and show me that no file contains a password hash or a session token.
On the reference app, Claude made npm run export:data. We ran it against the demo database, and it saved four files: the restaurants, the reviews, the visits, and the people. We searched all of them for a password hash, a session token, and the word password, and found none. The people file holds a name, an email, a role, a status, two dates, an id, and a yes-or-no for whether the email was verified. Nothing else.
npm run export:data
A backup is private data too
The exports folder, inside your project folder, holds your members' emails and everyone's private visits. It's ignored by git, so it can't be committed by accident. Keep it that way: don't email it, and don't put it in a shared folder. Do it monthly, and before any big change.
Not built: restoring
We made the way out, and not the way back in. A backup you've never restored is a hope, not a plan. When you want to practice, ask Claude to write a restore script, and try it on the demo database, never the real one.
5. The trade you made with Atlas
In Chapter 16, you let Atlas accept connections from any address, because Vercel's addresses change. That's the setup MongoDB's own guide (opens in a new tab) describes. What keeps it reasonable is the rest: a long random password, a database user that can only touch your own database, and a secret that lives in two places.
There are ways to avoid it, such as sending your database traffic through a service with fixed addresses, or private networking. They cost money, and they're worth it when the data is more sensitive than a friends' restaurant list. If you ever add something that is, such as real names of children, health details, or payment information, come back to this section first.
One tidy-up you can do now. Your reference setup uses one database user for both the real database and a test one. The cleaner setup is two users: one for the live site that can only touch the real database, and one for you that can touch both. Then a leaked live password can't reach your testing data, and the reverse.
6. What we left out on purpose
An honest guide tells you where the gaps are. These are the ones in this app:
| Not built | What that means for you today | What to ask Claude when you want it |
|---|---|---|
| Email verification | The app doesn't check that an email belongs to the person typing it. That's why you made your own owner account first. | To add email verification, using an email-sending service |
| Forgotten passwords | A member who forgets their password can't get back in on their own. You'd have to ask Claude to help with the database. | To add a password reset by email (needs the same service) |
| Photos | The members' area has no photos yet. | To add photos, kept private, with a size limit and a type check |
| Editing a place | Nobody can change a place's name, area, food, or features after adding it, except by changing the database. The owner can only change whether it's public, and when it was last checked. | To let the owner edit a place, with the same checks as adding one |
| Alerts | Nothing tells you if the site is down or if someone keeps guessing passwords. | To add simple monitoring, and ask what's free |
| Deleting a person's data | Removing a member signs them out and hides their reviews, but their records stay. | To delete everything for one person, carefully, with a check before and after |
For each one, the right order is the one you already know: write what you want in a plan file, ask Claude to audit the plan, build it, try to break it, and check it from the outside.
7. Be careful what the app holds
The app can't tell what people type into a note. A rule the whole group should share: no children's names, ages, schools, or photos in notes or reviews. Visits are private, but reviews are read by everyone in the group. Say it once when you approve someone, and put it somewhere they'll see it.
This app is for a friends' list, not for school records. If your list is about students, stop and pick a different tool: real student data comes with legal obligations, like FERPA in the United States, and a first project isn't the place to take those on.
If someone asks to leave, removing them is immediate and easy. If they also ask for their data to be deleted, that's the last row in the table above, and you should do it. Tell Claude exactly whose records, ask it to show you what it found before it deletes anything, and check afterwards.
A ten-minute check-up, once a month
- Run
npm run check:liveagainst your live address. - Run
npm audit, and ask Claude to explain anything new in the part that ships to visitors. - Open Members. Is everyone someone you know?
- Run
npm run export:data, and put the files somewhere private. - Glance at your Vercel usage page and your Atlas storage, against the limits from Chapter 2.
- Once a year, make new secrets and replace the old ones.
If something goes wrong
| What you see | What to do first |
|---|---|
| You think a secret leaked | Replace it now, using the steps in Chapter 16. Then run the live check. |
| Someone in Members you don't know | Remove them. They're signed out at once. Then check what they could see: a waiting person sees nothing, so the question is whether you approved them. |
| The site shows "isn't available right now" | Check Atlas first. A free cluster that sat unused for 30 days is paused, and Atlas lets you resume it. Then check that Vercel's settings are all still there. |
| A change broke something | Revert it in git and push, or use Vercel's rollback to stop it faster. Chapter 17 has both, and says which one we ran. |
| You deleted something by mistake | Stop. Don't change anything else. Then use the last export, and ask Claude to help you put it back. |
If it doesn't work
npm run export:data says it couldn't export. Check that .env.local has your connection string, and that your cluster isn't paused. A paused cluster doesn't answer.
npm audit shows a lot of warnings. Run npm audit --omit=dev. That shows only what ships to visitors, and it's the list that matters most. The rest are tools on your own computer.
Atlas emailed you that your cluster will be paused. Export your data now, and keep using the app. MongoDB's page doesn't say exactly what counts as activity, so don't count on one visit to reset the clock.
Where to go next
You didn't just build an app. You learned a way of working, and it travels. The same loop applies to anything you build next:
- Plan it first, in a file, in your own words (Chapter 3).
- Ask Claude to audit the plan before it builds anything (Chapter 11).
- Build it in small phases, with each prompt saved (Chapters 8 to 15).
- Ask Claude to try to break it, and ask for evidence (Chapters 12 to 15).
- Check it from the outside, the way a stranger would (Chapter 16).
- Change it in small steps, with the undo ready (Chapter 17).
If you want a next project, take the gaps in the table above. Photos and password reset are each a good, real chapter of their own.
Chapter 1 also named four things this guide doesn't cover: signing in with Google or Microsoft, a custom address of your own, sending email, and separate test and live versions of your app. Each one is its own project. For each, ask Claude what it involves and what it costs, and put the answer in a plan file before anything gets built. Or start something completely new, with a plan file, and see how far a conversation can take you.
Checkpoint
0 of 5That's the guide. You planned an app, built it, put it online, kept it safe, and learned how to change it. If you build something with it, we'd love to hear what it was.
Last checked November 15, 2026. Software screens and free-plan limits change. If something here doesn't match what you see, the official link in the chapter is the source to trust.