From a926d06b54c85be0d0522fb6fa0982494bafcef4 Mon Sep 17 00:00:00 2001 From: pguerrerox Date: Sat, 30 May 2026 00:45:06 +0000 Subject: [PATCH] chore: reorganize frontend into app and admin roots --- CHANGELOG.md | 19 +++++++++++++++++++ admin.html => admin/index.html | 0 {src => admin/src}/AdminPortal.tsx | 8 ++++---- {src => admin/src}/admin-main.tsx | 2 +- {src => admin/src}/components/AdminPage.tsx | 6 +++--- {src => admin/src}/lib/admin.ts | 4 ++-- vite.admin.config.ts => admin/vite.config.ts | 10 +++++----- index.html => app/index.html | 0 {src => app/src}/App.tsx | 4 ++-- {src => app/src}/components/AccountPage.tsx | 8 ++++---- .../src}/components/BasicResearchMap.tsx | 0 .../src}/components/BasicResultsView.tsx | 2 +- {src => app/src}/components/Dashboard.tsx | 2 +- .../components/DeepResearchPreviewMap.tsx | 2 +- .../components/DeepResearchResultsView.tsx | 2 +- .../src}/components/DeepResearchView.tsx | 2 +- {src => app/src}/components/Layout.tsx | 2 +- {src => app/src}/components/MapView.tsx | 2 +- {src => app/src}/components/PricingCards.tsx | 2 +- .../components/PricingComparisonTable.tsx | 4 ++-- .../src}/components/ResearchWorkspace.tsx | 2 +- .../src}/components/ResultsWorkspace.tsx | 2 +- {src => app/src}/components/SearchSetup.tsx | 2 +- {src => app/src}/components/ui.tsx | 0 {src => app/src}/index.css | 0 {src => app/src}/lib/account.ts | 2 +- {src => app/src}/lib/analytics.ts | 2 +- {src => app/src}/lib/api.ts | 0 {src => app/src}/lib/auth.ts | 2 +- {src => app/src}/lib/billing-ui.ts | 6 +++--- {src => app/src}/lib/cn.ts | 0 {src => app/src}/lib/database.ts | 2 +- {src => app/src}/lib/map-styles.ts | 0 {src => app/src}/main.tsx | 0 {src => app/src}/types.ts | 0 {src => app/src}/vite-env.d.ts | 0 vite.config.ts => app/vite.config.ts | 10 +++++++++- package.json | 12 ++++++------ tsconfig.json | 2 +- 39 files changed, 76 insertions(+), 49 deletions(-) rename admin.html => admin/index.html (100%) rename {src => admin/src}/AdminPortal.tsx (97%) rename {src => admin/src}/admin-main.tsx (88%) rename {src => admin/src}/components/AdminPage.tsx (99%) rename {src => admin/src}/lib/admin.ts (98%) rename vite.admin.config.ts => admin/vite.config.ts (71%) rename index.html => app/index.html (100%) rename {src => app/src}/App.tsx (99%) rename {src => app/src}/components/AccountPage.tsx (99%) rename {src => app/src}/components/BasicResearchMap.tsx (100%) rename {src => app/src}/components/BasicResultsView.tsx (99%) rename {src => app/src}/components/Dashboard.tsx (99%) rename {src => app/src}/components/DeepResearchPreviewMap.tsx (98%) rename {src => app/src}/components/DeepResearchResultsView.tsx (98%) rename {src => app/src}/components/DeepResearchView.tsx (99%) rename {src => app/src}/components/Layout.tsx (99%) rename {src => app/src}/components/MapView.tsx (99%) rename {src => app/src}/components/PricingCards.tsx (97%) rename {src => app/src}/components/PricingComparisonTable.tsx (97%) rename {src => app/src}/components/ResearchWorkspace.tsx (96%) rename {src => app/src}/components/ResultsWorkspace.tsx (97%) rename {src => app/src}/components/SearchSetup.tsx (99%) rename {src => app/src}/components/ui.tsx (100%) rename {src => app/src}/index.css (100%) rename {src => app/src}/lib/account.ts (97%) rename {src => app/src}/lib/analytics.ts (84%) rename {src => app/src}/lib/api.ts (100%) rename {src => app/src}/lib/auth.ts (98%) rename {src => app/src}/lib/billing-ui.ts (97%) rename {src => app/src}/lib/cn.ts (100%) rename {src => app/src}/lib/database.ts (99%) rename {src => app/src}/lib/map-styles.ts (100%) rename {src => app/src}/main.tsx (100%) rename {src => app/src}/types.ts (100%) rename {src => app/src}/vite-env.d.ts (100%) rename vite.config.ts => app/vite.config.ts (63%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26385a2..961d26e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/admin.html b/admin/index.html similarity index 100% rename from admin.html rename to admin/index.html diff --git a/src/AdminPortal.tsx b/admin/src/AdminPortal.tsx similarity index 97% rename from src/AdminPortal.tsx rename to admin/src/AdminPortal.tsx index efa0443..992d473 100644 --- a/src/AdminPortal.tsx +++ b/admin/src/AdminPortal.tsx @@ -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(null); diff --git a/src/admin-main.tsx b/admin/src/admin-main.tsx similarity index 88% rename from src/admin-main.tsx rename to admin/src/admin-main.tsx index 20a1ea4..badbdcb 100644 --- a/src/admin-main.tsx +++ b/admin/src/admin-main.tsx @@ -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( diff --git a/src/components/AdminPage.tsx b/admin/src/components/AdminPage.tsx similarity index 99% rename from src/components/AdminPage.tsx rename to admin/src/components/AdminPage.tsx index 023fae4..bf94337 100644 --- a/src/components/AdminPage.tsx +++ b/admin/src/components/AdminPage.tsx @@ -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; diff --git a/src/lib/admin.ts b/admin/src/lib/admin.ts similarity index 98% rename from src/lib/admin.ts rename to admin/src/lib/admin.ts index 5afbbff..10fe4cc 100644 --- a/src/lib/admin.ts +++ b/admin/src/lib/admin.ts @@ -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) }); diff --git a/vite.admin.config.ts b/admin/vite.config.ts similarity index 71% rename from vite.admin.config.ts rename to admin/vite.config.ts index 6004d13..aec80cf 100644 --- a/vite.admin.config.ts +++ b/admin/vite.config.ts @@ -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', }, }); diff --git a/index.html b/app/index.html similarity index 100% rename from index.html rename to app/index.html diff --git a/src/App.tsx b/app/src/App.tsx similarity index 99% rename from src/App.tsx rename to app/src/App.tsx index b0ac888..e57dac7 100644 --- a/src/App.tsx +++ b/app/src/App.tsx @@ -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, diff --git a/src/components/AccountPage.tsx b/app/src/components/AccountPage.tsx similarity index 99% rename from src/components/AccountPage.tsx rename to app/src/components/AccountPage.tsx index c805406..d9066be 100644 --- a/src/components/AccountPage.tsx +++ b/app/src/components/AccountPage.tsx @@ -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, diff --git a/src/components/BasicResearchMap.tsx b/app/src/components/BasicResearchMap.tsx similarity index 100% rename from src/components/BasicResearchMap.tsx rename to app/src/components/BasicResearchMap.tsx diff --git a/src/components/BasicResultsView.tsx b/app/src/components/BasicResultsView.tsx similarity index 99% rename from src/components/BasicResultsView.tsx rename to app/src/components/BasicResultsView.tsx index bf9ed25..c5fb447 100644 --- a/src/components/BasicResultsView.tsx +++ b/app/src/components/BasicResultsView.tsx @@ -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 { diff --git a/src/components/Dashboard.tsx b/app/src/components/Dashboard.tsx similarity index 99% rename from src/components/Dashboard.tsx rename to app/src/components/Dashboard.tsx index 8a91e5d..b4d4f6f 100644 --- a/src/components/Dashboard.tsx +++ b/app/src/components/Dashboard.tsx @@ -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'; diff --git a/src/components/DeepResearchPreviewMap.tsx b/app/src/components/DeepResearchPreviewMap.tsx similarity index 98% rename from src/components/DeepResearchPreviewMap.tsx rename to app/src/components/DeepResearchPreviewMap.tsx index ee4fbe6..d08a7d2 100644 --- a/src/components/DeepResearchPreviewMap.tsx +++ b/app/src/components/DeepResearchPreviewMap.tsx @@ -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 { diff --git a/src/components/DeepResearchResultsView.tsx b/app/src/components/DeepResearchResultsView.tsx similarity index 98% rename from src/components/DeepResearchResultsView.tsx rename to app/src/components/DeepResearchResultsView.tsx index d60d513..9b6b284 100644 --- a/src/components/DeepResearchResultsView.tsx +++ b/app/src/components/DeepResearchResultsView.tsx @@ -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'; diff --git a/src/components/DeepResearchView.tsx b/app/src/components/DeepResearchView.tsx similarity index 99% rename from src/components/DeepResearchView.tsx rename to app/src/components/DeepResearchView.tsx index 4654a13..83c9349 100644 --- a/src/components/DeepResearchView.tsx +++ b/app/src/components/DeepResearchView.tsx @@ -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'; diff --git a/src/components/Layout.tsx b/app/src/components/Layout.tsx similarity index 99% rename from src/components/Layout.tsx rename to app/src/components/Layout.tsx index f46250e..5e3ba00 100644 --- a/src/components/Layout.tsx +++ b/app/src/components/Layout.tsx @@ -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'; diff --git a/src/components/MapView.tsx b/app/src/components/MapView.tsx similarity index 99% rename from src/components/MapView.tsx rename to app/src/components/MapView.tsx index 85b9f9f..7fd58c4 100644 --- a/src/components/MapView.tsx +++ b/app/src/components/MapView.tsx @@ -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 { diff --git a/src/components/PricingCards.tsx b/app/src/components/PricingCards.tsx similarity index 97% rename from src/components/PricingCards.tsx rename to app/src/components/PricingCards.tsx index 4350d62..2831a9c 100644 --- a/src/components/PricingCards.tsx +++ b/app/src/components/PricingCards.tsx @@ -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'; diff --git a/src/components/PricingComparisonTable.tsx b/app/src/components/PricingComparisonTable.tsx similarity index 97% rename from src/components/PricingComparisonTable.tsx rename to app/src/components/PricingComparisonTable.tsx index 8ce26a0..85668b6 100644 --- a/src/components/PricingComparisonTable.tsx +++ b/app/src/components/PricingComparisonTable.tsx @@ -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'; diff --git a/src/components/ResearchWorkspace.tsx b/app/src/components/ResearchWorkspace.tsx similarity index 96% rename from src/components/ResearchWorkspace.tsx rename to app/src/components/ResearchWorkspace.tsx index 31b93da..2e149af 100644 --- a/src/components/ResearchWorkspace.tsx +++ b/app/src/components/ResearchWorkspace.tsx @@ -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'; diff --git a/src/components/ResultsWorkspace.tsx b/app/src/components/ResultsWorkspace.tsx similarity index 97% rename from src/components/ResultsWorkspace.tsx rename to app/src/components/ResultsWorkspace.tsx index 1a92675..734758a 100644 --- a/src/components/ResultsWorkspace.tsx +++ b/app/src/components/ResultsWorkspace.tsx @@ -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'; diff --git a/src/components/SearchSetup.tsx b/app/src/components/SearchSetup.tsx similarity index 99% rename from src/components/SearchSetup.tsx rename to app/src/components/SearchSetup.tsx index ee98d8e..0f37a22 100644 --- a/src/components/SearchSetup.tsx +++ b/app/src/components/SearchSetup.tsx @@ -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'; diff --git a/src/components/ui.tsx b/app/src/components/ui.tsx similarity index 100% rename from src/components/ui.tsx rename to app/src/components/ui.tsx diff --git a/src/index.css b/app/src/index.css similarity index 100% rename from src/index.css rename to app/src/index.css diff --git a/src/lib/account.ts b/app/src/lib/account.ts similarity index 97% rename from src/lib/account.ts rename to app/src/lib/account.ts index bf038eb..105504f 100644 --- a/src/lib/account.ts +++ b/app/src/lib/account.ts @@ -4,7 +4,7 @@ import type { BillingDebugData, BillingPortalSessionResponse, UpdateAccountProfileRequest, -} from '../../shared/types'; +} from '@/shared/types'; import { apiRequest } from './api'; export async function getAccountPageData() { diff --git a/src/lib/analytics.ts b/app/src/lib/analytics.ts similarity index 84% rename from src/lib/analytics.ts rename to app/src/lib/analytics.ts index be597fb..fd36ace 100644 --- a/src/lib/analytics.ts +++ b/app/src/lib/analytics.ts @@ -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 & { eventSource?: AnalyticsEventInput['eventSource'] }) { diff --git a/src/lib/api.ts b/app/src/lib/api.ts similarity index 100% rename from src/lib/api.ts rename to app/src/lib/api.ts diff --git a/src/lib/auth.ts b/app/src/lib/auth.ts similarity index 98% rename from src/lib/auth.ts rename to app/src/lib/auth.ts index 41d7cfe..3957781 100644 --- a/src/lib/auth.ts +++ b/app/src/lib/auth.ts @@ -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 { diff --git a/src/lib/billing-ui.ts b/app/src/lib/billing-ui.ts similarity index 97% rename from src/lib/billing-ui.ts rename to app/src/lib/billing-ui.ts index 2cb1b43..1dcd4d0 100644 --- a/src/lib/billing-ui.ts +++ b/app/src/lib/billing-ui.ts @@ -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'; diff --git a/src/lib/cn.ts b/app/src/lib/cn.ts similarity index 100% rename from src/lib/cn.ts rename to app/src/lib/cn.ts diff --git a/src/lib/database.ts b/app/src/lib/database.ts similarity index 99% rename from src/lib/database.ts rename to app/src/lib/database.ts index 94a2a99..0dfa025 100644 --- a/src/lib/database.ts +++ b/app/src/lib/database.ts @@ -6,7 +6,7 @@ import type { DeepResearchBatchSummary, DeepResearchPreview, DeepResearchPreviewRequest, -} from '../../shared/types'; +} from '@/shared/types'; export type SearchJobResultLink = { businessId: string; diff --git a/src/lib/map-styles.ts b/app/src/lib/map-styles.ts similarity index 100% rename from src/lib/map-styles.ts rename to app/src/lib/map-styles.ts diff --git a/src/main.tsx b/app/src/main.tsx similarity index 100% rename from src/main.tsx rename to app/src/main.tsx diff --git a/src/types.ts b/app/src/types.ts similarity index 100% rename from src/types.ts rename to app/src/types.ts diff --git a/src/vite-env.d.ts b/app/src/vite-env.d.ts similarity index 100% rename from src/vite-env.d.ts rename to app/src/vite-env.d.ts diff --git a/vite.config.ts b/app/vite.config.ts similarity index 63% rename from vite.config.ts rename to app/vite.config.ts index d1470b4..216f5f1 100644 --- a/vite.config.ts +++ b/app/vite.config.ts @@ -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', }, }); diff --git a/package.json b/package.json index ecf9b76..cb7c0d5 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tsconfig.json b/tsconfig.json index 136a2da..7fb2d69 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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"] }