Skip to content

sayeedjoy/factdrop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

173 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FactDrop

FactDrop

Next.js React TypeScript tRPC TanStack Query PostgreSQL Drizzle Better Auth Tailwind CSS pnpm

FactDrop is an AI-powered fact-checking engine designed to make claim verification faster, more accessible, and more scalable. Instead of relying solely on manual fact-checking workflows, FactDrop combines large language models, web intelligence, fact-check databases, and source credibility analysis to automate much of the verification process.

FactDrop product interface

Stack

  • Framework: Next.js 16, React 19, TypeScript 6
  • AI: Vercel AI SDK, Anthropic, OpenAI, Google, xAI, Vercel AI Gateway, MCP
  • API and data: tRPC, TanStack Query, Drizzle ORM, PostgreSQL, Zod
  • Auth and UI: Better Auth, Tailwind CSS, Radix UI, Zustand, next-intl
  • Search and media: Tavily, Exa, Firecrawl, Parallel, Vercel Blob, Cloudinary
  • Editing and visualization: Lexical, CodeMirror, Recharts, ECharts
  • Tooling and observability: Ultracite, Playwright, Vitest, Evalite, Langfuse, OpenTelemetry, Pino

Quick Start

pnpm install
cp .env.example .env.local
pnpm check-env
pnpm db:migrate
pnpm dev

Dev server runs at http://localhost:3000.

Dev login shortcut (development only): GET /api/dev-login

Scripts

pnpm dev                  # Start dev server (runs check-env + DB branch resolution first)
pnpm lint                 # Biome via ultracite
pnpm format               # Biome format (auto-fix)
pnpm test:unit            # Vitest only (needs local Postgres)
pnpm test:e2e             # Playwright only (uses .env.local)
pnpm test                 # E2E + unit
pnpm test:types           # Next typegen + full type-check
pnpm build                # Production build (prebuild runs check-env)
pnpm check-env            # Validate required env vars

Configuration

chat.config.ts is the single source of truth for feature switches and model/gateway behavior.

Flow:

chat.config.ts -> lib/config-schema.ts -> lib/config.ts

Use this to configure:

  • Gateway selection
  • Enabled models and defaults
  • Tool toggles (MCP, search, URL fetch, code execution, docs, research)
  • Credit and rate-limit behavior

Database Notes

  • Schema: lib/db/schema.ts
  • Migrations: lib/db/migrations/
  • Production migration runner: lib/db/migrate.ts (runs when VERCEL_ENV=production)
  • Database connection: set DATABASE_URL to your PostgreSQL instance

Architecture Notes

  • Most product routes live under app/workspace/*
  • Legacy route aliases redirect to workspace routes via next.config.ts
  • lib/db/queries.ts is server-only
  • tRPC root router: trpc/routers/_app.ts
  • Prefer protectedProcedure for authenticated endpoints
  • Lazy prefetch pattern: call prefetchQuery (without await) in Server Components and hydrate on client

Verification Dataflow

flowchart TD
    A([User Query]) --> B{Image attached?}
    B -- Yes --> C[Extract claim from image<br>OCR or describe via vision model]
    B -- No --> D[Split into claims<br>LLM claim-splitter]
    C --> D
    D --> E{Single or multi?}
    E -- Single --> F[Run pipeline once]
    E -- Multi --> G[Run pipeline per sub-claim<br>in parallel via same pipeline]
    F --> H
    G --> H

    subgraph PIPE [Per-claim pipeline]
      H{Bangla?} -- Yes --> I[Translate to English<br>Add English query]
      H -- No --> J[Run in parallel via Promise.all]
      I --> J
      J --> K[Web search<br>Tavily + Exa + Parallel + MCP<br>Concurrent and merged]
      J --> L[Google Fact Check API]
      K --> M{Results empty?}
      M -- Yes --> N[Firecrawl fallback search]
      M -- No --> O[Trust-rank sources<br>SourceCheck MCP: IFFY + IFCN + GDI + internal rules]
      N --> O
      O --> P[LLM final verdict<br>Rating + note]
      L --> P
    end

    P --> Q([Output<br>Rating, note, ranked sources])
Loading

Testing

  • Unit tests: pnpm test:unit (Vitest)
  • E2E tests: pnpm test:e2e (Playwright projects: chat, reasoning, artifacts, dashboard)
  • Types: pnpm test:types

Package Manager

Use pnpm only.

License

Apache-2.0