Skip to main content

Project Structure

Directory Tree

client-hub/
├── src/
│ ├── pages/ # Route-level components
│ │ ├── Auth.tsx # Login, signup, password recovery
│ │ ├── Index.tsx # Role-based routing entry point
│ │ ├── admin/ # Admin panel pages (internal team)
│ │ │ ├── AdminDashboard.tsx
│ │ │ ├── AdminClients.tsx
│ │ │ ├── AdminUsers.tsx
│ │ │ ├── AdminFirms.tsx
│ │ │ ├── FirmDetailPage.tsx
│ │ │ ├── AdminAttorneys.tsx
│ │ │ ├── AttorneyDetailPage.tsx
│ │ │ ├── SalesDashboard.tsx # Internal sales KPIs + activity feed
│ │ │ ├── SalesContacts.tsx # Prospect CRM
│ │ │ ├── SalesCallLog.tsx # Sales call logging + AI summaries
│ │ │ └── SalesScheduling.tsx # Calendar OAuth, availability, booking links
│ │ └── workspace/ # Client workspace pages
│ │ ├── WorkspaceDashboard.tsx
│ │ ├── WorkspaceCampaigns.tsx
│ │ ├── WorkspaceCampaignView.tsx
│ │ ├── WorkspaceContacts.tsx
│ │ ├── WorkspaceMeetings.tsx
│ │ ├── WorkspaceCallLog.tsx
│ │ ├── WorkspaceMarkets.tsx
│ │ ├── WorkspaceMarketDetail.tsx
│ │ ├── WorkspaceScheduling.tsx
│ │ └── WorkspaceAccountProfile.tsx
│ │
│ ├── components/
│ │ ├── ui/ # shadcn/ui primitives (49 components)
│ │ │ ├── button.tsx
│ │ │ ├── card.tsx
│ │ │ ├── dialog.tsx
│ │ │ ├── data-table.tsx
│ │ │ ├── input.tsx
│ │ │ ├── select.tsx
│ │ │ ├── table.tsx
│ │ │ ├── tabs.tsx
│ │ │ ├── toast.tsx
│ │ │ └── ... (49 total)
│ │ ├── layout/ # App shell components
│ │ │ ├── AppLayout.tsx
│ │ │ ├── Sidebar.tsx
│ │ │ ├── TopBar.tsx
│ │ │ └── GlobalSearch.tsx
│ │ ├── guards/ # Route protection
│ │ │ ├── ProtectedRoute.tsx
│ │ │ └── RoleGuard.tsx
│ │ ├── shared/ # Reusable cross-feature components
│ │ │ ├── DataTable.tsx
│ │ │ ├── StatCard.tsx
│ │ │ └── EmptyState.tsx
│ │ ├── sales/ # Internal sales CRM components
│ │ │ ├── SalesKPIs.tsx
│ │ │ ├── SalesActivityFeed.tsx
│ │ │ ├── SalesNeedsAttention.tsx
│ │ │ ├── AddProspectDialog.tsx
│ │ │ ├── ProspectDetailDrawer.tsx
│ │ │ ├── LogSalesCallDialog.tsx
│ │ │ ├── SalesCallDetailDrawer.tsx
│ │ │ ├── SummarizeCallButton.tsx
│ │ │ ├── PasteTranscriptDialog.tsx
│ │ │ ├── SalesCalendarCard.tsx
│ │ │ ├── SalesAvailabilitySettings.tsx
│ │ │ └── SalesBookingLinks.tsx
│ │ ├── campaigns/ # Campaign-specific components
│ │ ├── contacts/ # Contact-specific components
│ │ ├── meetings/ # Meeting management components
│ │ └── dashboard/ # Dashboard widgets
│ │
│ ├── hooks/ # Custom React hooks (18 hooks)
│ │ ├── useAuth.tsx # Auth context + hook
│ │ ├── use-toast.ts # Toast notification hook
│ │ ├── use-mobile.tsx # Mobile breakpoint detection
│ │ ├── useAttorneys.ts # Attorney data queries
│ │ ├── useCampaigns.ts # Campaign data queries
│ │ ├── useDebounce.ts # Debounced value hook
│ │ ├── useEnrichedSalesData.ts # Enriched sales join queries
│ │ ├── useGHLImport.ts # GHL import batch operations
│ │ ├── useGHLIntegrations.ts # GHL integration CRUD
│ │ ├── useMobile.ts # Alternative mobile hook
│ │ ├── usePhoneNumberPerformance.ts # Phone number analytics
│ │ ├── useReportingData.ts # Reporting aggregation queries
│ │ ├── useSalesCalls.ts # Sales call CRUD
│ │ ├── useSalesCompanies.ts # Sales company queries
│ │ ├── useSalesMeetings.ts # Sales meeting queries
│ │ ├── useSalesProspects.ts # Sales prospect CRUD
│ │ ├── useSalesStats.ts # Sales KPI aggregation
│ │ └── useSavedFilters.ts # Saved filter state
│ │
│ ├── integrations/
│ │ └── supabase/
│ │ ├── client.ts # Supabase client initialization
│ │ └── types.ts # TypeScript types (manually maintained)
│ │
│ ├── lib/ # Utility modules
│ │ ├── utils.ts # cn() helper, general utilities
│ │ ├── signal-utils.ts # Signal processing helpers
│ │ ├── sales-types.ts # Sales table TypeScript types
│ │ └── attorney-utils.ts # Attorney interface + helpers
│ │
│ ├── contexts/ # React context providers
│ │
│ ├── App.tsx # Router configuration (all routes)
│ └── main.tsx # React entry point

