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
| Client | Manufacturing company (name withheld) |
| My role | Designer and developer: storyboard, front end, database, access rules, deployment |
| Problem | Part 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 |
| Delivered | A JavaScript dashboard behind a login page, hosted on Cloudflare, with sign-in and data in Supabase |
| Users | Admins, 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.
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.
- The login page sends the user to the OAuth provider through Supabase Auth.
- Supabase returns a session token, and the app loads the user's profile and role.
- The dashboard shows only the controls that role may use.
- Every query carries the token, so Postgres row-level security decides what is actually returned or saved.
| Action | Admin | Superuser | Lead |
|---|---|---|---|
| See all parts, jobs and assemblies | Yes | Yes | Yes |
| Add notes to a part | Yes | Yes | Yes |
| Move a part to the next stage | Yes | Yes | Own station only |
| Flag a hold | Yes | Yes | Own station only |
| Release a hold, set any stage | Yes | Yes | No |
| Add parts, import and export | Yes | Yes | No |
| Manage users, roles and settings | Yes | No | No |
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.
| Table | One row per | Key columns |
|---|---|---|
profiles | Signed-in person | id (= Supabase user id), name, role (admin, superuser, lead), station_id (leads only) |
stations | Shop stage | id, name, sort_order (Saw, CNC, Weld, QC, Paint, Assembly, Shipped) |
jobs | Customer job | id, customer, due_date, priority |
assemblies | Assembly on a job | id, part_number, job_id, qty, due_date |
parts | Part number on an assembly's bill of materials | id, part_number, assembly_id, qty, station_id, due_date, hold_reason, moved_at |
activity | Change made | id, 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.
- Repository. A private GitHub repo holds the login page, the dashboard JavaScript, and the SQL migrations for the schema and policies.
- Database. I applied the migrations to the Supabase project, which created the tables, helper functions and row-level security policies.
- Sign-in. In Supabase Auth I turned on the OAuth provider and added the Cloudflare site address as the allowed redirect URL.
- Hosting. I connected the repo to Cloudflare Pages. A push to
mainpublishes the site, and every other branch gets its own preview address for testing. - 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.
- 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
activitywith 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.