โ† Back to overview

Tech Stack

๐Ÿ› ๏ธ
Multi-cloud production stack. Web apps on AWS Amplify, core APIs on DigitalOcean App Platform, async processing on AWS Lambda + SQS, integration and AI services on Google Cloud Run. Main data infrastructure EU-hosted.

Architecture overview

The platform is built primarily in Python and TypeScript. Frontends use Next.js / React. Backend APIs and automation services are Python-based. The AI Support Bot uses FastAPI and LangGraph.

Multi-cloud is intentional โ€” best-of-breed services per layer (AWS for static hosting + storage, DigitalOcean for managed APIs, GCP for AI / integration cloud and vector search).

Backend & infrastructure

Languages and frameworks

ComponentStack
Admin web (adm.herocontent.ai)TypeScript, React, Next.js, Chakra UI, TanStack Query, Firebase client
Client web (r.herocontent.ai)TypeScript, React, Next.js, Chakra UI, i18next, TanStack Query, Firebase client
Admin APIPython 3.10, aiohttp
Client APIPython, aiohttp
Background processorPython 3.10, AWS Lambda
Integrations APIPython 3.10, aiohttp, Google Cloud Run
AI Support BotPython 3.11+, FastAPI, LangGraph / LangChain

Databases & storage

StoreRole
MySQL on AWS RDSMain operational database โ€” restaurants, content, payments, Meta tokens, WhatsApp logs, social metrics
AWS S3Media / object storage โ€” gallery photos, generated posts/stories/reels, WhatsApp media, temporary AI outputs
Google Cloud SQL PostgreSQL + pgvectorSemantic image search vector index + AI Support Bot state and vector storage
Google Memorystore ValkeyAI Support Bot coordination โ€” locks, timers, short-lived memory / dedup
PostHog EULead lifecycle analytics

Hosting & runtime

ComponentHosting
Client / admin webAWS Amplify
Client / admin APIsDigitalOcean App Platform
Content processorAWS Lambda + SQS + EventBridge
Integrations APIGoogle Cloud Run, europe-west3 (Frankfurt) โ€” min 1 / max 10 instances
AI Support BotGoogle Cloud Run, europe-west1 โ€” min 1 / max 3 instances
Main DBAWS RDS MySQL, eu-central-1
AI Support DBGoogle Cloud SQL PostgreSQL 18
Vector searchGoogle Cloud SQL PostgreSQL + pgvector

AI stack by task

Text generation

  • OpenAI GPT-5.4 / GPT-5.4-mini for content / context analysis, USP generation, image rules parsing, structured extraction, and visual selection workflows
  • OpenAI Responses API with web search for USP generation
  • GMI Cloud proxy as primary proxy / failover layer for OpenAI text/vision calls
  • AI Support Bot: Gemini 3.1 Pro Preview as primary, OpenAI GPT-5.2 as fallback
Multi-provider LLM stack with provider-abstracted architecture and fallback paths.

Image generation / editing

  • Gemini 3 Pro Image Preview via Google Vertex AI / AI Studio
  • OpenRouter as paid fallback for Gemini image generation/editing
  • SeedDream v4.5 via WaveSpeed for image editing/generation templates
  • FLUX Kontext Max via WaveSpeed for specific image editing contexts

Image enhancement

  • ClaidAI for real client photos in posts/stories and publishing safety checks
  • Cloudinary as fallback for enhancement / resizing
  • Local Pillow processing for AI-generated grid stylization (cost-optimized โ€” avoids ClaidAI fees where no measurable quality gain)

Image search & selection

  • Semantic image search using Google multimodalembedding@001 + Cloud SQL PostgreSQL + pgvector
  • Restaurant-scoped image metadata: AI alt text, source, quality score, risk score, season, image type, vector embeddings
  • Image Rules Engine parses client directives via GPT-5.4-mini, then applies SQL source filters + AI visual / content rules
Proprietary restaurant image search layer indexes photos with multimodal embeddings and applies restaurant-specific business rules to choose safe, relevant assets for content generation.

Video / reels

  • Meta publishing pipeline supports Instagram + Facebook reels and video stories via Meta Graph API video container / upload flows
  • Creatomate for older / template generation paths
  • Automated creative generation today is primarily image / static-content focused

Fine-tuning, RAG, agents

  • No fine-tuning currently required โ€” advantage comes from orchestration, proprietary client context, retrieval, and human-in-the-loop agent workflows
  • Retrieval systems: semantic image search over restaurant galleries, AI Support Bot memory / context retrieval, per-restaurant business context and client learnings
  • Agents: AI Support Bot (LangGraph), Client Context Analyzer, Image Rules Engine, USP / handover automations

