How daksh22ai/logam-os works
1. This repo is split into two independently running applications.
The frontend/ folder is a Next.js 16.2 app for the user-facing dashboard and supporting UI.
The backend/ folder is a FastAPI service dedicated to AI chat/generation.
2. The frontend is the main orchestration layer for the product UI.
It uses the Next.js App Router under src/app/ with distinct surfaces for:
- dashboard/ and nested brand/channel views
- chat/
- welcome/
- landing/home pages
This suggests a multi-tenant agency workspace centered around brands/clients and channel-specific views.
3. Frontend UI is organized by domain, not by generic component type.
Components are grouped into alerts, chat, creative, finance, landing, onboarding, reporting, and shell.
That implies the main architectural boundary in the UI is feature area, with shared layout chrome in shell/ and reusable primitives in ui/.
4. The frontend has a clear client-data boundary separate from AI/chat.
src/app/api/clients/... contains Next route handlers for client and metrics endpoints, while src/lib/db.ts, prisma/schema.prisma, and prisma/seed.ts indicate a Prisma-backed database layer.
In practice, the frontend likely owns its own application data model for clients, metrics, and dashboard state.
5. State management in the frontend is lightweight and local.
src/stores/ui.ts uses Zustand for UI state, which fits the layout-centric nature of the app: sidebar/rail visibility, panel state, or similar interaction state rather than heavy global domain logic.
6. The backend is a focused AI service, not a full product server.
FastAPI exposes a small API surface:
- GET /health
- POST /api/chat
- POST /api/chat/stream
This makes the backend a dedicated generation layer for chat responses, including streaming output.
7. The backend follows a layered design.
The file layout separates:
- routes/ for HTTP handlers
- services/ for orchestration logic
- chatbot/ for agent/chain/prompt construction
- db/ for persistence access
- models/ for schemas and database models
- config.py and utils/logger.py for environment and observability
This is a standard API → service → domain/AI → persistence flow.
8. AI generation is built around LangChain and Groq.
The README explicitly calls out LangChain plus the Groq API, and the backend/app/chatbot/ folder reinforces that the model interaction is encapsulated as an agent/chain with prompt definitions.
The key architectural boundary here is between request handling and model orchestration.
9. Backend persistence appears to use a local SQLite database.
The presence of backend/logam_os.db alongside db/database.py, crud.py, and models.py implies a lightweight relational store for backend state.
This is separate from the frontend’s Prisma-backed data layer, so the system has two data stores with different responsibilities.
10. The main end-to-end flow is: UI request → frontend API/data layer → backend AI service.
Dashboard pages and the chat page render product workflows, while chat-related components likely call src/lib/api.ts, which in turn reaches the FastAPI service for AI responses.
Client/metrics dashboard data is handled inside the Next app through its own API routes and database layer.
11. The app shell is designed as an agency command center.
components/shell/ includes Sidebar, Rail, MainHeader, and AIPanel, which indicates a persistent workspace layout with an always-available assistant panel alongside the main content area.
12. The product surface is strongly dashboard-oriented and multi-tenant.
The route structure uses [brandId] and [channel] segments, which is a strong signal that the system organizes work around client brands and marketing channels rather than around a single-user consumer model.
13. Infrastructure/runtime split matters for the architecture diagram.
The frontend runs on Node/Next.js, with Prisma as its DB access layer.
The backend runs on Python/FastAPI with Uvicorn, LangChain, and Groq.
These are separate deployables with different runtimes and different data responsibilities.
14. Overall, the system is a two-tier product architecture.
The Next.js app owns presentation, dashboard workflows, and client data APIs.
The FastAPI app owns AI chat generation and streaming.
Shared concerns are minimal, and the boundary between the two is the chat/AI integration path.
Main entry points: app Next app · chat_service.py Chat service · shell App shell · main.py FastAPI app
Components 18
Frontend
Next.js app for dashboard UI, client data, and chat entrypoints.
- Next app · App Router surfaces for dashboard, chat, welcome, and landing pages.
frontend/src/app - Dashboard · Multi-tenant workspace routes for brands and channels.
frontend/src/app/(dashboard) - Chat page · User-facing chat entrypoint in the frontend.
frontend/src/app/chat/page.tsx - Client API · Next route handlers for client and metrics data.
frontend/src/app/api/clients - App shell · Persistent workspace chrome with sidebar, rail, header, and AI panel.
frontend/src/components/shell - Domain UI · Feature-oriented UI for alerts, chat, creative, finance, landing, onboarding, and reporting.
frontend/src/components - UI primitives · Reusable presentation primitives and empty/loading states.
frontend/src/components/ui - Frontend API client · Client-side integration that calls external services, including AI chat.
frontend/src/lib/api.ts - Prisma DB · Frontend database connection and application data access.
frontend/src/lib/db.ts - Prisma schema · Frontend data model and seed definitions.
frontend/prisma/schema.prisma - UI store · Local Zustand state for shell and interaction state.
frontend/src/stores/ui.ts
Backend
FastAPI service for AI chat generation and streaming.
- FastAPI app · Python service entrypoint exposing chat and health routes.
backend/app/main.py - HTTP routes · Health and chat endpoints for the AI service.
backend/app/routes - Chat service · Orchestrates chat request handling and response assembly.
backend/app/services/chat_service.py - AI chain · LangChain/Groq prompt, agent, and chain construction.
backend/app/chatbot - SQLite data · Backend database access and local relational storage.
backend/app/db - Schemas · Request/response and database models for the backend.
backend/app/models - Config · Environment and logging configuration for the AI service.
backend/app/config.py
Connections 18
- Next app → Dashboard: renders · The App Router hosts the dashboard workspace surfaces.
- Next app → Chat page: renders · The App Router provides the chat page.
- Next app → Client API: serves · Route handlers expose client and metrics APIs.
- Next app → App shell: wraps · Global layout composes the persistent shell.
- App shell → Domain UI: uses · Shell integrates feature-specific UI areas.
- Domain UI → UI primitives: builds on · Feature components reuse shared primitives.
- Chat page → Frontend API client: calls · Chat UI sends requests through the frontend API layer.
- Dashboard → Prisma DB: reads/writes · Dashboard workflows use the Prisma-backed data layer.
- Prisma DB → Prisma schema: maps to · Database access is defined by the Prisma schema.
- App shell → UI store: controls · Local UI state drives shell interactions.
- Frontend API client → FastAPI app: requests · Frontend chat integration reaches the FastAPI service.
- FastAPI app → HTTP routes: mounts · The FastAPI app exposes route handlers.
- HTTP routes → Chat service: delegates · HTTP handlers pass work to the chat service.
- Chat service → AI chain: orchestrates · Service logic constructs and runs the AI chain.
- Chat service → SQLite data: persists · Chat service can read/write backend state.
- Chat service → Schemas: uses · Service layer depends on request and domain models.
- FastAPI app → Config: configures · Runtime behavior is driven by config and logging.
- SQLite data → Schemas: stores · Database layer uses backend model definitions.