chore: reorganize frontend into app and admin roots
This commit is contained in:
@@ -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/).
|
||||
|
||||
## [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]
|
||||
|
||||
### Added
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { ShieldAlert, ShieldCheck } from 'lucide-react';
|
||||
import { useEffect, useState } 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 { Alert, Button, Card, FieldLabel, Input } from './components/ui';
|
||||
import { Alert, Button, Card, FieldLabel, Input } from '@/app/src/components/ui';
|
||||
import {
|
||||
claimAdminBootstrap,
|
||||
getAdminBootstrapStatus,
|
||||
getLocalSessionUser,
|
||||
signInWithLocalAuth,
|
||||
signOutWithLocalAuth,
|
||||
} from './lib/auth';
|
||||
import { hasApiConfig } from './lib/api';
|
||||
} from '@/app/src/lib/auth';
|
||||
import { hasApiConfig } from '@/app/src/lib/api';
|
||||
|
||||
export function AdminPortal() {
|
||||
const [user, setUser] = useState<SessionUser | null>(null);
|
||||
@@ -1,7 +1,7 @@
|
||||
import { StrictMode } from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { AdminPortal } from './AdminPortal';
|
||||
import './index.css';
|
||||
import '@/app/src/index.css';
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<StrictMode>
|
||||
@@ -9,8 +9,8 @@ import type {
|
||||
ApplicationAdminSummary,
|
||||
BillingAdminWorkspaceDetail,
|
||||
BillingAdminWorkspaceSummary,
|
||||
} from '../../shared/types';
|
||||
import { formatBillingStatusLabel, formatDateLabel } from '../lib/billing-ui';
|
||||
} from '@/shared/types';
|
||||
import { formatBillingStatusLabel, formatDateLabel } from '@/app/src/lib/billing-ui';
|
||||
import {
|
||||
getAdminAnalyticsSummary,
|
||||
getAdminBillingWorkspaceDetail,
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
updateApplicationAdminStatus,
|
||||
upsertApplicationAdmin,
|
||||
} 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 MAX_SUMMARY_DAYS = 90;
|
||||
@@ -11,8 +11,8 @@ import type {
|
||||
ApplicationAdminStatus,
|
||||
BillingAdminWorkspaceDetailResponse,
|
||||
BillingAdminWorkspaceListResponse,
|
||||
} from '../../shared/types';
|
||||
import { apiRequest } from './api';
|
||||
} from '@/shared/types';
|
||||
import { apiRequest } from '@/app/src/lib/api';
|
||||
|
||||
export async function getAdminAnalyticsSummary(days = 30) {
|
||||
const params = new URLSearchParams({ days: String(days) });
|
||||
@@ -4,22 +4,22 @@ import path from 'path';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
root: path.resolve(__dirname),
|
||||
envDir: path.resolve(__dirname, '..'),
|
||||
plugins: [react(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, '.'),
|
||||
'@': path.resolve(__dirname, '..'),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
allowedHosts: ['project-1.duramente.com'],
|
||||
hmr: process.env.DISABLE_HMR !== 'true',
|
||||
port: 3001,
|
||||
strictPort: true,
|
||||
host: '0.0.0.0',
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist-admin',
|
||||
rollupOptions: {
|
||||
input: 'admin.html',
|
||||
},
|
||||
outDir: '../dist-admin',
|
||||
},
|
||||
});
|
||||
@@ -24,8 +24,8 @@ import { PricingComparisonTable } from './components/PricingComparisonTable';
|
||||
import { ResearchWorkspace } from './components/ResearchWorkspace';
|
||||
import { ResultsWorkspace } from './components/ResultsWorkspace';
|
||||
import { Alert, Badge, Button, Card, FieldLabel, Input, Surface } from './components/ui';
|
||||
import type { BillingInterval, PlanCode } from '../shared/billing/plans';
|
||||
import type { AdminBootstrapStatusResponse, SessionUser } from '../shared/types';
|
||||
import type { BillingInterval, PlanCode } from '@/shared/billing/plans';
|
||||
import type { AdminBootstrapStatusResponse, SessionUser } from '@/shared/types';
|
||||
import {
|
||||
claimAdminBootstrap,
|
||||
getAdminBootstrapStatus,
|
||||
@@ -1,9 +1,9 @@
|
||||
import { AlertCircle, ArrowUpRight, Building2, CreditCard, Loader2, Shield, Users } from 'lucide-react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { getEligibleAddonsForPlan } from '../../shared/billing/addons';
|
||||
import { formatLifecycleDate } from '../../shared/billing/lifecycle';
|
||||
import { getPlanByCode, getPublicPricingPlans, type PlanCode } from '../../shared/billing/plans';
|
||||
import type { AccountPageData, AppUser } from '../../shared/types';
|
||||
import { getEligibleAddonsForPlan } from '@/shared/billing/addons';
|
||||
import { formatLifecycleDate } from '@/shared/billing/lifecycle';
|
||||
import { getPlanByCode, getPublicPricingPlans, type PlanCode } from '@/shared/billing/plans';
|
||||
import type { AccountPageData, AppUser } from '@/shared/types';
|
||||
import {
|
||||
createAddonCheckout,
|
||||
createBillingPortalSession,
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
import { listSearchJobs } from '../lib/database';
|
||||
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';
|
||||
|
||||
interface BasicResultsViewProps {
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
import { listBusinesses, listJobResultLinks, listSearchJobs, type SearchJobResultLink } from '../lib/database';
|
||||
import type { Business, SearchJob } from '../types';
|
||||
import type { AppUser } from '../../shared/types';
|
||||
import type { AppUser } from '@/shared/types';
|
||||
import { cn } from '../lib/cn';
|
||||
import { Alert, Badge, Button, Card, EmptyState, Input, LoadingState, PageContainer, PageShell, SectionHeader, Select, StatCard } from './ui';
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
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';
|
||||
|
||||
interface DeepResearchPreviewMapProps {
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
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 { Alert, Badge, Button, EmptyState, LoadingState, MetricPill, SectionHeader, Surface } from './ui';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useMemo, useState } from '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 { DeepResearchPreviewMap } from './DeepResearchPreviewMap';
|
||||
import { Alert, Badge, Button, FieldLabel, Input, MetricPill, PageContainer, PageShell, SectionHeader, Surface } from './ui';
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from '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 { cn } from '../lib/cn';
|
||||
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 { cleanMapOptions } from '../lib/map-styles';
|
||||
import type { Business } from '../types';
|
||||
import type { AppUser } from '../../shared/types';
|
||||
import type { AppUser } from '@/shared/types';
|
||||
import { Alert, Badge, EmptyState } from './ui';
|
||||
|
||||
interface MapViewProps {
|
||||
@@ -1,5 +1,5 @@
|
||||
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 { formatPlanPeriod, formatPlanPrice } from '../lib/billing-ui';
|
||||
import { sendAnalyticsEvent } from '../lib/analytics';
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { Check, Minus } from 'lucide-react';
|
||||
import { getFeatureGate } from '../../shared/billing/feature-gates';
|
||||
import { getPlanByCode, getPublicPricingPlansForInterval, type ActivePlanCode, type BillingInterval, type PlanFeatures } from '../../shared/billing/plans';
|
||||
import { getFeatureGate } from '@/shared/billing/feature-gates';
|
||||
import { getPlanByCode, getPublicPricingPlansForInterval, type ActivePlanCode, type BillingInterval, type PlanFeatures } from '@/shared/billing/plans';
|
||||
import { Card, Badge } from './ui';
|
||||
import { formatQuantity } from '../lib/billing-ui';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
import { MapPinned, Search } from 'lucide-react';
|
||||
import type { AppUser } from '../../shared/types';
|
||||
import type { AppUser } from '@/shared/types';
|
||||
import { DeepResearchView } from './DeepResearchView';
|
||||
import { SearchSetup } from './SearchSetup';
|
||||
import { SegmentedTabs } from './ui';
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Files, MapPinned } from 'lucide-react';
|
||||
import type { AppUser } from '../../shared/types';
|
||||
import type { AppUser } from '@/shared/types';
|
||||
import { BasicResultsView } from './BasicResultsView';
|
||||
import { DeepResearchResultsView } from './DeepResearchResultsView';
|
||||
import { PageContainer, PageShell, SectionHeader, SegmentedTabs } from './ui';
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import { AlertCircle, LocateFixed, Loader2, MapPin, Play } from 'lucide-react';
|
||||
import { runSearch } from '../lib/database';
|
||||
import type { AppUser } from '../../shared/types';
|
||||
import type { AppUser } from '@/shared/types';
|
||||
import { BasicResearchMap } from './BasicResearchMap';
|
||||
import { Alert, Button, FieldLabel, Input, PageContainer, PageShell, SectionHeader, Surface } from './ui';
|
||||
|
||||
@@ -4,7 +4,7 @@ import type {
|
||||
BillingDebugData,
|
||||
BillingPortalSessionResponse,
|
||||
UpdateAccountProfileRequest,
|
||||
} from '../../shared/types';
|
||||
} from '@/shared/types';
|
||||
import { apiRequest } from './api';
|
||||
|
||||
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';
|
||||
|
||||
export function sendAnalyticsEvent(event: Omit<AnalyticsEventInput, 'eventSource'> & { eventSource?: AnalyticsEventInput['eventSource'] }) {
|
||||
@@ -4,7 +4,7 @@ import type {
|
||||
AdminBootstrapStatusResponse,
|
||||
AppUser,
|
||||
SessionUser,
|
||||
} from '../../shared/types';
|
||||
} from '@/shared/types';
|
||||
import { apiRequest } from './api';
|
||||
|
||||
export function getUserDisplayName(user: AppUser | SessionUser | null): string {
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ActivePlanCode, BillingInterval, PlanCode } from '../../shared/billing/plans';
|
||||
import { getPlanByCode, getPlanVariant } from '../../shared/billing/plans';
|
||||
import type { AccountBillingStatus, BillingUsageResourceSummary } from '../../shared/types';
|
||||
import type { ActivePlanCode, BillingInterval, PlanCode } from '@/shared/billing/plans';
|
||||
import { getPlanByCode, getPlanVariant } from '@/shared/billing/plans';
|
||||
import type { AccountBillingStatus, BillingUsageResourceSummary } from '@/shared/types';
|
||||
|
||||
export type UsageWarningState = 'healthy' | 'warning' | 'critical' | 'unavailable';
|
||||
|
||||
@@ -6,7 +6,7 @@ import type {
|
||||
DeepResearchBatchSummary,
|
||||
DeepResearchPreview,
|
||||
DeepResearchPreviewRequest,
|
||||
} from '../../shared/types';
|
||||
} from '@/shared/types';
|
||||
|
||||
export type SearchJobResultLink = {
|
||||
businessId: string;
|
||||
@@ -4,14 +4,22 @@ import path from 'path';
|
||||
import {defineConfig} from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
root: path.resolve(__dirname),
|
||||
envDir: path.resolve(__dirname, '..'),
|
||||
plugins: [react(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, '.'),
|
||||
'@': path.resolve(__dirname, '..'),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
allowedHosts: ['project-1.duramente.com'],
|
||||
hmr: process.env.DISABLE_HMR !== 'true',
|
||||
port: 3000,
|
||||
strictPort: true,
|
||||
host: '0.0.0.0',
|
||||
},
|
||||
build: {
|
||||
outDir: '../dist',
|
||||
},
|
||||
});
|
||||
+6
-6
@@ -4,15 +4,15 @@
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite --port=3000 --host=0.0.0.0",
|
||||
"dev:web": "vite --port=3000 --host=0.0.0.0",
|
||||
"dev:admin": "vite --config vite.admin.config.ts --port=3001 --host=0.0.0.0",
|
||||
"dev": "vite --config app/vite.config.ts",
|
||||
"dev:web": "vite --config app/vite.config.ts",
|
||||
"dev:admin": "vite --config admin/vite.config.ts",
|
||||
"dev:api": "tsx --tsconfig tsconfig.server.json server/src/index.ts",
|
||||
"dev:worker": "tsx --tsconfig tsconfig.server.json server/src/worker.ts",
|
||||
"build": "vite build",
|
||||
"build:admin": "vite build --config vite.admin.config.ts",
|
||||
"build": "vite build --config app/vite.config.ts",
|
||||
"build:admin": "vite build --config admin/vite.config.ts",
|
||||
"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",
|
||||
"lint": "tsc --noEmit && tsc -p tsconfig.server.json --noEmit",
|
||||
"migrate": "tsx --tsconfig tsconfig.server.json db/scripts/migrate.ts",
|
||||
|
||||
+1
-1
@@ -23,5 +23,5 @@
|
||||
"allowImportingTsExtensions": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["src", "shared", "vite.config.ts"]
|
||||
"include": ["app/src", "admin/src", "shared", "app/vite.config.ts", "admin/vite.config.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user