D-Record
Technologies Used
Web Project Info
Gallery

Administrator interface for managing orders and users
D-Record started as a manual order-tracking spreadsheet for a local dairy delivery operation. The first architectural decision was to move the authoritative data model into PostgreSQL with Supabase Row Level Security so that access policies could be declared at the database layer rather than enforced piecemeal in the application.
Each role (customer, rider, admin) has a distinct RLS policy set. Customers can only read and write their own orders. Riders can read orders assigned to them. Admins have unrestricted access. This means even if application-level auth is bypassed, the database rejects unauthorized queries at the connection level.
Order scheduling is handled by a Supabase Edge Function that runs on a cron trigger each morning. It queries all pending orders, groups them by delivery zone, and creates rider assignments. Customers receive push notifications through the Web Push API when their order status changes. Notification payloads are generated server-side and pushed to the browser via a service worker, keeping no persistent WebSocket connection open.
PDF invoice generation uses a server-side PDF library called from an Edge Function. The invoice data is fetched from PostgreSQL, formatted into a PDF buffer, and returned as a binary response. This avoids client-side PDF generation, which is unreliable across mobile browsers.
Key Features
PostgreSQL Row Level Security enforcing data isolation at the database layer
Supabase Edge Function cron for automated morning delivery scheduling
Web Push API notifications via service worker for order status updates
Server-side PDF invoice generation from Edge Function
Multi-role dashboard (Admin, Rider, Customer) with role-specific RLS policies
Real-time order tracking via Supabase real-time subscriptions
User Experience
User Flows
Accessibility
Architectural Implementation
Database-Layer Access Control via RLS
Rather than relying on application-level authorization checks, all access policies are declared as Supabase RLS policies directly on the PostgreSQL tables. auth.uid() is matched against row ownership columns for customer and rider tables. This ensures unauthorized data access is rejected by the database even if application routing is misconfigured.
Server-Side Scheduled Delivery Assignment
A Supabase Edge Function runs on a cron schedule each morning. It queries all pending orders, groups them by delivery zone using a ST_DWithin PostGIS query on customer coordinates, and writes rider assignments back to the orders table. The function also fires push notification payloads to affected customers via the Web Push VAPID protocol.
Outcomes
5,000+ orders processed within the first 1-2 months of deployment
300+ active customers with consistent daily delivery coverage
Full transition from manual spreadsheet tracking to automated scheduling
Performance Benchmarks
Morning cron assignment completes under 2 seconds for 300+ active orders
Real-time order status updates via Supabase subscriptions with sub-500ms latency