Skip to content

GAURAVSVNIT/Genesis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

84 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

✦ Genesis

A Full-Stack, Agentic AI Content Generation Platform

Powered by Google Gemini Β· Vertex AI Β· LangGraph Β· Next.js 16

FastAPI Next.js Python License: MIT


πŸ“– Overview

Genesis (formerly Verbix AI) is a production-grade, multi-tenant AI content generation platform. It combines a LangGraph multi-agent orchestration graph with a rich suite of intelligence tools β€” trend analysis, SEO optimization, image generation, and social publishing β€” delivered through a modern Next.js frontend and a FastAPI backend.

Users can chat naturally with the AI to produce blog posts, social media content, and images in real time. The system automatically classifies intent, routes to the right AI agent, fetches live trend data, applies guardrails, and streams the result back to the user β€” all in one unified workflow.


πŸš€ Key Features

Feature Description
🧠 Multi-Agent Graph LangGraph-powered orchestration with specialized agents for planning, execution, review, and safety
πŸ’¬ Intent Classification Automatically routes requests to the correct agent (Blog, Image, Social, etc.)
πŸ“ Blog Generation SEO-optimized, long-form articles with readability scoring and keyword analysis
πŸ–ΌοΈ Image Generation Vertex AI Imagen + DALL-E 3 fallback via a structured prompt pipeline
πŸ“ˆ Trend Intelligence Real-time data from Google (Serper), Twitter/X, and Reddit with Redis caching
🎨 Tone Engine 5 configurable tones (Analytical, Opinionated, Critical, Investigative, Contrarian)
πŸ”’ Guardrails Multi-layer content safety (bias detection, harm filtering, factual grounding)
πŸ—‚οΈ Context & Memory Conversation history, RAG with pgvector embeddings, and checkpoint restoration
🌐 Social Publisher OAuth-connected publishing to LinkedIn and Twitter/X
πŸ”‘ Developer Portal API key management, usage analytics, and interactive documentation
πŸ‘€ Guest Mode Full functionality for unauthenticated users with session-based storage
πŸ’Ύ Multi-Tier Caching Upstash Redis (L1) + PostgreSQL prompt cache (L2) with automatic invalidation

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         CLIENT (Browser)                            β”‚
β”‚              Next.js 16 + React 19 + Tailwind CSS v4                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  /home   β”‚  β”‚  / chat  β”‚  β”‚  /auth  (SSR)  β”‚  β”‚ /developer  β”‚   β”‚
β”‚  β”‚ Landing  β”‚  β”‚Interface β”‚  β”‚ Login/Signup   β”‚  β”‚   Portal    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚ HTTPS / REST
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      FastAPI Backend (Python)                        β”‚
β”‚                     host: localhost:8000 / GCP                       β”‚
β”‚                                                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚                    API Layer  (api/v1/*)                        β”‚ β”‚
β”‚  β”‚  /content  /blog  /agent  /classifier  /context  /trends       β”‚ β”‚
β”‚  β”‚  /social  /guardrails  /embeddings  /guest  /advanced          β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                              β”‚                                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚               LangGraph Agent Orchestration (graph/)           β”‚ β”‚
β”‚  β”‚                                                                β”‚ β”‚
β”‚  β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚ β”‚
β”‚  β”‚   β”‚ Planner β”‚β†’ β”‚Coordinatorβ”‚β†’ β”‚ Executor β”‚β†’ β”‚  Reviewer   β”‚  β”‚ β”‚
β”‚  β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β”‚ β”‚
β”‚  β”‚                                                     β”‚         β”‚ β”‚
β”‚  β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”  β”‚ β”‚
β”‚  β”‚   β”‚  Safety Agent  (bias check Β· harm filter Β· grounding)  β”‚  β”‚ β”‚
β”‚  β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                              β”‚                                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚                  Intelligence Modules                          β”‚ β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚ β”‚
β”‚  β”‚  β”‚  Trend     β”‚  β”‚ Tone Enhancerβ”‚  β”‚  SEO Suite          β”‚   β”‚ β”‚
β”‚  β”‚  β”‚  Analyzer  β”‚  β”‚ (5 modes)    β”‚  β”‚  keywordΒ·metaΒ·read  β”‚   β”‚ β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚ β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚ β”‚
β”‚  β”‚  β”‚  Image     β”‚  β”‚   Social     β”‚  β”‚    RAG / Vector      β”‚   β”‚ β”‚
β”‚  β”‚  β”‚  Prompter  β”‚  β”‚  Publisher   β”‚  β”‚    Embeddings        β”‚   β”‚ β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                              β”‚                                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚                    Core Services (core/)                       β”‚ β”‚
β”‚  β”‚  Rate Limiter Β· Response Cache Β· Guardrails Β· LLM Factory      β”‚ β”‚
β”‚  β”‚  Token Counter Β· Logging Β· Supabase Client Β· Upstash Redis     β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚                          β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚  Supabase (PostgreSQL) β”‚   β”‚   Upstash (Redis)   β”‚
         β”‚  + pgvector extension  β”‚   β”‚   L1 Response Cache β”‚
         β”‚  Users Β· Sessions      β”‚   β”‚   Trend Data Cache  β”‚
         β”‚  Conversations Β· Cache β”‚   β”‚   Rate Limit State  β”‚
         β”‚  Embeddings Β· Metrics  β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‚ Project Structure

Genesis/                          # Monorepo root (pnpm workspaces + Turborepo)
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ frontend/                 # Next.js 16 application
β”‚   β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”‚   β”œβ”€β”€ page.tsx          # Root β†’ redirects to /chat
β”‚   β”‚   β”‚   β”œβ”€β”€ home/             # Public landing page
β”‚   β”‚   β”‚   β”œβ”€β”€ chat/             # Main chat interface
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/             # Login / signup / callback pages
β”‚   β”‚   β”‚   β”œβ”€β”€ developer/        # API key mgmt + docs portal
β”‚   β”‚   β”‚   β”œβ”€β”€ settings/         # User preferences
β”‚   β”‚   β”‚   └── api/              # Next.js API routes (proxies)
β”‚   β”‚   β”œβ”€β”€ components/           # Reusable UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ chat-interface.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ sidebar-editor.tsx  # CKEditor 5 rich-text editor
β”‚   β”‚   β”‚   β”œβ”€β”€ message-bubble.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ tone-selector.tsx
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   └── lib/                  # Utilities, hooks, API client
β”‚   β”‚       β”œβ”€β”€ api-client.ts
β”‚   β”‚       β”œβ”€β”€ supabase/         # Supabase SSR helpers
β”‚   β”‚       └── tone-options.ts
β”‚   β”‚
β”‚   └── backend/                  # FastAPI application
β”‚       β”œβ”€β”€ main.py               # App entry point, CORS, router registration
β”‚       β”œβ”€β”€ api/
β”‚       β”‚   └── v1/               # All REST endpoints
β”‚       β”‚       β”œβ”€β”€ content.py    # Primary content generation endpoint
β”‚       β”‚       β”œβ”€β”€ blog.py       # Dedicated blog generation
β”‚       β”‚       β”œβ”€β”€ agent.py      # Agent graph invocation
β”‚       β”‚       β”œβ”€β”€ classifier.py # Intent classification
β”‚       β”‚       β”œβ”€β”€ context.py    # Conversation context & checkpoints
β”‚       β”‚       β”œβ”€β”€ guest.py      # Guest session management
β”‚       β”‚       β”œβ”€β”€ social.py     # Social media OAuth + posting
β”‚       β”‚       β”œβ”€β”€ guardrails.py # Content safety checks
β”‚       β”‚       β”œβ”€β”€ embeddings.py # Vector embedding endpoints
β”‚       β”‚       └── advanced.py   # Power-user generation features
β”‚       β”œβ”€β”€ agents/               # LangGraph node implementations
β”‚       β”‚   β”œβ”€β”€ orchestrator.py   # Graph assembly & routing
β”‚       β”‚   β”œβ”€β”€ planner.py        # Task decomposition
β”‚       β”‚   β”œβ”€β”€ coordinator.py    # Agent coordination logic
β”‚       β”‚   β”œβ”€β”€ executor.py       # LLM call execution
β”‚       β”‚   β”œβ”€β”€ reviewer.py       # Output quality review
β”‚       β”‚   β”œβ”€β”€ blog_writer.py    # Blog-specific writer agent
β”‚       β”‚   └── safety.py         # Safety/guardrail agent
β”‚       β”œβ”€β”€ graph/                # LangGraph state & pipeline
β”‚       β”œβ”€β”€ intelligence/         # AI intelligence modules
β”‚       β”‚   β”œβ”€β”€ trend_collector.py   # Multi-source trend fetching
β”‚       β”‚   β”œβ”€β”€ trend_analyzer.py    # Scoring & insight engine
β”‚       β”‚   β”œβ”€β”€ tone_enhancer.py     # Prompt tone injection
β”‚       β”‚   β”œβ”€β”€ image_prompter.py    # Image prompt builder
β”‚       β”‚   β”œβ”€β”€ image_collector.py   # Image artifact storage
β”‚       β”‚   β”œβ”€β”€ social_publisher.py  # LinkedIn/Twitter publisher
β”‚       β”‚   └── seo/                 # Full SEO optimization suite
β”‚       β”‚       β”œβ”€β”€ optimizer.py
β”‚       β”‚       β”œβ”€β”€ keyword_analyzer.py
β”‚       β”‚       β”œβ”€β”€ readability_analyzer.py
β”‚       β”‚       β”œβ”€β”€ metadata_generator.py
β”‚       β”‚       β”œβ”€β”€ hashtag_optimizer.py
β”‚       β”‚       └── suggestions.py
β”‚       β”œβ”€β”€ core/                 # Shared services
β”‚       β”‚   β”œβ”€β”€ config.py         # Pydantic settings (env vars)
β”‚       β”‚   β”œβ”€β”€ guardrails.py     # Multi-layer content safety
β”‚       β”‚   β”œβ”€β”€ embeddings.py     # Sentence-transformer embeddings
β”‚       β”‚   β”œβ”€β”€ rag_service.py    # Retrieval-augmented generation
β”‚       β”‚   β”œβ”€β”€ rate_limiter.py   # Per-user/guest rate limiting
β”‚       β”‚   β”œβ”€β”€ response_cache.py # Response caching logic
β”‚       β”‚   β”œβ”€β”€ llm_factory.py    # Model selection (Gemini/GPT/Groq)
β”‚       β”‚   β”œβ”€β”€ token_counter.py  # Token usage tracking
β”‚       β”‚   β”œβ”€β”€ chatgpt_cache.py  # Prompt-level cache (L2)
β”‚       β”‚   β”œβ”€β”€ vertex_ai.py      # Vertex AI client wrapper
β”‚       β”‚   └── upstash_redis.py  # Redis client singleton
β”‚       └── database/             # DB models & migrations (Alembic)
β”‚
β”œβ”€β”€ packages/                     # Shared packages (Turborepo)
β”œβ”€β”€ turbo.json                    # Turborepo pipeline config
β”œβ”€β”€ pnpm-workspace.yaml
└── package.json

πŸ”„ Request Lifecycle

User types a message in the chat interface
            β”‚
            β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ Frontend ─────────────────────────────┐
 β”‚  1. Captures prompt + conversation history     β”‚
 β”‚  2. Attaches tone, format, and safety options  β”‚
 β”‚  3. POSTs to /v1/content (or /v1/agent)        β”‚
 └───────────────────────────────────────────────-β”˜
            β”‚
            β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ Backend: API Layer ────────────────────┐
 β”‚  1. Rate limit check (per user/guest/IP)        β”‚
 β”‚  2. Hash prompt β†’ check L1 Redis cache          β”‚
 β”‚     β”œβ”€β”€ HIT  β†’ return cached response           β”‚
 β”‚     └── MISS β†’ continue                         β”‚
 β”‚  3. Check L2 PostgreSQL prompt cache            β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ Intent Classifier ─────────────────────┐
 β”‚  Classifies intent into one of:                 β”‚
 β”‚  blog | image | social | general | research     β”‚
 β”‚  Extracts: topic, refined_query                 β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ Agent Graph (LangGraph) ───────────────┐
 β”‚  Planner  β†’  Coordinator  β†’  Executor           β”‚
 β”‚    ↑              β”‚               β”‚             β”‚
 β”‚    β”‚         Intelligence    LLM Factory        β”‚
 β”‚    β”‚         - Trend Data    (Gemini/GPT/Groq)  β”‚
 β”‚    β”‚         - Tone Prompt                      β”‚
 β”‚    β”‚         - SEO Context                      β”‚
 β”‚    └────────── Reviewer ◄──────────────────     β”‚
 β”‚                   β”‚                             β”‚
 β”‚               Safety Agent                      β”‚
 β”‚         (bias check Β· harm filter)              β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ Post-Processing ───────────────────────┐
 β”‚  1. Calculate metadata (word count, sections)   β”‚
 β”‚  2. Compute uniqueness score (embedding diff)   β”‚
 β”‚  3. Store response to DB + update cache         β”‚
 β”‚  4. Log token usage & metrics                   β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
      Response streamed to frontend
      with content + metadata badges

🧠 Agent Architecture

The backend uses LangGraph to assemble a directed graph of specialized agents. Each node handles a distinct phase of content creation:

Agent File Responsibility
Planner agents/planner.py Decomposes user intent into sub-tasks
Coordinator agents/coordinator.py Routes sub-tasks to appropriate executors
Executor agents/executor.py Performs the actual LLM generation call
Blog Writer agents/blog_writer.py Specialized node for long-form blog drafts
Reviewer agents/reviewer.py Scores output quality; triggers re-generation if below threshold
Safety agents/safety.py Applies guardrails; blocks or modifies harmful output
Orchestrator agents/orchestrator.py Assembles the graph and manages state transitions

πŸ“‘ API Reference

All endpoints are prefixed with the base URL of the backend server.

Content Generation

Method Path Description
POST /v1/content/generate Primary generation endpoint (text, tones, formats)
POST /v1/blog/generate Dedicated long-form blog generation
POST /v1/agent/invoke Direct LangGraph agent graph invocation
POST /v1/advanced/generate Advanced generation with fine-grained parameters

Intelligence

Method Path Description
POST /v1/trends/analyze Analyze keywords across Google, Twitter, Reddit
POST /v1/trends/generate-context Generate trend context for the AI writer
GET /v1/trends/top Fetch current top trending topics
POST /v1/classifier/classify Classify prompt intent and extract topic

Context & Memory

Method Path Description
POST /v1/context/save Save conversation checkpoint
GET /v1/context/restore/{session_id} Restore context from a checkpoint
GET /v1/context/history Retrieve paginated conversation history
POST /v1/embeddings/store Store content as a vector embedding
POST /v1/embeddings/search Semantic search over stored embeddings

Social & Publishing

Method Path Description
GET /v1/social/auth/linkedin OAuth flow for LinkedIn
GET /v1/social/auth/twitter OAuth flow for Twitter/X
POST /v1/social/publish/linkedin Publish content to LinkedIn
POST /v1/social/publish/twitter Post a tweet or thread

Safety & Guardrails

Method Path Description
POST /v1/guardrails/check Run multi-layer safety analysis on content

Guest & User Sessions

Method Path Description
POST /v1/guest/session Create a guest session
GET /v1/guest/history/{guest_id} Fetch guest conversation history
POST /v1/guest/migrate Migrate guest data to authenticated user

Health

Method Path Description
GET /health Basic liveness check
GET /v1/health/redis Redis connectivity check

🎨 Tone Engine

The Tone Enhancer injects personality into every generation. Five tones are available:

Tone System Persona Best For
analytical Thoughtful analyst & critic Deep dives, technical research
opinionated Bold commentator with strong views Opinion pieces, editorials
critical Discerning critic Reviews, evaluations
investigative Investigative journalist ExposΓ©s, investigative pieces
contrarian Thoughtful contrarian Counter-narratives, debate prep

Each tone can be augmented with optional enrichment sections: Critical Analysis, Alternative Perspectives, Real-World Implications, and Questions to Consider.


πŸ“ˆ Trend Intelligence Pipeline

User Prompt
    β”‚
    β–Ό
Keyword Extraction
    β”‚
    β”œβ”€β”€β–Ί Google (Serper API) ──┐
    β”œβ”€β”€β–Ί Twitter/X API ───────────► Aggregator ──► Redis Cache (30 min TTL)
    └──► Reddit API β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
                                         β–Ό
                                  Trend Analyzer
                                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                  β”‚  Scoring (0–100):                   β”‚
                                  β”‚  β€’ Keyword Match      40%           β”‚
                                  β”‚  β€’ Source Credibility  20%          β”‚
                                  β”‚  β€’ Engagement (log)   20%           β”‚
                                  β”‚  β€’ Recency            10%           β”‚
                                  β”‚  β€’ Content Quality    10%           β”‚
                                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                         β”‚
                                         β–Ό
                                  AI Content Context
                                  (target audience Β· trending angles Β· keywords)

πŸ” SEO Suite

The intelligence/seo/ module provides a complete pipeline for content optimization:

  • keyword_analyzer.py β€” Extracts primary and secondary keywords, scores density
  • readability_analyzer.py β€” Flesch-Kincaid, sentence length, complexity metrics
  • metadata_generator.py β€” Auto-generates title tags, meta descriptions, Open Graph data
  • hashtag_optimizer.py β€” Suggests platform-specific hashtags for social posts
  • suggestions.py β€” End-to-end improvement recommendations
  • optimizer.py β€” Orchestrates the full SEO pass over generated content

πŸ”’ Content Guardrails

Every piece of generated content passes through a multi-layer safety pipeline:

  1. Bias Detection β€” Scans for demographic, political, and factual biases
  2. Harm Filtering β€” Blocks NSFW, violent, or dangerous content
  3. Factual Grounding β€” Cross-references claims with trusted sources where possible
  4. Rate Limiting β€” Per-user and per-IP limits enforced via Redis

πŸ’Ύ Caching Architecture

Layer Technology TTL Scope
L1 Upstash Redis 30 min (trends) / configurable Trend data, rate limit counters
L2 PostgreSQL (prompt_cache table) Persistent Identical prompt responses
Embeddings pgvector Persistent Semantic search index

Cache keys are generated from sorted keyword lists and prompt hashes to maximize hit rates across similar queries.


βš™οΈ Getting Started

Prerequisites

Requirement Version
Node.js 18+
pnpm 8+
Python 3.10+
Supabase project β€”
Google Cloud project (GCP) For Vertex AI

1. Clone the Repository

git clone https://github.com/yourusername/genesis.git
cd genesis

2. Backend Setup

cd apps/backend

# Create and activate virtual environment
python -m venv .venv
.venv\Scripts\activate          # Windows
# source .venv/bin/activate     # macOS/Linux

# Install dependencies
pip install -r requirements.txt

# Configure environment variables
cp .env.example .env
# Edit .env with your keys (see Environment Variables section below)

# Start the development server
uvicorn main:app --reload --port 8000

3. Frontend Setup

cd apps/frontend

# Install dependencies
pnpm install

# Configure environment variables
cp .env.example .env.local
# Add your Supabase URL and Anon Key

# Start the development server
pnpm dev

Frontend runs on http://localhost:3000 Β· Backend runs on http://localhost:8000

4. Run the Full Monorepo (Turborepo)

# From the project root
pnpm install
pnpm dev          # Starts both frontend and backend concurrently

πŸ”‘ Environment Variables

Backend (apps/backend/.env)

# ── AI Models ───────────────────────────────────────────────
OPENAI_API_KEY=sk-...
GROQ_API_KEY=gsk_...

# ── Google Cloud / Vertex AI ────────────────────────────────
GCP_PROJECT_ID=your-gcp-project-id
GOOGLE_APPLICATION_CREDENTIALS=./your-service-account.json

# ── Supabase ────────────────────────────────────────────────
SUPABASE_URL=https://xxxx.supabase.co
SUPABASE_SERVICE_ROLE_KEY=eyJ...

# ── Upstash Redis ───────────────────────────────────────────
UPSTASH_REDIS_REST_URL=https://xxxx.upstash.io
UPSTASH_REDIS_REST_TOKEN=AXxx...

# ── Trend Intelligence ──────────────────────────────────────
SERPER_API_KEY=your_serper_key          # Google Trends via Serper.dev
TWITTER_BEARER_TOKEN=AAAA...            # Twitter API v2
REDDIT_CLIENT_ID=your_reddit_client_id
REDDIT_CLIENT_SECRET=your_reddit_secret
REDDIT_USER_AGENT=Genesis/1.0

# ── Social Publishing ───────────────────────────────────────
LINKEDIN_CLIENT_ID=...
LINKEDIN_CLIENT_SECRET=...
TWITTER_CLIENT_ID=...
TWITTER_CLIENT_SECRET=...

# ── CORS ────────────────────────────────────────────────────
ALLOWED_ORIGINS=https://your-frontend-domain.vercel.app

Frontend (apps/frontend/.env.local)

NEXT_PUBLIC_SUPABASE_URL=https://xxxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ...
NEXT_PUBLIC_API_URL=http://localhost:8000

🧱 Technology Stack

Frontend

Library Version Purpose
Next.js 16 React framework (App Router + RSC)
React 19 UI rendering
Tailwind CSS v4 Utility-first styling
Shadcn/UI + Radix UI latest Accessible component library
CKEditor 5 47 Rich-text sidebar editor
Supabase JS 2 Auth + realtime DB client
react-markdown 10 Markdown rendering in chat
Sonner 2 Toast notifications
Lucide React latest Icon system

Backend

Library Version Purpose
FastAPI 0.124+ Async REST API framework
LangChain 0.3+ LLM abstraction layer
LangGraph 0.2+ Multi-agent orchestration graph
Google Generative AI latest Gemini model access
Vertex AI 1.35+ Imagen image generation
LangChain OpenAI 0.1+ GPT-4o integration
LangChain Groq 0.1+ Llama 3.3 via Groq
SQLAlchemy + Alembic 2.0+ ORM and DB migrations
pgvector 0.2+ Vector similarity search
Supabase Python 2.4+ Supabase DB/Auth client
sentence-transformers 3.0+ Local text embeddings
Upstash Redis latest Serverless Redis caching
PRAW 7.7+ Reddit API wrapper
Tweepy 4.14+ Twitter API client
textstat 0.7+ Readability scoring
httpx 0.27+ Async HTTP for trend fetching
BeautifulSoup4 4.12+ Web scraping

🚒 Deployment

Vercel (Frontend)

The frontend is configured for zero-config Vercel deployment via vercel.json.

vercel --prod

Google Cloud Platform (Backend)

A Dockerfile and deploy_gcp.ps1 script are included for Cloud Run deployment.

# Build and push Docker image
gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/genesis-backend

# Deploy to Cloud Run
gcloud run deploy genesis-backend \
  --image gcr.io/YOUR_PROJECT_ID/genesis-backend \
  --platform managed \
  --region us-central1 \
  --allow-unauthenticated

See apps/backend/DEPLOYMENT.md for detailed GCP instructions.


🀝 Contributing

  1. Fork the Project
  2. Create a Feature Branch: git checkout -b feature/YourFeature
  3. Commit your Changes: git commit -m 'feat: Add YourFeature'
  4. Push to the Branch: git push origin feature/YourFeature
  5. Open a Pull Request

πŸ“„ License

Distributed under the MIT License. See LICENSE for details.


Built with ❀️ · Genesis AI Platform

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors