Skip to content
Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

60 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ•”β• β•šβ•β• β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β•β•β•šβ•β•β•

✍️ ParaFlow AI β€” Writing Intelligence Platform Seven engines, one writing assistant.

Frontend Backend LLM License

ParaFlow AI is a full-stack writing-intelligence SaaS: a Next.js frontend, a FastAPI backend, and seven prompt-engineered/rule-based AI writing tools (paraphrase, humanize, detect, grammar, summarize, translate, SEO) processed synchronously per-request through a single Gemini-backed LLM service, with Supabase for auth/persistence and Stripe for billing. (Celery/Redis are configured in the repo but not currently wired into any live endpoint β€” see the architecture notes below.)


🌍 What It Does

Most writing tools do one thing. ParaFlow AI bundles the full workflow β€” rewrite it, humanize it, check if it reads as AI-written, fix the grammar, summarize it, translate it, optimize it for SEO β€” behind one API, with a per-user "Writing DNA" style profile and a multi-agent "Agent Studio" that iteratively revises text until it hits a target quality score.


⚑ Architecture (as actually wired up)

                    Client Layer
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚   Next.js 15 Web    β”‚
              β”‚   (React 19 / TS)   β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚  Cloudflare CDN /   β”‚   Security & delivery
              β”‚  WAF                β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚  FastAPI  /api/v1   β”‚   API gateway + routing
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  Backend Endpoints                                 β”‚
   β”‚  auth Β· users Β· billing Β· health Β· tools Β·         β”‚
   β”‚  writing_dna Β· agents                              β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  AI Orchestration                                  β”‚
   β”‚  llm_service.generate_dict()                       β”‚
   β”‚       β†’ provider factory β†’ GeminiProvider          β”‚
   β”‚  (called synchronously, in-request β€” see note)    β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  AI Engines (7)                                    β”‚
   β”‚  Paraphrase Β· Humanize Β· Detect Β· Grammar Β·        β”‚
   β”‚  Summarize Β· Translate Β· SEO                       β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚  Supabase (client   β”‚   real path: credits, users,
              β”‚  library, not ORM)  β”‚   writing_dna_profiles, etc.
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Note on the whiteboard version: the original hand-drawn diagram sketches a Mobile/Web/Desktop client layer, a "Gen AI Voice" engine, a separate Vector DB, and a "Mem0" memory feeding a "DNA Engine." In the current codebase: only the Next.js web client is implemented; there's no voice/audio engine; and there's no separate vector database or Mem0 β€” the closest thing to the "DNA Engine" is Writing DNA (see below).

Note on the Celery/Redis queue: docker-compose.yml runs a Redis container and a celery_worker service, and workers/celery_app.py defines paraphrase_task, humanize_task, detect_task, and agent_studio_task. However, nothing in the live API code calls .delay() or .apply_async() on any of these tasks β€” every /tools endpoint (tools.py) runs its engine directly and synchronously inside the request handler and returns the result immediately. The Celery tasks would also currently fail if invoked: they import async_session_maker from app.db.database, but that module only defines a stub get_db() that yields None and a no-op init_db() β€” there is no real SQLAlchemy engine or session factory wired up anywhere in the codebase, despite sqlalchemy[asyncio] and asyncpg being in requirements.txt. The actual, working persistence path for users/credits/writing-DNA is the Supabase Python client (db/supabase.py), called directly from the services.


🧠 Core Components

🎨 Frontend β€” frontend/

  • Next.js 15 (App Router) + React 19 + TypeScript
  • Tailwind CSS 4 + shadcn/ui (built on Radix primitives)
  • Zustand for local state, TanStack Query v5 for server state
  • Supabase JS/SSR client for auth
  • React Hook Form + Zod for forms/validation, Framer Motion for animation, Recharts for charts
  • Feature panels: SummarizerPanel, TranslatorPanel, WritingDNAPanel, etc.

