How akshaya-csbs/krylo works
Purpose and Entry Points
This is a full-stack brand intelligence and campaign-analysis product. The backend exposes a modular API for authentication, brand onboarding, asset ingestion, identity analysis, trends, validation, optimization, campaign management, and an AI copilot. The frontend provides an onboarding flow and dashboard views for those capabilities.
• Backend application entry: backend/app/main.py
• API aggregation: backend/app/api/router.py
• Frontend entry/layout: frontend/src/app/page.tsx, frontend/src/app/layout.tsx
API and Request Boundary
FastAPI-style route modules separate HTTP concerns from domain services and schemas. Route-level dependency handling likely centralizes authentication/database access before services execute domain operations.
• API routes: backend/app/api/auth.py, backend/app/api/brands.py, backend/app/api/copilot.py
• Shared dependencies: backend/app/api/deps.py
• Request/response contracts: backend/app/schemas/auth.py, backend/app/schemas/brand.py, backend/app/schemas/copilot.py
Domain Persistence Layer
The backend models the product around users, brands, brand identity, campaigns, trends, validations, optimizations, and asynchronous jobs. Database wiring is isolated from domain models, enabling service-layer orchestration over persisted entities.
• Database setup: backend/app/database.py
• Core entities: backend/app/models/brand.py, backend/app/models/campaign.py, backend/app/models/user.py
• Analysis entities: backend/app/models/identity.py, backend/app/models/trend.py, backend/app/models/validation.py
Service-Oriented Business Workflows
Services represent the primary control-flow boundary between API endpoints and models/external integrations. Brand and identity workflows likely feed later campaign, validation, trend, and optimization workflows; job handling supports work that may not complete within a single request.
• Brand/identity workflows: backend/app/services/brand_service.py, backend/app/services/identity_service.py
• Campaign and optimization workflows: backend/app/services/campaign_service.py, backend/app/services/optimization_service.py
• Job and dashboard aggregation: backend/app/services/job_service.py, backend/app/services/dashboard_service.py
AI Analysis Pipeline
AI capabilities are encapsulated behind analyzers and an orchestration service rather than embedded in routes. The pipeline supports both Groq-backed language analysis and multimodal analysis, with outputs exposed through identity, validation, optimization, and copilot-facing APIs.
• AI integration: backend/app/ai/groq_analyzer.py, backend/app/ai/multimodal_analyzer.py
• Orchestration boundary: backend/app/services/ai_analysis_service.py
• Consumer APIs: backend/app/api/identity.py, backend/app/api/validation.py, backend/app/api/optimization.py
Asset Storage and Runtime Infrastructure
The backend has environment-driven configuration, relational persistence, local brand asset storage, and security utilities. Uploaded or ingested brand materials are stored separately from application code and can be analyzed by the AI pipeline.
• Configuration and environment contract: backend/app/config.py, backend/.env.example
• Local asset storage: backend/storage/brands
• Security/storage utilities: backend/app/utils/security.py, backend/app/utils/storage.py
• Python runtime dependencies: backend/requirements.txt
Frontend Dashboard Composition
The Next.js frontend uses a dashboard client shell with feature-specific views. The UI maps directly to backend product domains: asset ingestion, brand identity, layered AI analysis, trends, validation, impact simulation/optimization, settings, and copilot interaction.
• Dashboard coordinator: frontend/src/components/dashboard/DashboardClient.tsx
• Analysis views: frontend/src/components/dashboard/BrandIdentityView.tsx, frontend/src/components/dashboard/LayeredAnalysisView.tsx, frontend/src/components/dashboard/ValidationView.tsx
• Decision-support views: frontend/src/components/dashboard/TrendAnalyticsView.tsx, frontend/src/components/dashboard/ImpactSimulationView.tsx, frontend/src/components/dashboard/CopilotView.tsx
Main entry points: brands.py Product routes · brand_service.py Brand & campaign workflows · DashboardClient.tsx Dashboard shell · ai_analysis_service.py AI analysis orchestration
Components 18
Frontend
- App entry & layout
frontend/src/app/page.tsx - Dashboard shell · Composes product-domain views.
frontend/src/components/dashboard/DashboardClient.tsx - Analysis views · Identity, layered analysis, and validation UI.
frontend/src/components/dashboard/BrandIdentityView.tsx - Decision-support views · Trends, impact simulation, and copilot UI.
frontend/src/components/dashboard/TrendAnalyticsView.tsx
Backend API
- Backend application
backend/app/main.py - API router
backend/app/api/router.py - Product routes · Auth, brands, and copilot request boundary.
backend/app/api/brands.py - Shared dependencies · Provides authentication and database access.
backend/app/api/deps.py - API contracts
backend/app/schemas/brand.py
Workflows
- Brand & campaign workflows · Orchestrates brand identity, campaign, and optimization work.
backend/app/services/brand_service.py - Jobs & dashboard aggregation · Coordinates asynchronous work and dashboard data.
backend/app/services/job_service.py
AI Pipeline
- AI analysis orchestration · Makes AI results available to identity, validation, optimization, and copilot flows.
backend/app/services/ai_analysis_service.py - Groq & multimodal analyzers
backend/app/ai/groq_analyzer.py
Data & Storage
- Database setup
backend/app/database.py - Core entities · Users, brands, and campaigns.
backend/app/models/brand.py - Analysis entities · Identity, trend, and validation records.
backend/app/models/identity.py - Brand asset storage · Stores uploaded and ingested brand materials.
backend/storage/brands - Storage & security utilities
backend/app/utils/storage.py
Connections 21
- App entry & layout → Dashboard shell: renders
- Dashboard shell → Analysis views: hosts
- Dashboard shell → Decision-support views: hosts
- Dashboard shell → API router: API requests
- Backend application → API router: mounts
- API router → Product routes: dispatches
- Product routes → Shared dependencies: uses
- Product routes → API contracts: validates with
- Product routes → Brand & campaign workflows: invokes
- Product routes → AI analysis orchestration: analysis endpoints
- Brand & campaign workflows → Jobs & dashboard aggregation: schedules & aggregates
- Brand & campaign workflows → Core entities: manages
- Brand & campaign workflows → Analysis entities: produces
- Brand & campaign workflows → Brand asset storage: ingests assets
- Jobs & dashboard aggregation → Database setup: persists jobs
- AI analysis orchestration → Groq & multimodal analyzers: orchestrates
- AI analysis orchestration → Analysis entities: stores results
- AI analysis orchestration → Brand asset storage: analyzes materials
- Storage & security utilities → Brand asset storage: reads & writes
- Core entities → Database setup: mapped to
- Analysis entities → Database setup: mapped to