├── supabase/
│ ├── config.toml # Edge function config (verify_jwt settings)
│ ├── migrations/ # 108 SQL migration files
│ └── functions/ # 39 Deno edge functions
│ ├── google-calendar-callback/
│ ├── outlook-calendar-callback/
│ ├── get-calendar-availability/
│ ├── create-calendar-event/
│ ├── send-booking-notification/
│ ├── ghl-call-webhook/
│ ├── ghl-sales-webhook/
│ ├── sync-prospects-to-ghl/
│ ├── summarize-sales-call/
│ ├── blitz-enrich-attorney-contacts/
│ └── ... (39 total)

├── scripts/ # CLI scripts (Node/tsx)
│ ├── enrich-attorneys.ts # Main enrichment pipeline
│ ├── detect-profile-patterns.ts # Firm URL pattern detection
│ └── dump-record.ts # DB record inspector

├── public/ # Static assets
├── netlify.toml # Netlify deployment config
├── vite.config.ts # Vite build configuration
├── tailwind.config.ts # Tailwind CSS config
├── tsconfig.json # TypeScript config
└── package.json # Dependencies + scripts

Route Map

Admin Routes (/admin/*)

Accessible to admin and bdr roles.

RoutePage ComponentDescription
/adminAdminDashboardOverview dashboard with client stats
/admin/clientsAdminClientsClient list and management
/admin/usersAdminUsersUser management (admin only)
/admin/firmsAdminFirmsLaw firm database (200 AmLaw firms)
/admin/firms/:idFirmDetailPageIndividual firm detail + attorneys
/admin/attorneysAdminAttorneysAttorney database with search/filter
/admin/attorneys/:idAttorneyDetailPageIndividual attorney enrichment detail
/admin/salesSalesDashboardSales KPIs, activity feed, needs attention
/admin/sales/contactsSalesContactsProspect CRM with pipeline stages
/admin/sales/callsSalesCallLogSales call log with AI summaries
/admin/sales/schedulingSalesSchedulingCalendar connections, availability, booking links

Workspace Routes (/workspace/*)

Accessible to client role. All data scoped to the user's client_id.

RoutePage ComponentDescription
/workspace/:clientIdWorkspaceDashboardClient dashboard with key metrics
/workspace/:clientId/campaignsWorkspaceCampaignsCampaign list
/workspace/:clientId/campaigns/:idWorkspaceCampaignViewCampaign detail with contacts, calls, signals
/workspace/:clientId/contactsWorkspaceContactsContact directory
/workspace/:clientId/meetingsWorkspaceMeetingsMeeting calendar and list
/workspace/:clientId/call-logWorkspaceCallLogCall history with transcripts
/workspace/:clientId/marketsWorkspaceMarketsMarket intelligence overview
/workspace/:clientId/markets/:idWorkspaceMarketDetailMarket detail with signals
/workspace/:clientId/schedulingWorkspaceSchedulingCalendar + booking link management
/workspace/:clientId/accountWorkspaceAccountProfileProfile and notification settings

Public Routes

RoutePage ComponentDescription
/authAuthLogin, signup, password recovery
/book/:slugBookingPagePublic booking page (no auth required)
/calendar/callbackCalendarCallbackOAuth callback (Google/Outlook)

Key Files

Configuration

FilePurpose
vite.config.tsVite build config, path aliases (@/ maps to src/)
tailwind.config.tsTailwind theme, custom colors, animation config
tsconfig.jsonTypeScript strict mode, path aliases
netlify.tomlBuild command, publish dir, SPA redirects
supabase/config.tomlEdge function JWT verification settings

Type Definitions

FilePurpose
src/integrations/supabase/types.tsSupabase table types (manually maintained, not auto-generated)
src/lib/sales-types.tsSales table types (SalesProspect, SalesCall, SalesMeeting)
src/lib/attorney-utils.tsAttorney interface (76 columns) + helper functions
Manually Maintained Types

The types in src/integrations/supabase/types.ts are not auto-generated by the Supabase CLI. When you add or modify columns in the database, you must manually update this file. The attorneys table was created via the Supabase dashboard and is not in any migration file.