βš™οΈ Backend β€” backend/app/

  • FastAPI + Pydantic 2 + pydantic-settings
  • python-jose + passlib[bcrypt] for JWT access/refresh-token auth
  • Real persistence goes through the Supabase Python client (db/supabase.py) β€” sqlalchemy[asyncio]/asyncpg are in requirements.txt but the app's actual DB dependency (db/database.py) is a stub, so no ORM session is wired up in this snapshot
  • Celery 5.4 + Redis are configured (see architecture note above) but no live endpoint currently enqueues a task
  • structlog for structured logging, httpx for outbound calls

🧭 AI Orchestration β€” backend/app/ai/

  • llm_service.py β€” single provider-agnostic entry point for LLM-backed engines
  • providers/factory.py β€” provider abstraction; Gemini is currently the only active provider (gemini-2.5-flash by default), with automatic fallback-chain plumbing in place for future providers
  • Not every engine calls the LLM β€” see the table below. The ones that do build their own system/user prompt; there's no fine-tuning anywhere

πŸ› οΈ AI Engines β€” backend/app/ai/engines/

Engine File How it works
Paraphrase paraphrase_engine.py Gemini (prompt-engineered rewrite by mode/strength)
Humanize humanize_engine.py Gemini (rewrite toward a target AI-detection pass rate)
Grammar grammar_engine.py Gemini (grammar/style correction)
Summarize summarize_engine.py Gemini (condense text)
Translate translate_engine.py Gemini (language translation)
Detect detect_engine.py Rule-based, no LLM call β€” weighted heuristic score from sentence-length uniformity ("perplexity"), variance ("burstiness"), and AI-phrase pattern matching
SEO seo_engine.py Rule-based, no LLM call β€” keyword density, readability, and title-quality heuristics

🧬 Writing DNA β€” services/writing_dna_service.py

Builds a per-user style profile from writing samples. Two versions of this schema exist in the repo and disagree with each other: the Pydantic model in models/models.py defines style_embedding, vocabulary_richness, formality_score, burstiness_score, rhythm_score, structure_score, etc., while the actual writing_dna_profiles table in supabase_migration.sql has profile_data JSONB, dominant_style, tone_analysis JSONB, vocabulary_score, sentence_variation_score, and readability_score β€” no style_embedding column at all. Whichever code path runs against the live Supabase table would need to use the SQL migration's column names.

πŸ€– Agent Studio β€” services/agent_studio_service.py

Runs a multi-agent revision loop over up to 5 named agents (grammar, seo, humanizer, tone, fact_checker), iterating until a target health score is hit or max_iterations is reached. In the current code, grammar calls GrammarEngine, seo calls SEOEngine, and humanizer calls HumanizeEngine β€” tone and fact_checker are no-op stubs that report success without changing the text. Scoring between iterations also comes from HealthScoreService.calculate_score() fed with hardcoded inputs rather than a live re-analysis of the text.

πŸ“Š Health Score β€” services/health_score_service.py

A weighted composite score (grammar 25% Β· readability 20% Β· originality 20% Β· human-likeness 20% Β· SEO 10% Β· tone 5%) exposed via /api/v1/health/score and /api/v1/health/evolution/{job_id}. Note: this is distinct from the plain /api/health liveness check in main.py, and in the current code both health/score and health/evolution return illustrative/hardcoded values rather than a live computation β€” consistent with DEMO_MODE=True in core/config.py, which also lets auth, billing, and writing_dna run without a live Supabase connection for local dev/demos.

πŸ’³ Billing & Access

  • Stripe integration (billing_service.py), real reads/writes go through the Supabase client against the credits table
  • Tier naming is inconsistent across the codebase: the Pydantic SubscriptionTier enum (models/models.py) says Free / Pro / Team, but the subscriptions.plan and users.role check constraints in supabase_migration.sql only allow free / pro / enterprise
  • ToolJob (queued β†’ processing β†’ completed/failed) exists as a Pydantic model and a tool_jobs table, but the live /tools endpoints don't create or update these rows β€” they generate a fresh job_id per response and return the result directly without persisting a job record

πŸ—„οΈ Data β€” Supabase

