Plan
1. Sign-in
I'll use Replit Auth for sign-in and Replit's built-in PostgreSQL database for storage. Both come with your platform, so there is nothing extra to install. The session key and the database address go in Replit's Secrets. Photos of fabric or designs go in Replit Object Storage, because they are too large for the database.
Anyone can reach the sign-up screen, but signing up gives no access to shop data. An account sees shop data only if the owner has added that person's email first. Everyone else sees a "No access" screen. This is the stricter reading of "nobody else should see my shop data."
2. Tables
Every record below carries a shop_id, which ties it to the shop that owns it. Your real shop and the demo shop are separate, and the server checks shop_id on every request. Money is stored in pesewas (whole numbers) to avoid rounding errors, and is shown on screen as cedis.
users (one row per signed-in person, filled in by Replit Auth)
| Field | Type | Notes |
|---|
| id | text, primary key | Account ID from Replit Auth |
| email | text, unique | Used to match against the allowed list |
| display_name | text | Shown on "Sewing by" |
| created_at | timestamp | |
shops
| Field | Type | Notes |
|---|
| id | uuid, primary key | |
| name | text | "Wrodessa Stitches", or "Demo Shop" |
| owner_user_id | text → users.id | |
| is_demo | boolean | True for the sample-data shop |
| created_at | timestamp | |
shop_members (who is allowed in, and in which role)
| Field | Type | Notes |
|---|
| id | uuid, primary key | |
| shop_id | uuid → shops.id | |
| email | text | Added by the owner before the person signs up |
| user_id | text → users.id, nullable | Filled in at their first sign-in |
| role | text: owner or apprentice | |
| active | boolean | Owner can switch off access without deleting history |
customers
| Field | Type | Notes |
|---|
| id | uuid, primary key | |
| shop_id | uuid → shops.id | |
| name | text, required | |
| phone | text | Never sent to an apprentice |
| area | text | e.g. "Osu", "Madina" |
| notes | text | e.g. "prefers loose fit" |
| created_at / updated_at | timestamp | |
measurements (a new row each time; old rows are kept)
| Field | Type | Notes |
|---|
| id | uuid, primary key | |
| shop_id | uuid → shops.id | |
| customer_id | uuid → customers.id | |
| taken_on | date, required | |
| bust, waist, hips, shoulder, sleeve_length, dress_length, trouser_length | numeric(5,1), nullable | Unit depends on Question 2 |
| created_by | text → users.id | |
orders
| Field | Type | Notes |
|---|
| id | uuid, primary key | |
| shop_id | uuid → shops.id | |
| customer_id | uuid → customers.id | |
| measurement_id | uuid → measurements.id, nullable | The set of measurements this garment is cut from |
| style_description | text, required | |
| fabric_photo_key | text, nullable | Location of the photo in Object Storage. Served only after an access check |
| fabric_from_customer | boolean | |
| due_date | date, required | Drives "Due this week" |
| price_pesewas | integer | Hidden from apprentice |
| deposit_pesewas | integer, default 0 | Hidden from apprentice |
| balance | calculated, not stored | Price minus deposit, so the two can never disagree |
| status | text: cutting, sewing, ready, collected | |
| assigned_to | uuid → shop_members.id, nullable | Who is sewing it |
| created_at / updated_at | timestamp | |
There is also a sessions table, which Replit Auth's login sessions need.
3. Access rules
All of these rules are enforced in the Express server. The apprentice's phone never receives prices, deposits, balances or phone numbers, so hiding them is not left to the screen.
| Who | Can see | Can change |
|---|
| Owner | Everything in her shop | Everything: customers, measurements, orders, photos, statuses, assignments, and who has access |
| Apprentice | Only orders assigned to her: style, fabric photo, fabric-from-customer, due date, status, the linked measurements, and the customer's name only. No price, deposit, balance, phone, area or notes. | Only the status of her own orders, and only to sewing or ready. She cannot add, edit or delete customers, measurements or orders. |
| Signed in, but not on the allowed list | Nothing (a "No access" screen) | Nothing |
| Signed out | The sign-in screen only. Every private page redirects there. | Nothing |
| Demo shop | Only the demo account sees it. It is fully separate from your real shop. | Demo account only |
Where your description left the rule open, I chose the stricter option:
- The apprentice cannot see the customer's area or notes.
- She cannot set an order to
cutting or collected. - She sees only the measurements linked to her order, not the customer's full measurement history.
4. Build steps
- Database tables. Create the tables above in Replit PostgreSQL.
Test: the app still opens and works exactly as today, still using browser storage. - Sign-in and sign-out. Add Replit Auth, the sign-in screen, the sign-out button, the redirect for signed-out visitors, and the "No access" screen. Create your owner account and shop.
Test: sign in, sign out, then open the "Due this week" link while signed out (it should go to sign-in). Sign in with a second email that isn't on the list (it should show "No access"). - Demo account. Move the 5 sample customers, and any sample orders, into the Demo Shop under a separate demo login.
Test: the demo login shows all the sample screens full. Your real account starts empty. - Customers screen. Connect it to the database.
Test: add a customer, clear your browser, sign in again, and check the customer is still there. - Measurements. Save each set of measurements with its date and show the history.
Test: add two sets on different dates and check both appear, newest first. - Orders and fabric photos. Connect create, edit and status changes, and photo upload.
Test: create an order with a photo, check the balance shows correctly, then reload on another device and check it all appears. - "Due this week" screen. Connect it to the database.
Test: it shows the same orders and same layout as today's screen would. - Apprentice access. Add a screen where you enter her email and assign orders to her.
Test: on her phone she sees only her orders, with no money and no phone numbers. Changing an order to ready works. I'll also show you a direct server request for a price or a customer list from her account being refused. - Rescue what's still on your phone. Add a one-time "Import from this phone" button that copies anything left in browser storage into your real shop. Assumption: you want this. Skip it if your phone's storage is already empty.
Test: the imported orders appear on a second device.
5. Questions
- Deposits: is a deposit always a single payment, or do customers sometimes pay in several instalments? If they pay in instalments, I'll add a
payments table so each payment has its own date and amount, instead of the single deposit field. - Measurement unit: do you measure in inches or centimetres? Is it always the same unit, or does it vary by customer?
- "Who is sewing it": is that always you or your apprentice, both with accounts? Or do you sometimes give work to someone who won't sign in? If so,
assigned_to needs to allow a plain name as well.
I'll wait for your go, and your answers, before building anything.