From demo to production · Carousel

The 10 layers that separate a demo from production

AI builds you an app that works in minutes. These are the ten layers that turn it into a system you can trust: security, performance, reliability.

The carousel as it was published, slide after slide. Below, the same content as text.

Identity and permissions

Security · who you are, and what you're allowed

Before anything else, the system has to know who is calling it, and what they're allowed to touch. Without this layer, everyone's data is exposed to everyone.

  • Authentication is checked on every request, on the server side, not only on the login screen.
  • Permissions are enforced where the data sits (RLS), not in a button in the interface.
  • Logged in isn't authorized. These are two separate checks, always.

This is the first layer that breaks, and also the most dangerous when it's missing.

Safe input

Security · trust nothing from outside

Everything that comes from the user is suspect until proven otherwise. Validation checks that the input makes sense, sanitization neutralizes harmful input.

  • Validation on the server side, not just a pretty indication on the client side.
  • Sanitization prevents XSS and SQL injection from input that looks innocent.
  • You define what's allowed (a schema), instead of guessing what's forbidden.

Unfiltered input is the easiest way to break into a system that looks fine.

Secrets and keys

Security · a key on the client side is public

An API key sitting in code that runs in the browser is visible to anyone who opens DevTools. Secrets live on the server only, and don't go into git.

  • Secrets in environment variables, not written inside the code.
  • Sensitive keys, like service_role, only on the server.
  • What runs in the browser is visible. Always, without exception.

The difference between a public key and a secret one isn't its name, but where it runs.

Rate limiting

Security · not every request gets in

Without a request ceiling, one script can try a million passwords overnight, scrape all the data, or burn through your API account.

  • A ceiling for login screens, forms and expensive endpoints.
  • Limiting by IP, user or key, on the server side.
  • A dedicated layer before the request touches the application.

An open endpoint without a ceiling is an invitation: to bots, and to a huge invoice at the end of the month.

Efficient queries

Performance · N+1, indexes, and how many columns

The way you talk to the database decides whether the page loads in 40 milliseconds or in 4 seconds.

  • N+1: one query with a join, instead of 50 inside a loop.
  • An index on every column you filter or search by.
  • Pull only the columns that are displayed, not everything just in case.

Most slowness isn't in the application. It's in how it asks for the data.

Load and scale

Performance · when the system breaks

An app that's fast for one user can die at 200 at the same time. You can calculate the breaking point in advance.

  • L = λ × W: Little's Law, the mathematics of load collapse.
  • Plan for the peak, not the average. Users arrive in waves.
  • A load test finds the limit before the customer finds it.

You don't choose whether there will be load. You choose whether it surprises you.

Loading experience

Performance · what the user feels

Even with a fast server, a heavy page feels slow. Pagination, images and caching determine the first impression.

  • Pagination: load page after page, not 10,000 rows at once.
  • Images at the right size, with lazy loading. Not 4MB for a tiny image.
  • Caching: don't pull again and again what you already have.

The user doesn't measure milliseconds. They feel whether it's quick or stuck.

Error handling

Reliability · what happens when something breaks

An unhandled error does double damage: it exposes the internals to an attacker, and leaves the user in front of a white screen.

  • For the user a clean message, for the log all the details.
  • Safe failure: a transaction that failed rolls back, it doesn't get stuck in the middle.
  • try/catch isn't decoration. It's the decision of what happens at the moment of truth.

A system is measured not when everything works, but by what happens when it doesn't.

Backups and restore

Reliability · data you can get back

An accidental deletion, a migration that went wrong, one bad prompt, and the data is gone. A backup you never tested restoring from is a hope, not a backup.

  • A backup that's automatic, scheduled, and stored outside the original server.
  • PITR (point-in-time recovery) in a managed database is worth every penny.
  • Practice restoring in advance. On the day of the disaster it's too late to learn.

The question isn't whether you'll lose data, but how fast you'll get it back.

Monitoring and logging

Reliability · knowing what's really happening

A system without logs is an airplane without a black box. When something breaks, either you have a record, or you have guesses.

  • Security: who tried to log in 50 times? Who pulled 10,000 records?
  • Performance: which query is slow, and why exactly today.
  • Audit log: what happened, when, and by whom. No arguments.

What isn't monitored doesn't exist, the moment something goes wrong.

A demo is easy. Production is these ten layers.

AI builds the beginning in minutes. These ten layers are what turn a demo into a system you can trust.

What closes the chapter

A demo is easy. Production is these ten layers.

Did a post meet you in your system?

Half an hour, the system open, free. You leave with your open decisions.

or on WhatsApp, if it's a single question. Nothing is stored on the site.