Spaces:
Running
Running
Repository Guidelines
Project Structure
client/: Frontend React applicationcomponents/: Feature-based UI components (Search,AiResponse,Analytics). Each folder is self-contained with related styles, hooks, and utilities.modules/: Core business logic (PubSub stores, search services, database layers)hooks/: Custom React hookspublic/: Static assets
server/: Server hooks for search endpoints, caching, compression, CORS, and API validationshared/: Utilities shared between client and servervite.config.ts: Build and server configuration with environment-driven feature flags
Development Commands
npm run dev: Start development server with HMRnpm run build: Compile for productionnpm run start: Preview production buildnpm run lint: Check code quality (Biome, TypeScript, dependencies)npm run format: Auto-format code with Biome
Coding Conventions
Tech Stack: React + TypeScript + Mantine UI (@mantine/core, @mantine/hooks, @mantine/form)
Style:
- Run
npm run formatbefore committing (enforced viahuskyandlint-staged) - Named function exports:
export function ComponentName(notReact.FC) - Use
React.lazy()for route-level components - PascalCase for components/types, camelCase for functions/variables, UPPER_SNAKE_CASE for constants
TypeScript:
- Use interfaces for data structures
- Avoid comments; use TSDoc only for public APIs
State & Imports:
- Use
create-pubsubfor global state (avoid nested context providers) - Prefer absolute path aliases where configured
UI & Performance:
- Use Mantine components for consistency
- Ensure keyboard navigation, ARIA labels, semantic HTML
- Use
React.memo()anduseCallback()for optimization
Pull Requests
- Ensure
npm run lintpass - Keep PRs focused on a single feature or fix
- Include clear descriptions and screenshots for UI changes
- Write descriptive commit messages
Architecture
- Privacy-First: Local storage via Dexie.js (IndexedDB)
- AI Inference: Server-side (OpenAI, Horde) and client-side (WebLLM, Wllama)
- State Management: PubSub pattern for decoupled state (no prop drilling)
- Search Pipeline: Server hooks handle validation, caching, compression, reranking
Configuration
- Environment: See
.env.examplefor options - Docker Development:
docker compose up - Docker Production:
docker compose -f docker-compose.production.yml up --build