YSBDesigns

Engineering

Six things I believe, and the files that prove it.

Press anything on this page. Every principle has one thing you can run and one piece of evidence you can open, pointing at a public repository.

Counted on the day, not read off a badge — the command that reproduces each one is underneath it.

Put the rule where it cannot be argued with

A rule in the app can be got round — by a bug, by another screen, by somebody editing the page in their browser. A rule in the database cannot, because every way in goes through it.

The cost It is slower to write and harder to change later. That is the trade, and it is worth it for the rules that would be expensive to get wrong.

Try it

Two clients tap the same 9am slot at the same moment. Both are told it is free — because at the instant they looked, it was. Only one of them can actually have it, and the database is what settles the argument.

Phone one
  1. Is 09:00 free?
  2. Told: yes, it's free
  3. Write the booking

 

Phone two
  1. Is 09:00 free?
  2. Told: yes, it's free
  3. Write the booking

 

Press the button to let both phones try at the same time.

Checking "is it free?" in app code only narrows the gap between the check and the write. The rule is an EXCLUDE USING gist constraint over the studio and the time range, so the second write raises 23P01 and rolls back by itself. Cancelling frees the slot, because cancelled rows sit outside the constraint.

Show the evidence4 things you can go and read
  • Booked In

    Two phones can take the same 09:00. booking_no_overlap is an EXCLUDE USING gist over the studio and a tstzrange, so the second write raises 23P01 and rolls back. Cancelled rows sit outside the constraint, so cancelling frees the slot without any code deciding it should.

  • Booked In

    A treatment needing a patch test cannot be booked by somebody whose test has lapsed — and booking the test is the record, so nothing has to be remembered afterwards.

  • Bolton Vouched

    A provider row cannot reach live without recorded consent: a CHECK constraint, not a rule in the admin screen. Stored beside the timestamp is a SHA-256 of the exact wording accepted, so what was agreed is provable, not just when.

  • MasjidOne

    Every table carries a masjid_id that is not null with no default, filled by current_masjid(). A health_check() function asserts it — and caught a table built exactly as its design drawing showed, where the drawing had no tenant column at all.

A check that cannot fail is worse than no check

A green tick you have not earned buys confidence you should not have. The gates worth building are the ones allowed to say no.

The cost Gates block you on your own bad days too. Nobody has ever regretted one at 2am.

Try it

Before an app update can be built for the store, a check asks: has this exact version already been run and seen to start? If the answer is no, it refuses — even if everything else passed.

Press a button to send a version down the pipeline.

Really runs as native-release.yml — it asks the GitHub API for a successful smoke run at this commit's own head_sha, and exits non-zero when the count is zero.

Show the evidence3 things you can go and read
  • Taiyabah — native-release.yml

    The Play bundle workflow refuses to run unless that exact commit already has a successful smoke run. It asks the GitHub API for runs at head_sha and exits non-zero when the count is zero.

  • Why it exists

    Five iOS builds went green having executed none of the project’s code — the job built -configuration Debug, which expects a Metro dev server no runner has. The app launched, stayed alive and wrote no crash report. The screenshots were 72% black and nothing was looking at them.

  • ysbdesignsportfolio — deploy.yml

    This site’s own build fails if CNAME is missing from the output, because a build that drops it takes the custom domain down while still reporting success.

Trust the source, not your copy of it

A file in your repository says what you intended. The service says what is true. When they disagree, only one of them decides whether the thing works.

The cost It means one more network call in CI, and a job that can fail for reasons outside your diff.

Try it

The file in the repository says the app is verified. The service is what actually decides. Change one and see which one CI believes.

Your repository

assetlinks.json

says: verified

Google's API

Digital Asset Links

says: verified

Both sources agree, so the build goes ahead.

The job asks the API rather than reading the file beside it. Only one of the two decides whether a store install opens without a browser bar — and it is not the one in your repository.

Show the evidence3 things you can go and read
  • Taiyabah — android-build.yml

    Before building, the job asks Google’s Digital Asset Links API whether the live site actually verifies the app, rather than trusting the assetlinks.json sitting in the repository. Only one of the two decides whether a store install opens without a browser bar.

  • Taiyabah — deploy-worker.yml

    The notification Worker deploys, and then the job re-requests it and fails if it is not answering. A deploy step exiting zero means the upload worked, not that the thing is up.

  • Across two repositories

    CI asserts the native app and the website agree — on copy, on where every link points, and on colour. Two surfaces describing the same masjid differently is a bug nobody catches by hand.

Closed by default, including things that do not exist yet

Permissions granted by remembering get forgotten. Start shut, open one door deliberately, and a table added next year starts shut too.

The cost You will lock yourself out at least once while building it.

Try it

