Skip to content

Frontend Architecture ​

The PIP AI frontend is built with Nuxt 4 (Vue 3 Composition API), using file-based routing, auto-imports, and Pinia for state management.

Framework Stack ​

LayerTechnologyPurpose
FrameworkNuxt 4SSR, routing, auto-imports
UIVue 3 Composition APIReactive components with <script setup>
StylingTailwind CSSUtility-first styling
StatePiniaGlobal state management
TablesTanStack Vue TableAdvanced data grid
CanvasFabric.js 5.2.4Floor plan interaction
PDFPDF.js 3.11.174PDF rendering
IconsLucide Vue NextIcon library
AnimationVueUse MotionTransition animations
UI PrimitivesReka UIAccessible component primitives

Pages ​

Pages use Nuxt file-based routing in app/pages/:

RoutePageDescription
/index.vueDashboard — project list
/projects/[id]projects/[id]/index.vueProject detail — 5-tab workflow
/admin/specsadmin/specs.vueAdmin spec library management
/auth/loginauth/login.vueLogin page
/auth/registerauth/register.vueRegistration page
/auth/callbackauth/callback.vueOAuth callback handler

Layouts ​

Layouts in app/layouts/ provide page structure. The default layout includes the Header component with navigation and theme switching.

Middleware ​

MiddlewareFilePurpose
authapp/middleware/auth.tsRedirects unauthenticated users to login
adminapp/middleware/admin.tsRestricts routes to admin users

When NUXT_PUBLIC_DEV_AUTH_BYPASS=true, the auth middleware is skipped entirely.

Component Organization ​

Components are organized by feature domain:

app/components/
├── tabs/              # Top-level workflow tabs
├── floorplan/         # Floor plan editor and related UI
├── document-builder/  # Document builder components
│   └── sidebar/       # Builder sidebar sections
├── ui/                # Reusable primitives
│   ├── badge/
│   ├── button/
│   ├── input/
│   └── table/
└── *.vue              # Shared feature components

All components are auto-imported by Nuxt — no manual import statements needed.

Composables ​

Over 20 composables in app/composables/ encapsulate business logic:

  • Data Access — useProjects, usePipItems, useFloorPlans, useComments
  • Search & Matching — useSpecMatching, useSpecSearch, useSpecUpload
  • Canvas — useCanvasHistory, useFloorPlanRenderer, useFloorPlanImages
  • Document Builder — useDocumentBuilder, useDocumentExport
  • AI Integration — useNanoBanana, usePolyhavenMaterials
  • Infrastructure — useAuth, useUserRole, useNetworkStatus, useResizablePanel

State Management ​

Pinia stores provide global state:

StoreFileScope
useAppStoreapp/stores/app.tsTheme, sidebar, global UI state
useProjectsStoreapp/stores/projects.tsProject list, current project
usePipItemsStoreapp/stores/pipItems.tsPIP items for active project

Theming ​

Five themes are defined in app/constants/themes.ts:

  • Dark — Dark background with light text
  • Light — Clean light theme
  • Sandstone — Warm earth tones
  • Neo Mint — Fresh green accents
  • Corporate — Professional blue palette

Theme state is persisted via useAppStore and initialized by app/plugins/theme.client.ts.

Built with VitePress