Cardinal is a Preact-based web application for creating and managing card designs with templates.
npm run dev- Start development server at http://localhost:5173/npm run build- Build for production todist/npm run preview- Preview production build at http://localhost:4173/npm run push- Deploy to production server (runs build + rsync to fuchikoma:/volume1/docker/pocketbase/public)
- Frontend: Preact with TypeScript, Vite build system, TailwindCSS + DaisyUI for styling
- Backend: PocketBase for database and API
- State Management: Preact Signals for reactive state, TanStack Query for server state
- Routing: preact-iso for client-side routing
- Project: Top-level container for organizing templates and cards
- Template: Design blueprint with elements and fields, belongs to a project
- Card: Instance of a template with specific data values
- Element: UI component with positioning, styling, and content properties
src/lib/- Core business logic, types, utilities, and database configurationsrc/pages/- Route components (Splash, Projects, Editor, etc.)src/features/- Feature-specific components organized by domainsrc/components/- Shared UI components (Modal, Page, EmptyState, etc.)src/icons/- Custom icon components
- Global editor state managed through
src/lib/editor.tssignals:editorView- Current editor view (template/properties)element- Currently selected elementtemplate- Active template being edited
- Server state managed via TanStack Query with PocketBase integration
- Path aliases:
$lib,$components,$assetsfor clean imports
- PocketBase client configured in
src/lib/db.tswith retry logic and error handling - Environment variable
VITE_DB_URLrequired for database connection - Custom error handling for 404s and retry strategies for failed requests
- Zod schemas in
src/lib/types.tsfor runtime type validation
The editor is a visual design tool for creating templates:
- Element positioning with absolute coordinates
- Properties panel for styling and content editing
- Template management with element hierarchy
- Real-time preview of design changes
- TailwindCSS v4 with DaisyUI components
- Custom utility classes in
src/lib/styles.ts - Responsive design patterns throughout
- CSS custom properties for theme variables