18. Choosing Your Architecture
“The safest door is the one you never had to build.”
The story: the design review
Section titled “The story: the design review”The team lead put her cup down, which in our office is how you know a question is serious, and asked it.
“How do we expose the dance-academy app? And why not just open the ports, like we did last time?”
You had half an answer ready before she finished. Last time worked. You ran nginx on the VPS, opened 80 and 443, got a certificate from Let’s Encrypt, and the site loaded in Pune and in Chennai without complaint. You knew it worked because it worked.
But “it worked” was hiding a question. Last time, the only person who knew which doors existed was you, and the server had one job. This time the box holds student records in Postgres, takes payments through Razorpay, sends mail through Resend, and will soon have eight people who each want a way in. Opening ports is not wrong. It is the first answer, and the first answer and the right answer have a habit of being different.
Here is the fact that should shape the whole conversation. A fresh public address does not stay quiet for long. In my experience it is found within hours. Something on the internet starts rattling its doorknobs: checking port 22 for weak passwords, port 443 for an admin page you forgot about, port 80 for a default install. These scanners are not personal. They do not know your name or your students. They are weather. The question is never whether the weather arrives, only whether your building has the right doors.
Every request you have ever served walked the same path, and we have been naming the stops since Chapter 3:
Name → Address → Route → Door → Guard → Receptionist → App
A name (Chapter 10) becomes an address (Chapter 1). The packet takes a route, knocks on a numbered door (Chapter 3), a guard checks the clipboard (Chapter 14), and a receptionist (Chapter 8) hands it to the app at the back. Every exposure model is a different answer to one question: which of those stops sit on the public street, and which sit behind a private wall?
This chapter is the synthesis. You have already met the pieces: the reverse proxy and HTTPS in Chapters 8 and 9, firewalls in Chapter 14, Tailscale in Chapter 16, and Cloudflare in Chapter 17. I will link back rather than re-explain, so keep those tabs open. Here we stop learning parts and start choosing a shape.
By the end you should be able to take any of your projects, including the four you actually run, and say which model it should use, why, what breaks when each provider goes down, and how you would get back in if the normal way were broken. That last part is the one people skip, and it is the one that matters at 2 a.m.
We will look at five models, score them on the same criteria, and then walk through your projects. One rule governs the diagrams. All five share one city. The street is on the left. The building sits in the middle with the app at the back. Doormen, tunnels and private corridors appear only where they are needed. Once you can read one of these maps, you can read all of them, and that is deliberate.
Reading the map
Section titled “Reading the map”Every figure in this chapter draws the same city, which is the only reason the comparison works. The internet is the amber cloud on the left, the street. The building sits in the middle, with numbered doors on the wall facing the street and the app as the office at the back. Blue is a guard or a policy. Teal is the receptionist. Green is your private network, purple is anything encrypted, and red is a block, a failure, or an attacker.
Read every map from the street inward. Ask which doors face the street, what stands behind each one, and what a request must pass to reach the app. Then ask the question no diagram answers for you: what happens when the thing you depend on is down?
Model 1: the public VPS
Section titled “Model 1: the public VPS”This is the model you already run. You open ports 80 and 443 on the VPS, put nginx or Caddy at the front as the receptionist, and let Let’s Encrypt issue the certificate. Caddy handles that on its own. With nginx you usually add a helper such as certbot and a renewal timer. Either way, the lab’s public address, 203.0.113.10, answers the whole internet on those two doors.
Plainly, your building has a front door on the street and a receptionist who answers it. Precisely, the public address listens on TCP 80 and 443. The proxy ends the TLS connection, holds the certificate, and forwards each request to the app over a local connection. The app never talks to the internet directly.
Most of the web’s history ran this way. Every site was a machine with a public address, and the layers that came later, such as CDNs, managed platforms, and tunnels, grew up to solve problems this model created. Book 1 tells the wider hosting story: https://the-glue-book.pages.dev/part-1/ch06-hosting-caching/
The appeal is real. There is no third party to fail and no extra hop, and the tools you use to debug it (curl, the nginx logs, journalctl) are the ones you already know. The cost is that everything you open is visible to everyone. Scanners try port 22 for weak logins, port 443 for admin pages nobody remembers, and port 80 for default installs. They are weather. They do not know your name or your students, and they do not need to.
Model 1 is cheap, fast, and simple, and it is the weakest default for a small production box that holds data. I would use it only for a site with no admin surface and no database reachable from the network. Even then, I would close every port except 80 and 443, allow SSH by key only, and bind Postgres to localhost.
Model 2: a doorman in front, and a back door that trusts only him
Section titled “Model 2: a doorman in front, and a back door that trusts only him”Model 1 has a weakness that no amount of nginx tuning removes: the street can see the building. Anyone who finds the public address can knock, and the scanners already have. Model 2 keeps the building and moves the street-facing work to a doorman. Cloudflare’s proxy takes the DNS name, accepts the visitor’s connection on its side, ends TLS there, and opens its own connection to your origin.
Precisely, the record for app.pipeslab.in is proxied, so visitors receive Cloudflare’s addresses and never see 203.0.113.10. Your origin still has a public address, because the doorman has to reach it. That is the crack. If the origin accepts 443 from anyone, the doorman is decorative. An attacker who learns the origin address from an old DNS record, a leaked config, or a scan walks straight past him.
So Model 2 has a second half, and it is the half people skip. The origin firewall allows 443 only from Cloudflare’s published IP ranges and drops everything else. Cloudflare publishes those ranges for IPv4 and IPv6 and changes them rarely. Rarely is not never, so the allow list is something you maintain, not something you set once. The guard at the back door checks the source of each knock, and when the doorman knocks, the source is his.
The world without the back-door guard is worse in a quiet way. The site still works, so nobody notices that the origin is open. That is why the origin lock is the whole point of this model.
Here is the path a request takes:
- The visitor resolves the name and connects to a Cloudflare edge location, usually one near them. Cloudflare has several points of presence in India, as of the mid-2020s.
- The edge applies its rules: caching, the WAF, rate limits, and bot scoring.
- The edge connects to your origin on 443. The firewall checks that the source is on the Cloudflare list and lets it through.
- Caddy or nginx on the origin ends that TLS connection and forwards the request to the app.
Step 4 has a trap. Cloudflare’s SSL mode decides how strictly it checks the origin’s certificate. Full (strict) expects a certificate that a real authority signed, and a Let’s Encrypt certificate qualifies. A self-signed one does not, and the visitor gets an error page with code 526 while your app is fine. (The fix is on the origin side, not in the app.)
What it buys you is caching, a large amount of attack traffic absorbed before it touches the building, a managed WAF, and an origin address that is not on the front page of anything. What it costs is a third party in the path, a line on the bill once you need the higher tiers, and one more place where a rule can silently break a request. Chapter 14 covers the firewall rules themselves and Chapter 17 covers the proxy, so I will not repeat them here.
My opinion for a small production box: use Model 2 for anything mostly read and cacheable. For apps that take logins and payments, keep the proxy and the origin lock, but move the admin paths out of the public front door entirely. A proxy screens the doors it fronts. An admin panel should not have a front door at all.
Here is Model 2 as one picture, before we leave it.
Model 3: the tunnel that dials out
Section titled “Model 3: the tunnel that dials out”Model 2 still keeps a door on the origin. It is a locked door, and a locked door still needs a list, and someone has to remember to update the list. Model 3 removes the door. The origin does not listen for the internet at all. A small program called cloudflared runs on the server and opens connections outward to Cloudflare, and it keeps them open. When a visitor arrives at Cloudflare, the edge sends the request back down a connection the origin already made.
The trick is older than Cloudflare. When the far side cannot be reached, have the near side call out and hold the line open. Home servers behind routers that refuse inbound connections have used it for years, and Cloudflare turned it into a product for websites.
The world without it is the one you already know. If your server cannot take inbound connections, the usual fix is to open a door, which brings Model 1 back with extra steps. Either way the building stays visible to the street.
Here is the path a request takes:
cloudflaredauthenticates with a tunnel token and opens several long-lived outbound connections to Cloudflare’s edge.- A visitor reaches the edge for
app.pipeslab.in. - The edge matches the hostname to a route in your tunnel configuration.
- The request travels down an existing outbound connection to
cloudflared, which forwards it tolocalhost:3000.
Step 4 is the detail I like best. The app never needs a public interface at all. It listens on localhost, and only the connector talks to it.
Webhooks pass this test, and the dance academy depends on that. Razorpay sends its webhook to a public HTTPS name, that name resolves to Cloudflare’s public edge, and the call arrives. Your app still has to verify the signature, because the tunnel carries whatever reaches the name, not only Razorpay. The tunnel is a route, not a bouncer.
Uploads and WebSockets work through the tunnel, with limits. The edge caps request bodies at a size that depends on your plan. I would check the current number before promising a video upload, rather than trusting my memory of it. WebSockets are generally supported, so check your plan’s notes too.
My opinion for the research SaaS on Oracle: use the tunnel, close every inbound port in the VPS firewall, and leave SSH to Tailscale. The tunnel beats Model 2 because it has no allow list to maintain. Its cost is a new dependency. The cloudflared service must start on boot, and its token deserves the care you give a password.
Here is Model 3 drawn on the same city. The visitors, the doorman, and the building keep their places from the last two figures, so the only change is the direction of the connector.
Model 4: Tailscale-only, a private street
Section titled “Model 4: Tailscale-only, a private street”Your team-status tool has eight users, and every one of them carries a tailnet device. It needs no public door at all. Put it on a public URL behind a login page and you have built a lock that every scanner on earth will test. Leave it off the public internet entirely.
In this model the app has no public name and no public port. Devices you have signed into your tailnet reach it over the private network that Chapter 16 described, and nobody else can tell it exists. Tailscale Serve gives the app a tailnet name with HTTPS, reachable only from devices on your tailnet. I will not re-explain the mechanics here.
Before tailnets, the usual answer was a corporate VPN: one concentrator on a public address that everyone had to remember to dial. The tailnet is different because each device gets its own private address, and the tunnels form between devices. No single public box is the front door.
The best way for an internal tool is Tailscale-only with Serve, and never Funnel. Funnel is the setting that makes a Serve service public. If memory serves, it is an explicit opt-in per service, but check your own admin page rather than trusting my memory of which switch is which.
Your break-glass plan is the provider’s own web console, which does not depend on your network. Check that you can open it before you need it, because the day you need it is the day your SSH session will not connect.
Model 4 is easiest to see as the same city with the private street drawn in.
Model 5: the hybrid, and the default I would pick for you
Section titled “Model 5: the hybrid, and the default I would pick for you”Your team lead asked how to expose the dance-academy app, and why not just open the ports the way you did before. My answer is Model 5, and it is the one I would pick for you without much argument.
Models 1 to 4 each make one choice for the whole city. The hybrid makes two. Visitors and Razorpay come in through Cloudflare, to one public hostname, with the origin locked to Cloudflare as in Model 2. Everything that is not a visitor (SSH, the admin pages, the database, the status dashboard) lives on the tailnet, as in Model 4. The public street gets one door. The private street gets everything else.
The reason it exists is that the public and the plumbing have different jobs. Visitors need a door that stays up and screens strangers. You need a door that only you can use. One door cannot be both, so the hybrid stops asking it to be.
Here is the world without it. Last time, you opened 22 and 5432 “just for now,” and the 2 a.m. call came from a scanner rattling doorknobs on a Sunday, not from a student. The doorknob-rattlers are weather, not personal, but you do not have to leave the door unlocked for them.
How the webhook walks in
Section titled “How the webhook walks in”Razorpay posts a payment confirmation to a path such as /api/webhooks/razorpay on your public hostname. Walk the mantra for it: Name → Address → Route → Door → Guard → Receptionist → App. The name resolves through the directory to Cloudflare’s edge. The request is routed to the edge, passes the door, is screened by the guard, is handed to Caddy as receptionist, and reaches the app at the back.
The app’s first job is not to trust the request. It reads the raw body and checks Razorpay’s signature against the webhook secret before it believes a single field. A mismatch gets an error and nothing else. That signature check is what makes the public path safe. The network only makes the path reachable.
Razorpay retries a webhook that does not get a success answer, for a window I will not quote from memory. Check the current window in Razorpay’s dashboard, and make your handler idempotent so a retry does not charge a student twice.
Where everything else lives
Section titled “Where everything else lives”Postgres never sees the street. The app reaches it over the Docker network, and you reach it from your laptop only over the tailnet, with port 5432 closed to every public interface. SSH stays on the tailnet too, which is the subject of Chapter 16. The admin pages go on a tailnet name. You can put them behind Cloudflare Access as a second login if you ever need them from a browser away from the tailnet, but start tailnet-only, because every extra layer is one more thing that can fail at 2 a.m.
Why this is the default
Section titled “Why this is the default”I recommend it for four reasons.
- There is one public name and one public door, and that door is the only thing a scanner can reach.
- A leaked password for the admin page opens nothing from the street, because the admin page is not on the street.
- Each piece is boring and replaceable. You can move the origin, or drop Cloudflare, by changing the public door alone.
- Your break-glass path is the Oracle web console, which does not depend on either network.
What breaks when each provider is down
Section titled “What breaks when each provider is down”If Cloudflare is down, visitors and Razorpay cannot reach you, but admin and SSH still work over the tailnet, so you can see what happened. If Tailscale is down, admin and SSH are unreachable, but the public app keeps serving. Those are two different outages with two different fixes, which is exactly why you keep them apart.
Uploads go through Cloudflare too, so the body size limit depends on your plan. Send large files straight to object storage rather than through the app, and the question stops mattering.
The criteria, side by side
Section titled “The criteria, side by side”Here is the scorecard. Read a row to compare the five models on one question, or read a column to see one model’s whole personality. No column wins every row. That is what makes this a decision and not a shopping list.
| 1. Public VPS | 2. Proxy and lock | 3. Tunnel | 4. Tailscale only | 5. Hybrid | |
|---|---|---|---|---|---|
| Security | Every open port is attack surface | Origin has an IP, but only the doorman gets in | No inbound ports at all | Nothing public to attack | Small public surface, admin off the street |
| Simplicity | A familiar tutorial’s worth of steps | Two places to configure: DNS and firewall | One connector and one tunnel config | Install, log in, done | Most moving parts of the five |
| Cost | The VPS, nothing more | VPS plus Cloudflare free tier, as of the mid-2020s | VPS plus free tiers | VPS plus free personal tier | Same as 3 and 4 together |
| Latency | Direct, one hop | An extra hop, sometimes faster on cache hits | An extra hop through the edge | Direct when possible, relayed when not | Extra hop for the public app, direct for admin |
| Webhooks (Razorpay) | Works, with port 443 open | Works, if the origin rule admits the doorman | Works | Fails: Razorpay cannot reach a tailnet address | Works on the public path |
| WebSockets | Works | Works through the proxy | Works | Works between your own devices | Works on the public path |
| Uploads | Limited by your server | Limited by the plan’s request body size cap | Same cap as the proxy | Limited by your server | Send large files to object storage |
| Who needs access | Everyone, which is the problem | Everyone | Everyone | Only tailnet members | Public users to the app, the team to admin |
| If the provider is down | Your server, and its certificate renewal | Cloudflare down means the site is down, origin fine | Cloudflare down means the site is down, admin fine | Tailscale control plane down: existing sessions often survive, new ones may not | Each outage has its own fix |
| Lock-in | Low | Medium: DNS and rules live at Cloudflare | Medium to high: connector and routes | Medium: identity lives in the tailnet | Medium: both |
| Debuggability | Logs see everything, scanners included | Two sets of logs, and real visitor IPs need care | Connector logs plus origin logs | Easy for a small team | Good, if you keep the halves apart |
Three things stand out. Model 4 is the only one that cannot take a Razorpay webhook at all, because Razorpay cannot reach a tailnet address, so it is out for anything public. Model 1 is the cheapest and the least forgiving, because the VPS is the whole security story. Model 5 wins on security and debuggability and loses on simplicity, which is a fair trade only if you keep the public half and the private half separate in your head.
Two rules I use every time I score one of these.
- Score the failure, not the good day. Every model works when nothing is wrong, so the useful question is what happens when something is.
- Ask what the boring failure costs at 2 a.m. An outage at noon is an annoyance. The same outage at 2 a.m., with a payment waiting, is the phone call.
Putting the hybrid on the map
Section titled “Putting the hybrid on the map”Put the hybrid on the same map as the other four, and the picture gets quieter. The public half is the top band. A visitor, or Razorpay, reaches the doorman on 443 and nothing else. The doorman talks to Caddy, Caddy talks to the app, and the app talks to Postgres inside the building. Postgres never gets a door on the street. The scanner rattling port 22 is dropped at the wall, which is weather, not a personal attack.
The bottom band is yours. SSH, admin and the database console travel the tailnet and never touch the street.
The payoff is that the two halves fail separately. If Cloudflare has a bad morning, the public site goes down, but you can still log in and read the logs. If Tailscale has a bad morning, admin gets harder to reach, but the public app keeps serving customers. A single model couples those failures. The hybrid separates them, and each failure has a fix you wrote down in advance.
Four projects, four answers
Section titled “Four projects, four answers”Now the four projects. Each gets a recommendation and the reason for it. These are my picks for your situation, and I will say when a fact would flip the pick. Figure 18.6 puts all four side by side, after the research SaaS section.
The Bollywood box-office data site
Section titled “The Bollywood box-office data site”This one is public, read-heavy and cacheable. Put it behind the Cloudflare proxy with caching (Model 2), lock the origin to Cloudflare’s ranges, and serve as much as you can as static files, rebuilt after each data refresh. Most visitors never reach your VPS. The question that matters is less about which provider is down and more about whether last night’s refresh actually ran, so the site should show when its data was last updated.
The research SaaS on Oracle
Section titled “The research SaaS on Oracle”Users sign in, the app is public, and there is no third-party webhook yet, so you have a free choice. My pick is Model 2 with an origin lock, because it is the most boring option, and boring is what you want on a box you would rather not debug at midnight. Model 3 is the strong alternative if zero inbound ports matter more to you than one fewer provider in the path. Either way, SSH and the database stay on the tailnet. That is the private half of Model 5, applied to a Model 2 front door.
The dance-academy app
Section titled “The dance-academy app”This is the app the team lead asked about, and it gets the hybrid. The reasoning splits cleanly by who needs what.
Students and parents load pages through the doorman. The app sits behind Cloudflare, proxied, with the origin locked so that only Cloudflare reaches Caddy on 443. Ordinary visitors never see the origin address.
Razorpay is different. It is a visitor who cannot log in, and its servers have to reach your webhook URL on the public internet. So the webhook path stays public through Cloudflare, and you protect it with the signature instead of a password. Every webhook gets its signature checked against your webhook secret before a single row changes. A request without a valid signature gets rejected, and nothing else happens. If a bot rule starts challenging Razorpay’s requests, add a narrow skip rule for that one path. Do not switch the rule off for the whole site.
Postgres never has a public address. Its port is not in the firewall’s allow list at all, and the app reaches it over the Docker network. Admin pages go over Tailscale, so there is no public admin page to guess at. Resend is outbound only. The API key lives in the server environment, the app calls Resend from the server, and email needs no inbound port at all.
The team-status tool
Section titled “The team-status tool”Eight people use this tool, and none of them are the public. Tailscale Serve exposes it to your tailnet only, with no public DNS record and no doorman. Being on the tailnet tells you who is on the tailnet. It does not tell the tool who may see what, so the tool still has its own login.
The lab: an ADR for the lab VPS
Section titled “The lab: an ADR for the lab VPS”The lab VPS is throwaway, but the habit is not. Your goal is one Architecture Decision Record for it that puts every hostname and every port into one of the five models, says why, and names the break-glass path for each item. The lab domain pipeslab.in gives you the names: app., api., staging., admin., status., and the bare box itself.
Work through it in five steps:
- List what the box exposes. Write down every hostname that points at the lab VPS and every port that listens, including SSH and Postgres. A port that is not on your list should not be listening at all.
- Assign a model to each row. Pick one of Models 1 to 5. The public app might sit in Model 2 or Model 5, while Postgres belongs in a model with no public listener.
- Justify each row in one sentence. Tie the reason to the criteria: webhooks, WebSockets, uploads, who needs access, and what happens when a provider is down.
- Write the break-glass per row. For each item, say how you get in when its normal path fails. Tailscale down, Cloudflare down, a bad origin firewall rule, a lost laptop. Name the path, not the feeling.
- Write the back-out for the whole ADR. Like ADR-004 above, list the steps that return the box to its old exposure, in order, before you write the decision.
How you’ll know it worked: every row has exactly one model, a one-sentence reason, and a break-glass path. No row that claims to be private has a public port behind it. A stranger reading the ADR can tell which doors are open and why, and can undo your decision in three steps without asking you anything.
What you now know
Section titled “What you now know”You can look at a server and see five doors where you once saw one. A public VPS is simple and honest, but every port is on the street. A Cloudflare proxy with an origin firewall hides the origin behind a doorman. A tunnel dials out and leaves no inbound port at all. Tailscale moves the private things onto a private street. And the hybrid, with the public app through Cloudflare and admin through Tailscale, is the default I would pick for you.
More important, you can now defend that choice in writing, with a back-out plan. Most engineers skip that part. You did not. The chai has gone cold, but the decision is made, and you know how to reverse it. Well done.
Self-quiz
Section titled “Self-quiz”1. Why must the Razorpay webhook path be public, even in the hybrid model?
Razorpay’s servers send the webhook from the public internet, so they must be able to reach your hostname over HTTPS. Tailscale is not reachable by a stranger’s server. You keep the path public and protect it with signature verification instead.
2. What does a Cloudflare Tunnel remove that the proxy-plus-firewall model keeps?
The inbound ports. The tunnel connects outward from the origin, so the origin needs no open 80 or 443. The proxy model still leaves a door open, but only to Cloudflare’s address ranges.
3. Cloudflare has an outage. What happens to the hybrid model?
The public app and the webhook path go dark, because both enter through Cloudflare. Admin, SSH, and the database stay reachable over Tailscale, so your break-glass path still works while you wait.
4. Why does the dance-academy Postgres never get a public listener?
Scanners rattle every doorknob, and a listening database invites them to try passwords forever. With no listener, there is nothing to knock on. The app reaches the database over a private path, and nobody else can.
5. Why must the ADR include a back-out before the decision is final?
A decision is boring and reversible only if you know how to undo it. Writing the back-out first forces you to check that the steps exist and work. If you cannot describe the undo, you are not ready to ship.
Exercises
Section titled “Exercises”Warm-up 1. Name the five doors. In one line each, name the five exposure models.
Answer
1: public VPS on 80 and 443. 2: Cloudflare proxy with an origin firewall admitting only Cloudflare. 3: Cloudflare Tunnel with no inbound ports. 4: Tailscale-only. 5: hybrid, public app through Cloudflare and admin through Tailscale.
Warm-up 2. Match the need to the model. Pick a model for each: a Razorpay webhook, your SSH session from a laptop, and a team-status page for eight people.
Answer
The webhook needs a public HTTPS hostname, so Model 2 or Model 5 with signature checks. SSH from your laptop belongs on Tailscale, Model 4. The team-status page is Tailscale Serve, Model 4, with no public DNS.
Warm-up 3. Count the doors. Name the three things a public visitor passes through before the dance-academy Next.js code runs.
Answer
The Cloudflare edge, with DNS, proxy, and WAF. The origin firewall, which admits only Cloudflare ranges. Then Caddy or nginx, the receptionist, which terminates TLS and routes to the app.
Lab 4. Write the lab ADR. Using the lab section above, write the ADR for pipeslab.in, with one row per hostname and port.
Hint and model solution
Hint: on the lab VPS, list what listens with ss -tlnp, and check the firewall with sudo ufw status verbose. Compare the output with your list.
Model solution: a table with rows for app., api., staging., admin., status., SSH, and Postgres. Public app rows sit in Model 5 with Cloudflare. Admin and SSH sit in Model 4 over Tailscale. Postgres has no public row at all, and each row has its break-glass path.
Lab 5. Drill the break-glass. Pretend Tailscale is down on the lab VPS. Write the steps to reach SSH anyway.
Hint and model solution
Hint: check whether your provider has a web console for the VPS, and confirm that the console login lives in your password manager, not in the ADR.
Model solution: the provider console is the break-glass path for SSH, with the recovery login stored outside the box. Write it as a numbered step list that names where the credential lives, without the credential itself.
Lab 6. Hunt the orphan port. Find one listening port that your ADR does not mention, and decide what to do with it.
Hint and model solution
Hint: run ss -tlnp again and compare it with your table line by line. Stop any service you did not plan to run.
Model solution: an unlisted port is a bug in the ADR. Either close it, or add a row with a model and a break-glass. Never leave it unclassified.
Staff 7. One-page proposal. Write a one-page proposal for exposing internal tools to your team, including owners and a review date.
Model answer
Default every internal tool to Tailscale-only, served through Tailscale Serve, with no public DNS. Each tool has one named owner, a break-glass path that does not depend on the tool itself, and a review date a year out. Any exception to Tailscale-only needs a written reason and a back-out.
Staff 8. Explain the webhook to a PM. Explain, in plain language, why the webhook works on your laptop but fails in production.
Model answer
On your laptop, nothing outside your machine calls the webhook, so nothing is tested for reachability. In production, Razorpay must reach a public HTTPS address, through DNS, Cloudflare, the origin firewall, and the receptionist. Any one of those can block it, and the signature secret must match the live account, not the test one.
Staff 9. Draw the dance-academy request path. Draw the path a Razorpay webhook takes to the app, and mark every place it can fail.
Model answer
Razorpay, then DNS, then the Cloudflare edge with its WAF, then the origin firewall that admits only Cloudflare ranges, then Caddy with its certificate, then the Next.js webhook handler with its signature check, then Postgres on a private path. Marked failures: a wrong DNS record, a WAF rule blocking the POST body, a firewall rule that drops after a range change, an expired certificate, a signature mismatch from the wrong key, and a database connection limit. Resend is outbound and fails separately, so it gets its own mark.
Book 2 of a series. Book 1: The Glue.