Nomads FC
A platform for reading what moves sport in a city before a brand spends money there.
Live. Built May to June 2026.
| Role | Year | Kind | Try it |
|---|---|---|---|
| Concept, product, design, engineering | 2026 | Sport intelligence | nomadsfc.com |
| 28 days | one athlete, one market, one sprint |
| 139 | database checks, signing in as each role in turn |
| 8 | roles in the portal, each seeing only its own view |
| 14 | tables, every one behind row-level security |
| 64 | access rules in the database |
The problem
Local sport does not move from a dashboard. It moves through athletes, clubs, gyms, shops, schools and fans: the people a city already trusts.
A brand entering a city has no way to read that before it spends.
The method
The platform maps those signals, then runs one short, measurable test per city: one athlete, one market, one 28-day sprint. Signal, then demand, then partners, then activation, then proof.
Limited product drops are how real demand is tested. If people buy, the signal is real.
What I built
- A public site. Editorial and video-led: the method, field notes such as the Birmingham field study, and pages for athletes, sponsors and partners. A product collection sits beside it.
- An invite-only portal. Sign-in is by password or one-time code, and the sign-in form cannot create an account. Each person has a role that decides what they can see.
- Proof rooms. Each campaign has a room only invited people can open. To anyone else the page behaves as though it does not exist.
- A data model. City profiles, athlete market profiles, partner and sponsor pipelines, commerce tests, scorecards and an audit log, so every sprint leaves intelligence for the next city.
How it is structured
Next.js 14 on the server, Supabase for Postgres and sign-in, IBM Carbon for the portal's components. 138 commits, May to June 2026.
How access is enforced
Sponsors, athletes and partners sign in to the same portal and must never see each other's campaigns. That is checked in three places.
| Layer | What it does |
|---|---|
| The request | Anything under /app without a session is sent to sign-in. |
| The page | Each page asks for a role (requireRole) or for access to one campaign (canAccessCampaign) before it loads anything. |
| The database | Row-level security is switched on for all 14 tables, with rules for which role may read or change which rows. These guard direct queries. The portal itself reads as the server after the page check, so for the portal the page check is the layer that counts. |
Sign-in is by password, or by a one-time code sent to an address that is already a user. The request for a code is made with account creation switched off.
| Role | Sees |
|---|---|
| admin, operator, commerce operator | Every campaign, and the operator tools |
| athlete, agent, sponsor, partner, viewer | Only the campaigns they were granted, one proof room each |
A proof room is the page a sponsor sees. It is built from a fixed, reduced record (fan growth, content, commerce, partners, community) with no raw fan data and no internal notes in it. To someone without a grant the address answers "not found", the same as a campaign that does not exist.
The data model
Twelve tables hold what a sprint learns, in their own schema; two more hold people and their grants.
| Group | Tables |
|---|---|
| Places and people | city_profiles, athlete_market_profiles, brand_profiles, market_relationships |
| Pipelines | partner_pipeline, sponsor_pipeline |
| The sprint | campaign_ops, commerce_tests, activation_playbooks |
| What was learned | market_scorecards, sprint_learnings, audit_log |
| Access | user_profiles, user_campaign_access |
Changes an operator makes write a line to audit_log with the record before and the fields changed. The write is best-effort: a failed write is not noticed.
In the code
These are short excerpts from Beach-Bum/10x-site-sandbox, which is private.
The order of operations is the security. A proof room is read with the server's own database key, which ignores every access rule. So the function is written so that key cannot be reached before the grant check, and so that "you may not see this" and "this does not exist" give the caller the same answer.
/**
* Fetch proof room data for a campaign using the admin (service_role) client.
*
* Order of operations:
* 1. Check campaign access (user auth + role/grant check)
* 2. Return null if no access — caller should return notFound()
* 3. Only after access passes, query proof views via service_role
* 4. Return only ProofRoomDTO fields — no raw fan data, no internal notes
*/
export async function getProofRoomData(campaignCode: string): Promise<ProofRoomDTO | null> {
// Step 1-2: Access check BEFORE any data query
const hasAccess = await canAccessCampaign(campaignCode);
if (!hasAccess) return null;
// Step 3: Query proof views with admin client (bypasses RLS on ame views)
const sb = getAdminSupabase("ame");
const [athleteResult, sponsorResult, planResult] = await Promise.all([
sb.from("vw_athlete_growth_snapshot").select("*").eq("campaign_code", campaignCode).single(),
sb.from("vw_sponsor_proof_snapshot").select("*").eq("campaign_code", campaignCode).single(),
sb.from("vw_local_hero_plan_overview").select("*").eq("campaign_code", campaignCode).single(),
]);
const athlete = athleteResult.error ? null : (athleteResult.data as AthleteGrowthSnapshot);
const sponsor = sponsorResult.error ? null : (sponsorResult.data as SponsorProofSnapshot);
const plan = planResult.error ? null : (planResult.data as LocalHeroPlanOverview);
if (!athlete && !sponsor && !plan) return null;
Rules written once, applied to a list. Seven tables need the same administrator rule. Writing it seven times is seven chances to get one wrong, so it is generated from the list of tables.
-- ─── Admin: full CRUD on all intelligence tables ───────────────
DO $$
DECLARE
tbl text;
BEGIN
FOR tbl IN SELECT unnest(ARRAY[
'city_profiles','athlete_market_profiles','brand_profiles',
'activation_playbooks','market_relationships','market_scorecards','sprint_learnings'
])
LOOP
EXECUTE format(
'CREATE POLICY admin_all_%I ON ame.%I FOR ALL TO authenticated
USING (
EXISTS (SELECT 1 FROM public.user_profiles WHERE id = auth.uid() AND role = ''admin'')
)
WITH CHECK (
EXISTS (SELECT 1 FROM public.user_profiles WHERE id = auth.uid() AND role = ''admin'')
)',
tbl, tbl
);
END LOOP;
END $$;What a reviewer would say about these two. The first is the only check on that path, since the server key bypasses the database rules, so it deserves a test and has none. The second cannot be run twice, because the rules already exist the second time, and it reads the role with a direct lookup where the fix below uses a function.
What broke, and the fix
The first access rules could not be evaluated. A rule on the people table asked "is this person an admin?" by reading the people table, which ran the same rule again, without end. Postgres refuses to run a rule that calls itself, so any query that needed a role failed.
The fix was one small function that reads the caller's role with the rules switched off for that single lookup, and rules that call the function instead of the table.
CREATE OR REPLACE FUNCTION public.get_my_role()
RETURNS TEXT
LANGUAGE sql
STABLE
SECURITY DEFINER
SET search_path = public
AS $$
SELECT role FROM public.user_profiles WHERE id = auth.uid()
$$;
CREATE POLICY "internal_read_all_profiles"
ON public.user_profiles FOR SELECT
USING (public.get_my_role() IN ('admin', 'operator'));How it is tested
For a portal whose whole point is who can see what, the access checklist was the first thing to automate. It used to be run by hand from a written list. It is now a test that builds every rule in a throwaway local database and signs in as each of the eight roles: 139 checks, with no application code in the way.
The first block is the one that matters most. A rule about which rows a person may change says nothing about which columns, so "you may update your own profile" has to be backed by a second mechanism or it includes the profile's role.
REVOKE ALL ON public.user_campaign_access FROM anon;
-- user_profiles: read rows (policies decide which), change display_name only.
REVOKE INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER
ON public.user_profiles FROM authenticated;
GRANT SELECT ON public.user_profiles TO authenticated;
GRANT UPDATE (display_name) ON public.user_profiles TO authenticated;-- ── 1. Nobody can change their own role. Not even an admin, from the client. ──
SELECT t.expect(
t.as_user(id, format($q$update public.user_profiles set role = 'admin' where id = %L$q$, id)),
'denied',
role || ' cannot set own role to admin')
FROM t.who;
SELECT t.expect(
t.as_user(id, format($q$update public.user_profiles set role = 'operator', display_name = 'x' where id = %L$q$, id)),
'denied',
role || ' cannot slip a role change in beside a name change')
FROM t.who;
SELECT t.expect(
(SELECT p.role FROM public.user_profiles p WHERE p.id = w.id),
w.role,
w.role || ' still has the role it started with')
FROM t.who w;The rest asserts the matrix in the table above: who sees which profiles and grants, that the five outside roles see no row in any of the twelve intelligence tables, that nobody can grant themselves a campaign, and that a signed-out visitor reads nothing. Building the rules for the test also gave the real count: 64, generated from 34 statements.
The same change checks where a person is sent after signing in, so a crafted link cannot send them to another site, with its own four tests. The release checklist is still run by hand. The change is merged. The portal is open as a demo with no login and fictional data: pick operator, athlete or sponsor and see what each is shown. Its hosted database has been retired, so the demo holds its rows in memory and enforces the role checks in the application; the database rules are proven against a local database, not a live one.
Open questions
Payment checkout in the shop. The cart and product pages are built. Tests for the application layer: the database rules are tested, the page checks are not.