Red Wings Travels: online visa-application platform
I delivered this platform single-handedly: a customer app with draft-and-resume wizard and group applications, three payment gateways confirmed by webhooks, and a full admin app on Supabase.
- Period
- Sep 2025 – Dec 2025
- My role
- Solo full-stack delivery
- Technologies
- 6
- Diagrams
- 3
- Reading time
- 8 min
ReactTypeScriptTailwind CSSshadcn / Radix UISupabase / PostgresStripe / PayHere
Executive Summary
The owner single-handedly delivered a production visa-agency platform:
- Customer app (React 18 + Vite + Tailwind / Flowbite):
- country and visa pages, a 5-step application wizard (visa info → personal → additional info → documents → review) and a quick-apply shortcut
- draft save / resume, group applications (multiple persons per application group), secure document upload / re-upload and admin-requested documents
- payments via Stripe Checkout (single and group sessions), PayHere and PayPal, all confirmed by webhooks
- a dashboard with application cards and details, downloadable visa results
- legal pages, SEO (
react-helmet-async), analytics (GA4 + PostHog) and Cloudflare Turnstile bot protection - Admin app (React + shadcn/Radix + react-hook-form + Zod + Zustand):
- dashboard and analytics, applications list and detail (status changes with history, notes, document requests, result upload), payments, users / staff invites and roles
- visa management, nationality countries, a zone-based pricing / eligibility / geo-restriction manager, payment-gateway settings, notification settings, session-timeout handling
- Back end (Supabase):
- 45-table Postgres schema with RLS, SQL functions including a
resolve_visa_availabilityresolution engine (zones → pricing rules → eligibility by nationality → geo-restriction by viewer IP), cost calculation for groups, and an audit log - 24 Deno edge functions for pricing, applications, documents (signed URLs), payments and webhooks, the email queue and notifications
- an email queue with notification rate limits
Portfolio Blurb + Resume Bullets
Blurb:
Built Red Wings Travels’ online visa platform end to end: a React customer portal with a multi-step application wizard, quick apply, group applications, secure document handling and Stripe / PayHere / PayPal payments; a React admin console for processing, document requests, results and zone-based pricing; and a Supabase back end (45-table Postgres with RLS, a SQL pricing/eligibility resolution engine, 24 Deno edge functions, webhooks, email queue), deployed on Vercel.
Bullets:
- Designed a zone-based pricing and eligibility engine in Postgres (
visa_zones,visa_zone_members,visa_pricing_rules,visa_eligibility_rules,visa_geo_restrictions,resolve_visa_availability) that resolves price, eligibility by nationality and visibility by viewer IP geolocation, with backward-compatible wrappers (calculate_visa_pricing,calculate_group_costs). - Implemented three payment gateways (Stripe Checkout incl. group sessions, PayHere, PayPal orders / capture) with server-side price validation and webhook-driven payment state (
payment_sessions,payment_transactions,refunds,payment_cost_tracking). - Built secure document management: upload via edge functions (type / size validation, rate limits), signed URLs for viewing, re-upload, admin document requests, visa-result upload and download.
- Built a 5-step application wizard with draft / resume, quick apply, and group applications (
application_groups,application_persons). - Built the admin console (applications workflow with status history and notes, payments, analytics, users / staff invites / roles, zone and pricing management, gateway and notification settings).
- Implemented an email queue + notification system (types, channels, recipient groups, rate limits, queue processor function).
- Hardened the app: RLS (95 policies), Turnstile captcha, session refresh / timeout handling, secure upload architecture, Vercel security headers; documented in security docs.
- Used spec-driven development (GitHub Spec Kit) and AI agents (Cursor, Jules) to plan and implement features.
Business Domain
| Area | Entities |
|---|---|
| Catalogue | visa_countries (12+ destinations: India e-visas, China, UAE, Malaysia, Qatar, Saudi (Umrah / visit), Oman, Bahrain, Vietnam, Thailand, Indonesia, Pakistan), visa_categories, visa_types, nationality_countries |
| Rules | visa_zones, visa_zone_members, visa_pricing_rules (+ _v view), visa_eligibility_rules, visa_geo_restrictions, system_limit_settings |
| Applications | visa_applications, application_groups, application_persons, application_documents, document_types, admin_document_requests, application_status_history, visa_results, cost_calculations |
| Payments | payment_providers, payment_methods, provider_payment_methods, payment_sessions, payment_transactions, payments, refunds, payment_cost_tracking |
| Notifications | notifications, notification_types, notification_channel_config, notification_system_config, notification_rate_limits, email_queue, email_notifications, email_recipients, email_recipient_groups |
| People / security | profiles, roles, staff_roles, staff_invites, audit_logs |
Technology Stack
6.1 Client app
React ^18.2, react-router-dom ^6.20, @supabase/supabase-js ^2.38, @stripe/stripe-js ^7.9 + @stripe/react-stripe-js ^4.0, flowbite ^4 + flowbite-react ^0.12, posthog-js ^1.302, react-ga4 ^2.1, react-helmet-async ^2.0, @marsidev/react-turnstile ^1.3, sonner ^2, date-fns ^4, lucide-react, clsx + tailwind-merge + class-variance-authority, Tailwind, Vite, TypeScript.
6.2 Admin app
React ^18.2, react-router-dom ^6.20, Radix UI (alert-dialog, avatar, checkbox, collapsible, dialog, dropdown-menu, icons, label, popover, scroll-area, select, separator, slot, switch, tabs, tooltip) via shadcn (components.json), react-hook-form ^7.66 + @hookform/resolvers ^5.2 + zod ^4.1, zustand ^5, cmdk ^1.1, sonner, Turnstile, date-fns, lucide-react, tailwindcss-animate.
6.3 Back end
Supabase: Postgres (RLS, SQL functions, triggers, views), Auth (email + Google OAuth), Storage (documents, results), Edge Functions (Deno, deno.json); Node helpers: stripe ^14.9, paypal-rest-sdk ^1.8, nodemailer ^6.9; IP geolocation (ipapi.co) for geo-restrictions; PayHere (hash-signed checkout + notify webhook).
6.4 Tooling
npm workspaces + concurrently; Vercel; Supabase CLI (deploy-payhere.bat, DEPLOY_COMMANDS.md); env per stage (local / staging); Spec Kit; Cursor; Jules.
Architecture
Diagram as text
flowchart LR C([Customer]) --> CA[client-app React on Vercel] S([Staff]) --> AA[admin-app React on Vercel] CA & AA --> SH[@red-wings-travels/shared] CA & AA -->|supabase-js: Auth, RLS queries, Storage| SB[(Supabase Postgres + Auth + Storage)] CA & AA -->|invoke| EF[24 Edge Functions Deno] EF --> SB EF --> STRIPE[(Stripe)] EF --> PH[(PayHere)] EF --> PP[(PayPal)] STRIPE & PH & PP -->|webhooks| EF EF --> MAIL[(Email via queue)] EF --> GEO[(ipapi.co geolocation)] CA --> AN[(GA4 + PostHog)] CA & AA --> TS[(Cloudflare Turnstile)]
Layering: UI pages → React contexts / Zustand stores → services (e.g. zoneManagementService) → Supabase client (direct RLS-guarded reads) or edge functions (privileged writes, payments, file handling). Business rules for pricing and eligibility live in SQL (single source of truth for both apps).
7.1 Visa availability resolution (SQL engine)
Diagram as text
flowchart TD
IN[visa type + nationality + viewer IP] --> Z[resolve zone membership of nationality / viewer country]
Z --> GR{geo-restricted for viewer region?}
GR -- yes --> HIDE[hidden]
GR -- no --> EL{eligibility rule for nationality allows?}
EL -- no --> NE[not eligible + reason]
EL -- yes --> PR[select most specific pricing rule: type × zone → defaults]
PR --> OUT[price breakdown: govt fee, service fee, processing tier, totals]get-visa-pricing, get-visa-types and get-visa-countries call it; calculate_visa_pricing and calculate_group_costs keep old callers working [V doc].
7.2 Payment flow
Diagram as text
sequenceDiagram participant U as Customer participant CA as client-app participant EF as Edge Functions participant G as Gateway (Stripe / PayHere / PayPal) participant DB as Postgres U->>CA: Review → Pay CA->>EF: calculate-application-costs / validate-pricing CA->>EF: create-stripe-session | create-group-stripe-session | create-payhere-payment | create-paypal-order EF->>DB: payment_sessions (pending, server-computed amount) EF-->>CA: checkout URL / params CA->>G: redirect / SDK G-->>EF: stripe-webhook | payhere-webhook (hash verify) | paypal-webhook / capture-paypal-order EF->>DB: payment_transactions, payments, application status → paid, status history EF->>DB: email_queue (receipt / status mail) G-->>CA: success / cancel page
7.3 Document flow
upload-document / upload-person-document / upload-requested-document (validate type, size and limits from system_limit_settings; store to private buckets; insert application_documents) → get-document-url (short-lived signed URL) → reupload-document / delete-document; staff upload-visa-result → get-visa-result-url for the customer.
Edge Functions (24)
| Function | LOC | Purpose |
|---|---|---|
| calculate-application-costs | — | Cost breakdown |
| validate-pricing | 121 | Re-validate client-side price server-side |
| get-visa-countries | 205 | Countries with geo-restrictions |
| get-visa-types | 244 | Types with eligibility filter |
| get-visa-pricing | 219 | Resolution engine + IP geolocation |
| create-quick-application | 410 | Quick apply |
| submit-group-application | 255 | Group submission |
| delete-draft-application | 242 | Draft cleanup |
| create-stripe-session | 140 | Single checkout |
| create-group-stripe-session | 344 | Group checkout |
| create-group-payment-intent | — | Group PaymentIntent |
| create-payhere-payment | 358 | PayHere checkout with hash |
| create-paypal-order / capture-paypal-order | 536 / — | PayPal |
| stripe-webhook / payhere-webhook / paypal-webhook | 217 / 456 / 572 | Payment confirmation |
| upload-document / upload-person-document / upload-requested-document | 253 / 271 / 393 | Uploads |
| reupload-document / delete-document | 201 / 118 | Doc lifecycle |
| get-document-url / get-visa-result-url | 196 / 188 | Signed URLs |
| upload-visa-result | 250 | Staff result upload |
| send-notification | 153 | Notification dispatch |
| process-email-queue | 591 | Queue worker with rate limits |
functions-old/ keeps the first versions (stripe session, countries, types, notification, webhook). |
Screens
Client (23): Home, Services, Visa detail, About, Contact, Login, Signup, Dashboard (application cards), Application details, Payment gateway, Payment success / cancel, Privacy, Refund, Terms, Visa application wizard (Step 1 Visa info, Step 2 Personal, Step 3 Additional info, Step 4 Documents / Enhanced documents, Step 5 Review, Confirmation). Admin (16): Login, Dashboard, Analytics, Applications, Application detail, Payments, Users, Visa management, Nationality countries, Zone management (+ old), Pricing rules (+ old), Payment gateway settings, Notification settings, Settings.
Features (complete)
Visa catalogue with requirements / processing times · multi-step wizard with validation · drafts and resume · quick apply · group applications · per-person documents · applicant remarks on uploads · admin document requests → customer upload · status history · visa result upload / download · Stripe / PayHere / PayPal with webhooks · server price validation · refunds and cost tracking · email queue + notifications (client + admin) · notification rate limits · upload rate limits and file-size toasts · pagination · Turnstile captcha · Google OAuth + email auth · session refresh / timeout handling · zone-based pricing / eligibility / geo-restrictions with admin UI · staff invites and roles · audit logs · analytics (GA4, PostHog; adblock-tolerant) · SEO meta · mobile-responsive UI · legal pages.
Security
RLS on all tables (95 policies); privileged operations only in edge functions (service role); private storage + signed URLs; webhook signature / hash verification (Stripe signature, PayHere MD5 hash, PayPal verification); server-side price recomputation (prevents tampering); Turnstile; rate limits (uploads, notifications); session timeout; Vercel security headers (doc). Secrets in env / Supabase secrets «redacted».
Data & Migrations
20 migrations (incl. 20251124000001_zone_based_pricing_eligibility_system.sql), database-fix/ scripts (e.g. add_country_name_to_zone_members.sql with trigger + admin_zone_members_view, update_calculate_visa_pricing_for_zones.sql), full schema snapshots v35 / v36.
UI / UX
Client: Tailwind + Flowbite components, country flag images, toasts (Sonner), mobile-optimised upload UX. Admin: shadcn / Radix design system, command palette (cmdk), side menu, data tables with pagination, forms with Zod validation.
Testing
test/ folder, TESTING_STATUS.md, QUICK_TESTING_CHECKLIST.md, Stripe function test script (backend/test-stripe-functions.js), PayHere sandbox setup doc; mostly manual / UAT.
Metrics
| Item | Value |
|---|---|
| Client / admin / shared LOC | 32,385 / 24,902 / 1,437 |
| Edge functions | 24 (~8k LOC) |
| DB tables / RLS policies / migrations | 45 / 95 / 20 |
| Screens | 23 client + 16 admin |
| Commits | 103 in ~3 months |
| Docs | ~60 |
New / Notable Skills
Supabase (RLS, edge functions on Deno, storage, auth), SQL rule engines, multi-gateway payments and webhooks (incl. a regional gateway, PayHere), document security, monorepo workspaces, shadcn / Radix, Zod 4, PostHog / GA4 analytics, Turnstile, spec-driven AI development (Spec Kit).
Challenges & Solutions
| Challenge | Solution |
|---|---|
| Visa cost always showing wrong / zero | Pricing functions → zone resolution engine |
| File upload failures from the browser | Moved uploads to edge functions |
| Admin / client session loss after minutes | Session refresh + timeout handling |
| PayHere email column / sandbox issues | Schema fix + sandbox setup docs |
| Price tampering risk | Server-side validate-pricing |
| PostHog errors under adblock | Reduced / guarded |
| Geo-specific visibility | Geo-restriction rules + ipapi lookup |
Related projects
Munz Cake: e-commerce, baking academy and cake configurator
A Medusa v2 headless shop with a custom LMS module for baking courses, and a 2026 Next.js 16 cake catalogue and configurator.
Medusa commerceNext.jsReactTypeScript+3Logo Color Previewer: colour variations with a WCAG contrast check
A Next.js 16 tool that applies 100+ palettes to a logo, checks WCAG contrast live and exports favourite variations as a ZIP in the browser.
Next.jsReactTypeScriptTailwind CSSAI and LLM experiments
Experiments with LLM APIs: a Flask chat over several providers, speech-to-text and model tests, and a React and shadcn debugging sandbox.
PythonFastAPI / FlaskLLM integrationReact+1Want to discuss this project?
Happy to walk through the architecture, trade-offs or the code.