Freelance & client workOwnerSep 2025 – Dec 2025

Red Wings Travels: online visa-application platform

TL;DR

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

8 chapter(s) collapsed in quick read

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_availability resolution 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

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)

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

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.


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.


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

Want to discuss this project?

Happy to walk through the architecture, trade-offs or the code.

Email me about it

© 2026 Thuyavan Sivarasa. Script code is MIT licensed.