How samarthsaxena2004/flickai works
1. Monorepo shape
- This repo is split into two independently runnable applications plus shared packages.
- apps/desktop is the product: an Electron desktop assistant.
- apps/web is the marketing/landing site built with Next.js.
- packages/* holds reusable code, mainly shared UI primitives and a typed API client.
2. Desktop app boundary
- apps/desktop/electron/main.ts is the Electron main process: it owns the native app lifecycle, window creation, and OS-level behaviors.
- apps/desktop/electron/preload.ts is the security boundary between the main process and the React UI, exposing only safe APIs to the renderer.
- apps/desktop/src/* is the renderer process: all visible assistant UI lives here.
3. Desktop UI flow
- The renderer is a React + Vite app.
- App.tsx, MessageBubble.tsx, and SettingsModal.tsx suggest a chat-style assistant with configurable provider settings.
- The UI is designed around streaming responses, with assistant output appearing incrementally rather than as a single blocked reply.
4. AI interaction subsystem
- src/hooks/useAI.ts is the central orchestration hook for sending prompts and receiving model output.
- The README indicates the model backend is Cerebras GLM-4.7, with the API client package likely wrapping that integration.
- The architectural emphasis is low-latency inference so the desktop assistant feels “instant.”
5. Vision subsystem
- src/hooks/useVision.ts handles screen/image context gathering.
- The README describes active-window or full-screen capture, with OpenRouter/Llama 3.2 Vision and Tesseract.js OCR as the vision path and fallback.
- This creates a distinct input pipeline separate from plain text chat: screen context is converted into model-readable prompt material.
6. Voice input subsystem
- src/hooks/useVoiceInput.ts handles speech-to-text.
- Deepgram is the external transcription service, so voice is another input channel feeding the same assistant conversation flow.
- The result is a multimodal desktop assistant: text, voice, and screen context converge into one response stream.
7. Desktop runtime responsibilities
- Electron gives the app native windowing and OS integration, which is important because the product is meant to be summoned globally and run outside the browser.
- The main process likely owns the hotkey/wake behavior described in the README, while the renderer handles interaction and presentation.
- This separation is the key trust boundary: native capabilities stay in Electron, UI logic stays in React.
8. Web app boundary
- apps/web is a separate Next.js 15 App Router application, used for the public site rather than the desktop assistant itself.
- It is mostly composed of marketing sections: hero, how-it-works, pricing, testimonials, FAQ, footer, and CTA.
- The many bento-* components and animated sections indicate a presentation-heavy, mostly static frontend.
9. Web app composition
- The web app uses local UI components plus shadcn-style primitives under components/ui.
- theme-provider.tsx suggests client-side theme toggling/dark mode support.
- There is also a lib/supabase.ts, which marks an external backend integration point even if it is not central to the core assistant workflow.
10. Shared packages
- packages/api-client centralizes typed access to the AI backend, especially Cerebras-related calls and shared request/response types.
- packages/ui provides reusable UI controls such as Button and Toggle.
- These packages reduce duplication across apps and create explicit boundaries between “shared primitives” and app-specific code.
11. Data flow across the system
- In the desktop app, user actions enter through the renderer UI, optional voice/vision hooks enrich the prompt, the API client sends the request to external AI services, and the streamed answer is rendered back into message bubbles.
- In the web app, content flow is mostly one-way: structured components render static/product storytelling content for the landing page.
- The repo therefore has one interactive AI runtime and one mostly static promotional frontend.
12. Build and deployment topology
- pnpm-workspace.yaml, turbo.json, and the root package.json show a Turborepo-managed workspace with shared dependency installation via PNPM.
- vercel.json indicates the web app is intended for Vercel-style deployment.
- The desktop app is a separate Electron build target with its own environment variables for API keys.
Main entry points: App.tsx Assistant UI · package.json FlickAI · page.tsx Landing page · main.ts Electron main
Components 20
Workspace
Monorepo orchestration and shared packages
Desktop app
Electron assistant runtime and renderer UI
- Electron main · Owns app lifecycle, windows, and OS integration
apps/desktop/electron/main.ts - Preload bridge · Exposes a narrow API surface from Electron to the renderer
apps/desktop/electron/preload.ts - Assistant UI · React renderer for the desktop assistant experience
apps/desktop/src/App.tsx - Message bubble · Renders assistant and user messages in the conversation stream
apps/desktop/src/components/MessageBubble.tsx - Settings modal · Provider and assistant settings UI
apps/desktop/src/components/SettingsModal.tsx - AI hook · Central prompt and streaming-response coordination
apps/desktop/src/hooks/useAI.ts - Vision hook · Captures screen or image context and prepares vision prompts
apps/desktop/src/hooks/useVision.ts - Voice hook · Handles speech-to-text transcription for the assistant
apps/desktop/src/hooks/useVoiceInput.ts
Web app
Next.js marketing site
- Landing page · Public marketing site built with Next.js App Router
apps/web/app/page.tsx - Hero section · Top-of-page product story and conversion entry point
apps/web/components/hero-section.tsx - Pricing section · Plans and purchase framing
apps/web/components/pricing-section.tsx - Theme provider · Client-side theme and dark mode handling
apps/web/components/theme-provider.tsx
Shared packages
Reusable UI and typed API client
- API client · Shared typed access to the model backend and request/response types
packages/api-client/src/index.ts - Cerebras integration · Model-specific client logic for the low-latency backend
packages/api-client/src/cerebras.ts - UI package · Reusable primitives for both apps
packages/ui/src/index.ts - Button · Shared button control
packages/ui/src/Button.tsx - Toggle · Shared toggle control
packages/ui/src/Toggle.tsx
Connections 22
- FlickAI → Electron main: contains · Workspace includes the Electron runtime
- FlickAI → Landing page: contains · Workspace includes the public site
- FlickAI → API client: shares · Shared packages are consumed by apps
- FlickAI → UI package: shares · Shared UI primitives are consumed by apps
- PNPM → FlickAI: manages · Workspace dependency resolution
- Turbo → Electron main: builds · Coordinates app tasks
- Turbo → Landing page: builds · Coordinates app tasks
- Electron main → Preload bridge: loads · Main process injects the preload bridge
- Electron main → Assistant UI: creates window · Main process hosts the renderer UI
- Preload bridge → Assistant UI: exposes api · Safe IPC boundary for renderer access
- Assistant UI → Message bubble: renders · Conversation stream is displayed through message bubbles
- Assistant UI → Settings modal: configures · Assistant settings are edited in a modal
- Assistant UI → AI hook: orchestrates · Renderer delegates prompt/response flow to the AI hook
- Assistant UI → Vision hook: adds context · Screen or image context can be attached to a prompt
- Assistant UI → Voice hook: accepts input · Speech input feeds the assistant flow
- AI hook → API client: calls · Model requests go through the typed client
- API client → Cerebras integration: adapts · Backend-specific Cerebras integration
- UI package → Button: exports · Shared primitive export
- UI package → Toggle: exports · Shared primitive export
- Landing page → Hero section: composes · Landing page is built from marketing sections
- Landing page → Pricing section: composes · Landing page is built from marketing sections
- Landing page → Theme provider: provides · Theme provider wraps client UI