Products / Production Control Dashboard

Production Control Dashboard: Technical Deployment

I turned a production control storyboard into a working web app that tracks every part number through each shop station, with sign-in and three permission levels. Try the demo (fictional data).

Project summary

ClientManufacturing company (name withheld)
My roleDesigner and developer: storyboard, front end, database, access rules, deployment
ProblemPart status lived in spreadsheets, so nobody could see at a glance which parts were at which stage, which were late, or which assemblies could be built
DeliveredA JavaScript dashboard behind a login page, hosted on Cloudflare, with sign-in and data in Supabase
UsersAdmins, superusers and station leads, each with different read and write rights

The first version was a storyboard prototype built as a Claude dashboard. I converted it into a standalone JavaScript app, moved its data into Postgres tables, and added real sign-in and server-side access rules.

Architecture

The app is a static JavaScript site with no application server: Cloudflare serves the files, and the browser calls Supabase directly for sign-in and data.

The browser talks straight to Supabase, and Postgres enforces every role Private GitHub repoCloudflare PagesUser's browser SupabaseSupabase AuthPostgres + RLSIdentity provider Login page, dashboard JS,SQL migrations Builds and hosts the siteon every push to main Login page + dashboard,anon key + session token OAuth sign-in,issues the session token Confirms who theuser is pushserves sign indata, with session token OAuth 6 tables, role policies,lead functions, audit log

GitHub feeds Cloudflare, Cloudflare serves the page, and every data call goes from the browser to Postgres, where row-level security decides what each role may see or change.

Authentication and roles

People sign in on the main login page with OAuth through Supabase Auth; the app never handles passwords. After sign-in, the user's role comes from their profile row, and Postgres checks that role on every read and write.

  1. The login page sends the user to the OAuth provider through Supabase Auth.
  2. Supabase returns a session token, and the app loads the user's profile and role.
  3. The dashboard shows only the controls that role may use.
  4. Every query carries the token, so Postgres row-level security decides what is actually returned or saved.
ActionAdminSuperuserLead
See all parts, jobs and assembliesYesYesYes
Add notes to a partYesYesYes
Move a part to the next stageYesYesOwn station only
Flag a holdYesYesOwn station only
Release a hold, set any stageYesYesNo
Add parts, import and exportYesYesNo
Manage users, roles and settingsYesNoNo

Hiding a button in the browser is only a convenience. The rule that counts is the database policy, so a user who edits the page still cannot change data their role does not allow.

Data model

Six Postgres tables hold the shop's state; a part's current station is one column, and every change also writes a row to the activity log.

TableOne row perKey columns
profilesSigned-in personid (= Supabase user id), name, role (admin, superuser, lead), station_id (leads only)
stationsShop stageid, name, sort_order (Saw, CNC, Weld, QC, Paint, Assembly, Shipped)
jobsCustomer jobid, customer, due_date, priority
assembliesAssembly on a jobid, part_number, job_id, qty, due_date
partsPart number on an assembly's bill of materialsid, part_number, assembly_id, qty, station_id, due_date, hold_reason, moved_at
activityChange madeid, part_id, user_id, action, detail, created_at

Status is computed, not stored: a part is late when its due date has passed, at risk inside the warning window, and blocked when it has a hold reason. An assembly is ready to build when every part on it has reached the Assembly station.

Row-level security

Row-level security is on for every table, so the database enforces each role's rights no matter what the browser sends. Admins and superusers write through table policies; leads have no direct update rights and change parts only through two database functions that check their station.

Two helper functions read the signed-in user's profile:

create function public.my_role() returns text
  language sql stable security definer set search_path = public
  as $$ select role from profiles where id = auth.uid() $$;

create function public.my_station() returns bigint
  language sql stable security definer set search_path = public
  as $$ select station_id from profiles where id = auth.uid() $$;

Policies on parts (the same pattern covers jobs and assemblies):

alter table parts enable row level security;

create policy "signed-in users read parts" on parts
  for select to authenticated using (true);

create policy "planners change parts" on parts
  for all to authenticated
  using (my_role() in ('admin', 'superuser'))
  with check (my_role() in ('admin', 'superuser'));

The lead path is a function, because a policy cannot compare a row's old and new values:

create function public.advance_part(p_id bigint) returns void
  language plpgsql security definer set search_path = public as $$
begin
  update parts set station_id = station_id + 1, moved_at = now()
   where id = p_id and hold_reason is null
     and (my_role() in ('admin', 'superuser')
          or (my_role() = 'lead' and station_id = my_station()));
  if not found then raise exception 'not allowed'; end if;
  insert into activity (part_id, user_id, action) values (p_id, auth.uid(), 'advance');
end $$;

A matching flag_hold(p_id, reason) function lets a lead place a hold on a part at their station. Station ids follow the route order, so adding 1 moves a part to the next stage. Only admins can update profiles, so nobody can raise their own role.

Hosting and deployment

The code lives in a private GitHub repository, and Cloudflare Pages deploys it on every push to the main branch; there is no server of my own to maintain.

  1. Repository. A private GitHub repo holds the login page, the dashboard JavaScript, and the SQL migrations for the schema and policies.
  2. Database. I applied the migrations to the Supabase project, which created the tables, helper functions and row-level security policies.
  3. Sign-in. In Supabase Auth I turned on the OAuth provider and added the Cloudflare site address as the allowed redirect URL.
  4. Hosting. I connected the repo to Cloudflare Pages. A push to main publishes the site, and every other branch gets its own preview address for testing.
  5. Configuration. The Supabase project URL and the public anon key are set as Cloudflare Pages environment variables and read by the front end. The service-role key never goes to the browser or the repo.
  6. Release. Changes are tested on a preview branch, then merged to main, which Cloudflare deploys within a few minutes. A bad release is rolled back by redeploying the previous build in Cloudflare.

Operations, security and the public demo

The production app holds the client's data and stays private; a separate public demo with fictional data shows how it works.

  • Security. Only signed-in users get data, every write is checked by a database policy, and the browser only ever holds the public anon key.
  • Audit trail. Every move, hold and note writes a row to activity with the user and time, so leads and planners can see who changed what.
  • User management. An admin assigns each new user's role and, for leads, their station. New sign-ins have no write rights until an admin assigns a role.
  • Backups. Supabase keeps the Postgres backups for the project.
  • Public demo. The demo on this site runs the same screens on fictional parts and jobs. It swaps OAuth for a role picker and saves to the visitor's browser, so no client data is ever exposed.

Try the demoBack to Products