Tables (per supabase_migration.sql): users, credits, tool_jobs, writing_dna_profiles, subscriptions, api_keys β€” one relational Postgres instance behind Supabase, accessed via the Supabase client library rather than SQLAlchemy. No separate vector database.


πŸš€ Quick Start

Backend

cd backend
python -m venv venv
source venv/bin/activate   # venv\Scripts\activate on Windows
pip install -r requirements.txt
uvicorn app.main:app --reload

Frontend

cd frontend
npm install
npm run dev

Full stack (Docker)

docker-compose up --build

Spins up Postgres, Redis, the FastAPI backend, and a celery_worker service β€” note the worker currently has no task producer feeding it (see the architecture note above), so it will sit idle even when running.

Environment

Copy .env.example β†’ .env in both backend/ and frontend/ and set at minimum: SUPABASE_URL, SUPABASE_KEY, SUPABASE_SERVICE_KEY, GEMINI_API_KEY, plus CELERY_BROKER_URL / CELERY_RESULT_BACKEND (Redis).


πŸ—‚οΈ Project Structure

Paraflow-AI-main/
β”‚
β”œβ”€β”€ frontend/                       ← Next.js 15 app
β”‚   └── src/
β”‚       β”œβ”€β”€ components/features/    ← SummarizerPanel, TranslatorPanel, WritingDNAPanel...
β”‚       β”œβ”€β”€ components/ui/          ← shadcn/ui components
β”‚       β”œβ”€β”€ providers/, stores/, hooks/, lib/
β”‚
β”œβ”€β”€ backend/
β”‚   └── app/
β”‚       β”œβ”€β”€ ai/
β”‚       β”‚   β”œβ”€β”€ llm_service.py
β”‚       β”‚   β”œβ”€β”€ providers/          ← factory.py, base.py, gemini.py
β”‚       β”‚   └── engines/            ← paraphrase, humanize, detect, grammar,
β”‚       β”‚                              summarize, translate, seo
β”‚       β”œβ”€β”€ services/                ← tool, writing_dna, billing,
β”‚       β”‚                              health_score, agent_studio, user
β”‚       β”œβ”€β”€ api/v1/endpoints/        ← auth, users, billing, health, tools,
β”‚       β”‚                              writing_dna, agents
β”‚       β”œβ”€β”€ models/, schemas/, db/, workers/, core/
β”‚
β”œβ”€β”€ scripts/                        ← test_all_endpoints.py, test_nvidia.py
β”œβ”€β”€ tests/
β”œβ”€β”€ docker-compose.yml
└── supabase_migration.sql

πŸ“¦ Key Dependencies

Backend (backend/requirements.txt)

fastapi>=0.115.0
uvicorn[standard]>=0.30.0
pydantic>=2.9.0
pydantic-settings>=2.5.0
sqlalchemy[asyncio]>=2.0.0
asyncpg>=0.29.0
python-jose[cryptography]>=3.3.0
passlib[bcrypt]>=1.7.4
httpx>=0.27.0
celery[redis]>=5.4.0
structlog>=24.4.0
supabase>=2.31.0

(sqlalchemy[asyncio]/asyncpg are listed but there's no wired-up engine or session factory in this snapshot β€” see the architecture notes above. anthropic and openai are also listed but currently unused β€” Gemini is the only wired-up LLM provider.)

Frontend (frontend/package.json)

next@15.5
react@19
typescript@5.6
tailwindcss@4
zustand@5
@tanstack/react-query@5
@supabase/supabase-js
framer-motion
recharts
react-hook-form + zod

πŸ“„ Citation

@misc{paraflowai2026,
  title  = {ParaFlow AI: A Full-Stack Writing Intelligence Platform},
  author = {Mantasha},
  year   = {2026},
  url    = {https://github.com/itimantasha/Paraflow-AI},
  note   = {B.Tech Portfolio Project}
}

Built with ✍️ by Mantasha & Team

B.Tech Β· Full-Stack & AI Engineering

⭐ Star this repo if you found it useful

About

NextGen Paraphraser Project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages