How michniks2001/mark-ai works
Project type and purpose
• This is a full-stack web application called MarkAI, an AI-powered marketing assistant.
• The frontend is a React/Vite/Tailwind single-page app for user interactions (landing page, pitch deck generator).
• The backend is a Python service (likely FastAPI, given the routers folder and main.py) that exposes endpoints for market analysis and pitch-deck generation. It orchestrates AI/vector operations, external data fetches, caching, and business logic.
File structure
Top-level:
• .windsurf/ – internal rule docs (irrelevant for runtime)
• backend/ – Python API service
• frontend/ – React SPA
• Scripts & guides (start-dev.sh, SETUP.md, guides)
backend/
• main.py – entrypoint, server setup
• routers/ – API endpoints (github.py suggests a GitHub integration)
• market_analysis/ – chunks: analyzer, cache, Google search wrapper
• pitch_deck/ – generator module
• services/ – high-level orchestrators (pitch_deck_service.py, sector_analyzer.py)
• vectorstore/ – chunking, embeddings, indexing, retrieval, storage
• tools/ – misc utility functions
frontend/
• src/components/ – React components, UI library under ui/
• src/lib/api.js – client-side API calls
• vite.config.js, tailwind.config.js – build configuration
README for additional insights
• README simply states “Your personal AI-powered marketing assistant!” – confirms purpose but no architecture hints.
• The existence of MARKET_ANALYSIS_GUIDE.md and PITCH_DECK_GUIDE.md suggests the two core user flows.
a. Main components
1. Client (Browser) – React SPA
2. API Gateway / Web Server – Python main.py (FastAPI/Uvicorn)
3. Routers – HTTP endpoints
4. Service Layer – sector_analyzer, pitch_deck_service
5. Market Analysis Module – analyzer.py, google_market_search.py, cache.py
6. Pitch Deck Generator – generator.py
7. Vector Store – chunker, embeddings, indexer, retrieval, persistent store
8. External Services – Google Search API, OpenAI or embedding provider, GitHub integration
9. Data Store / Cache – in-memory or Redis (as implied by cache.py)
b. Relationships & interactions
• Browser > invokes REST calls via api.js to API Gateway
• Requests hit specific Router (e.g., /api/market-analysis)
• Router delegates to Service Layer, which calls either the Market Analysis Module or Pitch Deck Generator
• Market Analysis Module may fetch external data (Google Search), store results in Cache, process text, then index embeddings into Vector Store
• Pitch Deck Generator uses Vector Store retrieval + templates to build a deck, possibly invoking AI embeddings or completions
• Results are returned up the stack to the frontend, which renders them in UI components
• GitHub Router can push or fetch user repos if integrating with a user’s code
c. Architectural patterns & principles
• Layered Architecture: API layer → Service layer → Domain modules → Data / external integrations
• Separation of Concerns: Routers only handle HTTP; services orchestrate business logic; vectorstore is a self-contained sub-system
• Modularity: Each feature (market analysis, pitch deck) lives in its own package
• Extensibility: Tools and services folders can be extended with new AI tasks
d. Key technologies/frameworks
• Backend: Python 3.x, FastAPI (inferred), Uvicorn/Gunicorn, vector database (custom or Pinecone?), Google Search API, OpenAI embeddings
• Frontend: React, Vite, TailwindCSS, custom UI components
• Dev & Deploy: Docker (implied), CI/CD scripts, environment configuration via .env, pyproject.toml, package.json