Integrations

WhatsApp

  • Provider: Whapi.cloud (Twilio previously used, deprecated due to no group-messaging support)
  • Main company number + Marketa bot identity use separate Whapi channels
  • Multiple webhooks per number: admin API (logging / media processing) + AI Support Bot (response generation)
  • AI responses are never auto-sent. All AI-generated client replies require manager approval in Telegram before send
  • Outbound automated messages centralized through AI Support Bot outbound layer for consistent sender identity

Meta

  • Meta app status: Live ยท Business ยท Business Verified ยท Access Verified
  • Meta Graph API used for: Instagram + Facebook posts / stories / reels publishing, social metrics / insights, ads analytics, campaign creation MVP
  • OAuth / token-based access โ€” Facebook / Instagram passwords are not stored
  • Custom client onboarding flow replaces Leadsie-style partner-access flow (stores connection audit data)
  • Admin OAuth includes ads scopes (ads_management, ads_read)

Other

  • Stripe โ€” checkout + subscription billing
  • Planfix โ€” CRM (linked to restaurant records via task references)
  • Google โ€” Maps / Business Profile data ingestion, Vertex AI, Cloud Run, Cloud SQL

Security

Authentication

  • Client / admin apps use Firebase authentication
  • API requests include session / user headers + API access token
  • Integrations API uses app-level auth: X-CRM-Token, X-Access-Token, Stripe signature verification, Cloud Tasks secret, Telegram webhook secret (per endpoint)
  • Invalid auth on integrations endpoints returns 404 to reduce endpoint discovery
  • Meta accounts use OAuth / token flows โ€” no Facebook / Instagram passwords are stored
  • Meta tokens stored server-side, used for publishing

Secrets management

  • Cloud Run services use Google Secret Manager for sensitive environment variables
  • Processor uses AWS Secrets Manager for Google service account credentials in production
  • Local .env files for development only

Data residency

Major production data infrastructure is EU-hosted:

  • AWS RDS, S3, Lambda in EU regions (Frankfurt eu-central-1)
  • GCP Cloud Run in europe-west1 and europe-west3
  • PostHog EU host

Operational monitoring

  • Google Cloud Logging โ€” Cloud Run logs
  • AWS CloudWatch โ€” Lambda logs
  • AWS Amplify โ€” web app deployment/build logs
  • DigitalOcean App Platform โ€” main API logs
  • Telegram alerts โ€” failures, auth issues, webhook problems, payments, activation, invoicing, processing errors
  • Cloud Build CI/CD health checks for AI Support Bot and integrations service

Per-restaurant data architecture

The platform stores a restaurant-specific operating profile:

  • Photos (gallery from Google Maps, website, admin / client uploads, WhatsApp)
  • AI image metadata: alt text, quality score, risk score, season, image type, source
  • Generated content (posts, stories, reels, approval states, publish states)
  • Brand / style data: colors, fonts, AI style selections, template preferences
  • Client context profile: tone of voice, content directives, custom rules, image selector rules, USP, handover notes
  • Meta OAuth / page / Instagram tokens + connection audit events
  • WhatsApp chat mapping + message logs
  • Social performance metrics: IG / FB account metrics, media insights, ads data snapshots
  • Payment + billing history (Stripe checkout / subscription events)

This per-restaurant context is consumed by AI generation, human review, publishing, and customer support workflows.

Technical moat

  1. Vertical, end-to-end restaurant SMM operating system โ€” onboarding, CRM, WhatsApp, media ingestion, AI generation, approval workflows, Meta publishing, billing, performance reporting in one integrated system
  2. Proprietary per-restaurant data layer โ€” accumulating photos, brand voice, content rules, WhatsApp history, social metrics, approval history that improves future content generation and support workflows
  3. Productionized AI media pipeline โ€” multi-provider AI image pipeline, semantic image search, image rules enforcement, automated enhancement, human review, direct Meta publishing. Much harder to replicate than a generic prompt wrapper
  4. Human-in-the-loop customer support automation โ€” AI Support Bot handles WhatsApp intake, stage-specific reasoning, CRM tools, manager approval in Telegram, automation without losing quality control
  5. Built-in Meta onboarding & publishing infrastructure โ€” proprietary client onboarding flow replaces third-party tools (Leadsie-style), with diagnostics around client page / Instagram connection state