Every masjid's information sits in one database. Each row knows which masjid it belongs to, and the database — not the app — decides what you are allowed to see. Sign in as someone else and watch the rows disappear.

  • Masjid APrayer timetable
  • Masjid BMadrasah register
  • Masjid AHall booking
  • Masjid CGift Aid record
  • Masjid BDonation
  • Masjid ANotice

Nobody is signed in, so no rows are readable.

Every table carries a masjid_id that is not null with no default. Row Level Security scopes each read; the app never gets to ask for someone else's rows.

Show the evidence4 things you can go and read
  • Taiyabah

    The imam’s advice table has Row Level Security on and no policies at all, with every grant revoked. No policy means no row passes; the only way in is a function that checks the role itself — and it deliberately does not fall back to administrator, because somebody writing to the imam in confidence is not writing to the committee.

  • Bolton Vouched

    The anonymous role is stripped of every grant and default privileges are revoked too, so a table added next year starts closed. One view is the only door — and its helpers live in a schema the public cannot reach, because Postgres checks function permissions against the calling role even inside a view.

  • Tidemark — Pages build

    The job that runs npm ci, and so every dependency’s install scripts, holds contents: read and nothing else. Only a separate job holds pages: write, so a compromised postinstall script cannot publish.

  • Booked In — build.sh

    The publish step will not emit a dist/ holding a service-role key. It decodes every JWT it finds and reads the role claim rather than grepping for a phrase, because the two keys look alike and a comment mentioning one is not a leak.

The screen will tell you it worked

Interfaces report what they were asked to do, not what happened. The worst bugs I have shipped were all reported as successes.

The cost Distrusting your own tooling is tiring. It is still cheaper than the alternative.

Try it

A week of prayer reminders should land one at a time, over seven days. Because of a single missing word, every one of them was delivered the instant it was set — and the screen still said they were scheduled.

  1. Now
  2. Day 2
  3. Day 3
  4. Day 4
  5. Day 5
  6. Day 6
  7. Day 7

Press a button to arm a week of reminders.

The library matches a trigger on its type field and drops anything it does not recognise through to a default of null — and a null trigger does not mean never, it means deliver it now. The old shape was accepted silently, so all thirty-six were spent at once and not one was ever really scheduled.

Show the evidence3 things you can go and read
  • Taiyabah — prayer reminders

    The settings screen said “36 reminders are scheduled on this phone” over an empty queue. The library matches a trigger on its type field and drops anything unrecognised to a null default — and a null trigger does not mean never, it means deliver it now. Every reminder was spent the instant it was set.

  • MasjidOne

    Features were tagged in development across a product site because their tables were empty. They were complete and enforcing; nobody had used them yet. Months of telling customers that a shipped feature was coming. Zero rows is a usage fact, not a capability fact.

  • A scheduled reconciler

    Green every five minutes for weeks, purely because nothing was ever queued for it. The first item it resolved raised 23502 and rolled back everything it had just written. An idle scheduled job is not a passing one.

Build for the real crowd, not the demo

Limits sized against a room full of people meet a congregation. The failure is silent, and it lands on the one day it matters.

The cost It means guessing at a population you have not got yet, and sometimes guessing high.

Try it

Everyone on the masjid wifi shares one address, so a per-address limit counts the whole building as one person. Watch where the cap lands.

0 reached · 0 silently refused

Press a button to announce the app and let every phone register at once.

The cap was 600 an hour, set when the note beside it said “high enough that a room full of people never reaches it”. An address cap cannot tell a congregation from an attacker; a per-device cap can, and that is the one left with teeth.

Show the evidence3 things you can go and read
  • Taiyabah

    Everyone on the masjid wifi leaves through one public IP, so a per-IP cap counts the whole building as a single caller. The tag-write cap was 600 an hour, set when the note beside it said “high enough that a room full of people never reaches it”.

  • What it would have cost

    The hour after the app is announced at Jumuʿah is the one hour when every phone writes its tags at once. The 601st person would be refused and left untagged — silently unreachable by every announcement afterwards, holding an app that otherwise works perfectly, with nothing pointing at the cause.

  • The fix

    An address cap cannot tell a congregation from an attacker; a per-device cap can. The shared-address limits now fit the real population and the per-device cap is the one left with teeth.

What it all runs on

  1. What you touch

    • React
    • Next.js
    • TypeScript
    • Tailwind CSS
    • Expo
  2. What builds and ships it

    • GitHub
    • GitHub Actions
    • Cloudflare Workers
    • Railway
    • Render
  3. Where the rules live

    • PostgreSQL
    • Supabase
    • Stripe

None of this is AWS, Azure or GCP. The concepts move — tenancy, least privilege, build gating, webhook idempotency, deploy verification — but I would rather say what I have run than imply a console I have not.

Want to go deeper?

Every repository behind this page is public, and the commit messages explain the reasoning rather than the change. Happy to walk through any of it.