Public Access
1
0

chore: reorganize frontend into app and admin roots

This commit is contained in:
pguerrerox
2026-05-30 00:45:06 +00:00
parent d71f2f1f8a
commit a926d06b54
39 changed files with 76 additions and 49 deletions
+19
View File
@@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
## [2026-05-28]
### Added
- Added a dedicated admin web entrypoint and build target so admin operations can run on a separate frontend surface from the user app.
- Added an Admin Console Phase C support diagnostics surface and a constrained billing resync mutation pilot with explicit operational guardrails.
- Added admin-operations repository and route support for workspace diagnostics, timeline visibility, and webhook/event troubleshooting.
- Added migration `0009_admin_ops_indexes.sql` to improve query performance for admin operations diagnostics.
### Changed
- Split user and admin UI concerns so the main app no longer renders admin navigation, and admin workflows now live on a dedicated admin portal surface.
- Updated Docker/Compose deployment wiring to build and serve separate user-web and admin-web containers, each with its own nginx config and host port.
- Expanded admin auth checks, route payloads, and shared types to support richer support operations and workspace-level billing diagnostics.
- Updated setup and runbook documentation for the dedicated admin surface and Phase C operational workflows.
## [2026-05-27]
### Fixed
- Fixed missing API container environment wiring in Compose by passing `ADMIN_EMAILS`, `BILLING_ADMIN_EMAILS`, `ALLOW_ADMIN_BOOTSTRAP`, and `ADMIN_BOOTSTRAP_TOKEN` through to the API service.
## [2026-05-25] ## [2026-05-25]
### Added ### Added
View File
@@ -1,17 +1,17 @@
import { ShieldAlert, ShieldCheck } from 'lucide-react'; import { ShieldAlert, ShieldCheck } from 'lucide-react';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
import type { AdminBootstrapStatusResponse, SessionUser } from '../shared/types'; import type { AdminBootstrapStatusResponse, SessionUser } from '@/shared/types';
import { AdminPage } from './components/AdminPage'; import { AdminPage } from './components/AdminPage';
import { Alert, Button, Card, FieldLabel, Input } from './components/ui'; import { Alert, Button, Card, FieldLabel, Input } from '@/app/src/components/ui';
import { import {
claimAdminBootstrap, claimAdminBootstrap,
getAdminBootstrapStatus, getAdminBootstrapStatus,
getLocalSessionUser, getLocalSessionUser,
signInWithLocalAuth, signInWithLocalAuth,
signOutWithLocalAuth, signOutWithLocalAuth,
} from './lib/auth'; } from '@/app/src/lib/auth';
import { hasApiConfig } from './lib/api'; import { hasApiConfig } from '@/app/src/lib/api';
export function AdminPortal() { export function AdminPortal() {
const [user, setUser] = useState<SessionUser | null>(null); const [user, setUser] = useState<SessionUser | null>(null);
@@ -1,7 +1,7 @@
import { StrictMode } from 'react'; import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client'; import { createRoot } from 'react-dom/client';
import { AdminPortal } from './AdminPortal'; import { AdminPortal } from './AdminPortal';
import './index.css'; import '@/app/src/index.css';
createRoot(document.getElementById('root')!).render( createRoot(document.getElementById('root')!).render(
<StrictMode> <StrictMode>
@@ -9,8 +9,8 @@ import type {
ApplicationAdminSummary, ApplicationAdminSummary,
BillingAdminWorkspaceDetail, BillingAdminWorkspaceDetail,
BillingAdminWorkspaceSummary, BillingAdminWorkspaceSummary,
} from '../../shared/types'; } from '@/shared/types';
import { formatBillingStatusLabel, formatDateLabel } from '../lib/billing-ui'; import { formatBillingStatusLabel, formatDateLabel } from '@/app/src/lib/billing-ui';
import { import {
getAdminAnalyticsSummary, getAdminAnalyticsSummary,
getAdminBillingWorkspaceDetail, getAdminBillingWorkspaceDetail,
@@ -23,7 +23,7 @@ import {
updateApplicationAdminStatus, updateApplicationAdminStatus,
upsertApplicationAdmin, upsertApplicationAdmin,
} from '../lib/admin'; } from '../lib/admin';
import { Alert, Badge, Button, Card, FieldLabel, Input, LoadingState, PageContainer, PageShell, SectionHeader, Select } from './ui'; import { Alert, Badge, Button, Card, FieldLabel, Input, LoadingState, PageContainer, PageShell, SectionHeader, Select } from '@/app/src/components/ui';
const MIN_SUMMARY_DAYS = 7; const MIN_SUMMARY_DAYS = 7;
const MAX_SUMMARY_DAYS = 90; const MAX_SUMMARY_DAYS = 90;
+2 -2
View File
@@ -11,8 +11,8 @@ import type {
ApplicationAdminStatus, ApplicationAdminStatus,
BillingAdminWorkspaceDetailResponse, BillingAdminWorkspaceDetailResponse,
BillingAdminWorkspaceListResponse, BillingAdminWorkspaceListResponse,
} from '../../shared/types'; } from '@/shared/types';
import { apiRequest } from './api'; import { apiRequest } from '@/app/src/lib/api';
export async function getAdminAnalyticsSummary(days = 30) { export async function getAdminAnalyticsSummary(days = 30) {
const params = new URLSearchParams({ days: String(days) }); const params = new URLSearchParams({ days: String(days) });
@@ -4,22 +4,22 @@ import path from 'path';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
export default defineConfig({ export default defineConfig({
root: path.resolve(__dirname),
envDir: path.resolve(__dirname, '..'),
plugins: [react(), tailwindcss()], plugins: [react(), tailwindcss()],
resolve: { resolve: {
alias: { alias: {
'@': path.resolve(__dirname, '.'), '@': path.resolve(__dirname, '..'),
}, },
}, },
server: { server: {
allowedHosts: ['project-1.duramente.com'], allowedHosts: ['project-1.duramente.com'],
hmr: process.env.DISABLE_HMR !== 'true', hmr: process.env.DISABLE_HMR !== 'true',
port: 3001, port: 3001,
strictPort: true,
host: '0.0.0.0', host: '0.0.0.0',
}, },
build: { build: {
outDir: 'dist-admin', outDir: '../dist-admin',
rollupOptions: {
input: 'admin.html',
},
}, },
}); });
View File
+2 -2
View File
@@ -24,8 +24,8 @@ import { PricingComparisonTable } from './components/PricingComparisonTable';
import { ResearchWorkspace } from './components/ResearchWorkspace'; import { ResearchWorkspace } from './components/ResearchWorkspace';
import { ResultsWorkspace } from './components/ResultsWorkspace'; import { ResultsWorkspace } from './components/ResultsWorkspace';
import { Alert, Badge, Button, Card, FieldLabel, Input, Surface } from './components/ui'; import { Alert, Badge, Button, Card, FieldLabel, Input, Surface } from './components/ui';
import type { BillingInterval, PlanCode } from '../shared/billing/plans'; import type { BillingInterval, PlanCode } from '@/shared/billing/plans';
import type { AdminBootstrapStatusResponse, SessionUser } from '../shared/types'; import type { AdminBootstrapStatusResponse, SessionUser } from '@/shared/types';
import { import {
claimAdminBootstrap, claimAdminBootstrap,
getAdminBootstrapStatus, getAdminBootstrapStatus,
@@ -1,9 +1,9 @@
import { AlertCircle, ArrowUpRight, Building2, CreditCard, Loader2, Shield, Users } from 'lucide-react'; import { AlertCircle, ArrowUpRight, Building2, CreditCard, Loader2, Shield, Users } from 'lucide-react';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { getEligibleAddonsForPlan } from '../../shared/billing/addons'; import { getEligibleAddonsForPlan } from '@/shared/billing/addons';
import { formatLifecycleDate } from '../../shared/billing/lifecycle'; import { formatLifecycleDate } from '@/shared/billing/lifecycle';
import { getPlanByCode, getPublicPricingPlans, type PlanCode } from '../../shared/billing/plans'; import { getPlanByCode, getPublicPricingPlans, type PlanCode } from '@/shared/billing/plans';
import type { AccountPageData, AppUser } from '../../shared/types'; import type { AccountPageData, AppUser } from '@/shared/types';
import { import {
createAddonCheckout, createAddonCheckout,
createBillingPortalSession, createBillingPortalSession,
@@ -13,7 +13,7 @@ import {
} from 'lucide-react'; } from 'lucide-react';
import { listSearchJobs } from '../lib/database'; import { listSearchJobs } from '../lib/database';
import type { SearchJob, SearchJobStatus } from '../types'; import type { SearchJob, SearchJobStatus } from '../types';
import type { AppUser } from '../../shared/types'; import type { AppUser } from '@/shared/types';
import { Alert, Badge, Button, Card, EmptyState, LoadingState, MetricPill, SectionHeader, Select, Input } from './ui'; import { Alert, Badge, Button, Card, EmptyState, LoadingState, MetricPill, SectionHeader, Select, Input } from './ui';
interface BasicResultsViewProps { interface BasicResultsViewProps {
@@ -13,7 +13,7 @@ import {
} from 'lucide-react'; } from 'lucide-react';
import { listBusinesses, listJobResultLinks, listSearchJobs, type SearchJobResultLink } from '../lib/database'; import { listBusinesses, listJobResultLinks, listSearchJobs, type SearchJobResultLink } from '../lib/database';
import type { Business, SearchJob } from '../types'; import type { Business, SearchJob } from '../types';
import type { AppUser } from '../../shared/types'; import type { AppUser } from '@/shared/types';
import { cn } from '../lib/cn'; import { cn } from '../lib/cn';
import { Alert, Badge, Button, Card, EmptyState, Input, LoadingState, PageContainer, PageShell, SectionHeader, Select, StatCard } from './ui'; import { Alert, Badge, Button, Card, EmptyState, Input, LoadingState, PageContainer, PageShell, SectionHeader, Select, StatCard } from './ui';
@@ -1,6 +1,6 @@
import React, { useEffect, useMemo } from 'react'; import React, { useEffect, useMemo } from 'react';
import { Map, Marker, useMap } from '@vis.gl/react-google-maps'; import { Map, Marker, useMap } from '@vis.gl/react-google-maps';
import type { DeepResearchPreview } from '../../shared/types'; import type { DeepResearchPreview } from '@/shared/types';
import { cleanMapOptions } from '../lib/map-styles'; import { cleanMapOptions } from '../lib/map-styles';
interface DeepResearchPreviewMapProps { interface DeepResearchPreviewMapProps {
@@ -1,5 +1,5 @@
import React, { useCallback, useEffect, useState } from 'react'; import React, { useCallback, useEffect, useState } from 'react';
import type { DeepResearchBatchSummary } from '../../shared/types'; import type { DeepResearchBatchSummary } from '@/shared/types';
import { getDeepResearchBatch, listDeepResearchBatches } from '../lib/database'; import { getDeepResearchBatch, listDeepResearchBatches } from '../lib/database';
import { Alert, Badge, Button, EmptyState, LoadingState, MetricPill, SectionHeader, Surface } from './ui'; import { Alert, Badge, Button, EmptyState, LoadingState, MetricPill, SectionHeader, Surface } from './ui';
@@ -1,6 +1,6 @@
import React, { useEffect, useMemo, useState } from 'react'; import React, { useEffect, useMemo, useState } from 'react';
import { Crosshair, Loader2, MapPinned, Sparkles } from 'lucide-react'; import { Crosshair, Loader2, MapPinned, Sparkles } from 'lucide-react';
import type { DeepResearchPreview } from '../../shared/types'; import type { DeepResearchPreview } from '@/shared/types';
import { createDeepResearchBatch, previewDeepResearch } from '../lib/database'; import { createDeepResearchBatch, previewDeepResearch } from '../lib/database';
import { DeepResearchPreviewMap } from './DeepResearchPreviewMap'; import { DeepResearchPreviewMap } from './DeepResearchPreviewMap';
import { Alert, Badge, Button, FieldLabel, Input, MetricPill, PageContainer, PageShell, SectionHeader, Surface } from './ui'; import { Alert, Badge, Button, FieldLabel, Input, MetricPill, PageContainer, PageShell, SectionHeader, Surface } from './ui';
@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { Search, LayoutDashboard, Map as MapIcon, LogOut, Briefcase, Files, UserRound } from 'lucide-react'; import { Search, LayoutDashboard, Map as MapIcon, LogOut, Briefcase, Files, UserRound } from 'lucide-react';
import type { SessionUser } from '../../shared/types'; import type { SessionUser } from '@/shared/types';
import { getUserAvatarUrl, getUserDisplayName } from '../lib/auth'; import { getUserAvatarUrl, getUserDisplayName } from '../lib/auth';
import { cn } from '../lib/cn'; import { cn } from '../lib/cn';
import { Button } from './ui'; import { Button } from './ui';
@@ -4,7 +4,7 @@ import { Globe, Loader2, MapPin, Navigation, Phone, Star } from 'lucide-react';
import { listBusinesses, listBusinessesForJobs } from '../lib/database'; import { listBusinesses, listBusinessesForJobs } from '../lib/database';
import { cleanMapOptions } from '../lib/map-styles'; import { cleanMapOptions } from '../lib/map-styles';
import type { Business } from '../types'; import type { Business } from '../types';
import type { AppUser } from '../../shared/types'; import type { AppUser } from '@/shared/types';
import { Alert, Badge, EmptyState } from './ui'; import { Alert, Badge, EmptyState } from './ui';
interface MapViewProps { interface MapViewProps {
@@ -1,5 +1,5 @@
import { Check } from 'lucide-react'; import { Check } from 'lucide-react';
import { getPlanCardBullets, getPlanDisplayMeta, getPublicPricingPlansForInterval, type BillingInterval, type PlanCode } from '../../shared/billing/plans'; import { getPlanCardBullets, getPlanDisplayMeta, getPublicPricingPlansForInterval, type BillingInterval, type PlanCode } from '@/shared/billing/plans';
import { Button } from './ui'; import { Button } from './ui';
import { formatPlanPeriod, formatPlanPrice } from '../lib/billing-ui'; import { formatPlanPeriod, formatPlanPrice } from '../lib/billing-ui';
import { sendAnalyticsEvent } from '../lib/analytics'; import { sendAnalyticsEvent } from '../lib/analytics';
@@ -1,6 +1,6 @@
import { Check, Minus } from 'lucide-react'; import { Check, Minus } from 'lucide-react';
import { getFeatureGate } from '../../shared/billing/feature-gates'; import { getFeatureGate } from '@/shared/billing/feature-gates';
import { getPlanByCode, getPublicPricingPlansForInterval, type ActivePlanCode, type BillingInterval, type PlanFeatures } from '../../shared/billing/plans'; import { getPlanByCode, getPublicPricingPlansForInterval, type ActivePlanCode, type BillingInterval, type PlanFeatures } from '@/shared/billing/plans';
import { Card, Badge } from './ui'; import { Card, Badge } from './ui';
import { formatQuantity } from '../lib/billing-ui'; import { formatQuantity } from '../lib/billing-ui';
@@ -1,6 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { MapPinned, Search } from 'lucide-react'; import { MapPinned, Search } from 'lucide-react';
import type { AppUser } from '../../shared/types'; import type { AppUser } from '@/shared/types';
import { DeepResearchView } from './DeepResearchView'; import { DeepResearchView } from './DeepResearchView';
import { SearchSetup } from './SearchSetup'; import { SearchSetup } from './SearchSetup';
import { SegmentedTabs } from './ui'; import { SegmentedTabs } from './ui';
@@ -1,6 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Files, MapPinned } from 'lucide-react'; import { Files, MapPinned } from 'lucide-react';
import type { AppUser } from '../../shared/types'; import type { AppUser } from '@/shared/types';
import { BasicResultsView } from './BasicResultsView'; import { BasicResultsView } from './BasicResultsView';
import { DeepResearchResultsView } from './DeepResearchResultsView'; import { DeepResearchResultsView } from './DeepResearchResultsView';
import { PageContainer, PageShell, SectionHeader, SegmentedTabs } from './ui'; import { PageContainer, PageShell, SectionHeader, SegmentedTabs } from './ui';
@@ -1,7 +1,7 @@
import React, { useCallback, useState } from 'react'; import React, { useCallback, useState } from 'react';
import { AlertCircle, LocateFixed, Loader2, MapPin, Play } from 'lucide-react'; import { AlertCircle, LocateFixed, Loader2, MapPin, Play } from 'lucide-react';
import { runSearch } from '../lib/database'; import { runSearch } from '../lib/database';
import type { AppUser } from '../../shared/types'; import type { AppUser } from '@/shared/types';
import { BasicResearchMap } from './BasicResearchMap'; import { BasicResearchMap } from './BasicResearchMap';
import { Alert, Button, FieldLabel, Input, PageContainer, PageShell, SectionHeader, Surface } from './ui'; import { Alert, Button, FieldLabel, Input, PageContainer, PageShell, SectionHeader, Surface } from './ui';
View File
@@ -4,7 +4,7 @@ import type {
BillingDebugData, BillingDebugData,
BillingPortalSessionResponse, BillingPortalSessionResponse,
UpdateAccountProfileRequest, UpdateAccountProfileRequest,
} from '../../shared/types'; } from '@/shared/types';
import { apiRequest } from './api'; import { apiRequest } from './api';
export async function getAccountPageData() { export async function getAccountPageData() {
@@ -1,4 +1,4 @@
import type { AnalyticsEventInput } from '../../shared/analytics/events'; import type { AnalyticsEventInput } from '@/shared/analytics/events';
import { apiRequest } from './api'; import { apiRequest } from './api';
export function sendAnalyticsEvent(event: Omit<AnalyticsEventInput, 'eventSource'> & { eventSource?: AnalyticsEventInput['eventSource'] }) { export function sendAnalyticsEvent(event: Omit<AnalyticsEventInput, 'eventSource'> & { eventSource?: AnalyticsEventInput['eventSource'] }) {
+1 -1
View File
@@ -4,7 +4,7 @@ import type {
AdminBootstrapStatusResponse, AdminBootstrapStatusResponse,
AppUser, AppUser,
SessionUser, SessionUser,
} from '../../shared/types'; } from '@/shared/types';
import { apiRequest } from './api'; import { apiRequest } from './api';
export function getUserDisplayName(user: AppUser | SessionUser | null): string { export function getUserDisplayName(user: AppUser | SessionUser | null): string {
@@ -1,6 +1,6 @@
import type { ActivePlanCode, BillingInterval, PlanCode } from '../../shared/billing/plans'; import type { ActivePlanCode, BillingInterval, PlanCode } from '@/shared/billing/plans';
import { getPlanByCode, getPlanVariant } from '../../shared/billing/plans'; import { getPlanByCode, getPlanVariant } from '@/shared/billing/plans';
import type { AccountBillingStatus, BillingUsageResourceSummary } from '../../shared/types'; import type { AccountBillingStatus, BillingUsageResourceSummary } from '@/shared/types';
export type UsageWarningState = 'healthy' | 'warning' | 'critical' | 'unavailable'; export type UsageWarningState = 'healthy' | 'warning' | 'critical' | 'unavailable';
View File
@@ -6,7 +6,7 @@ import type {
DeepResearchBatchSummary, DeepResearchBatchSummary,
DeepResearchPreview, DeepResearchPreview,
DeepResearchPreviewRequest, DeepResearchPreviewRequest,
} from '../../shared/types'; } from '@/shared/types';
export type SearchJobResultLink = { export type SearchJobResultLink = {
businessId: string; businessId: string;
View File
View File
View File
+9 -1
View File
@@ -4,14 +4,22 @@ import path from 'path';
import {defineConfig} from 'vite'; import {defineConfig} from 'vite';
export default defineConfig({ export default defineConfig({
root: path.resolve(__dirname),
envDir: path.resolve(__dirname, '..'),
plugins: [react(), tailwindcss()], plugins: [react(), tailwindcss()],
resolve: { resolve: {
alias: { alias: {
'@': path.resolve(__dirname, '.'), '@': path.resolve(__dirname, '..'),
}, },
}, },
server: { server: {
allowedHosts: ['project-1.duramente.com'], allowedHosts: ['project-1.duramente.com'],
hmr: process.env.DISABLE_HMR !== 'true', hmr: process.env.DISABLE_HMR !== 'true',
port: 3000,
strictPort: true,
host: '0.0.0.0',
},
build: {
outDir: '../dist',
}, },
}); });
+6 -6
View File
@@ -4,15 +4,15 @@
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --port=3000 --host=0.0.0.0", "dev": "vite --config app/vite.config.ts",
"dev:web": "vite --port=3000 --host=0.0.0.0", "dev:web": "vite --config app/vite.config.ts",
"dev:admin": "vite --config vite.admin.config.ts --port=3001 --host=0.0.0.0", "dev:admin": "vite --config admin/vite.config.ts",
"dev:api": "tsx --tsconfig tsconfig.server.json server/src/index.ts", "dev:api": "tsx --tsconfig tsconfig.server.json server/src/index.ts",
"dev:worker": "tsx --tsconfig tsconfig.server.json server/src/worker.ts", "dev:worker": "tsx --tsconfig tsconfig.server.json server/src/worker.ts",
"build": "vite build", "build": "vite build --config app/vite.config.ts",
"build:admin": "vite build --config vite.admin.config.ts", "build:admin": "vite build --config admin/vite.config.ts",
"build:api": "tsc -p tsconfig.server.json", "build:api": "tsc -p tsconfig.server.json",
"preview": "vite preview", "preview": "vite preview --config app/vite.config.ts",
"clean": "rm -rf dist dist-admin dist-server", "clean": "rm -rf dist dist-admin dist-server",
"lint": "tsc --noEmit && tsc -p tsconfig.server.json --noEmit", "lint": "tsc --noEmit && tsc -p tsconfig.server.json --noEmit",
"migrate": "tsx --tsconfig tsconfig.server.json db/scripts/migrate.ts", "migrate": "tsx --tsconfig tsconfig.server.json db/scripts/migrate.ts",
+1 -1
View File
@@ -23,5 +23,5 @@
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
"noEmit": true "noEmit": true
}, },
"include": ["src", "shared", "vite.config.ts"] "include": ["app/src", "admin/src", "shared", "app/vite.config.ts", "admin/vite.config.ts"]
} }