KeryxAI - Pastoral AI Assistant
Overview
KeryxAI is an AI assistant built specifically for Brazilian evangelical leaders - pastors, deacons, and ministry workers who need to produce sermons, Bible studies, devotional content, and small group material every single week. The demand is high and constant, but time is limited. Generic AI tools can generate text, but they often ignore theology, doctrine, and the cultural context of Brazilian churches.
To address this, I built a full SaaS platform where each user signs up, trains the model with their own archive (sermons, studies, devotionals), and then generates content that stays consistent with their doctrine and speaking style. The system combines a React dashboard, a custom Node.js/Fastify API, a RAG pipeline with LangGraph/LangChain, and a credit-based billing flow on top of PostgreSQL + pgvector and Redis.
This is a proprietary project that I built end-to-end: business model, data modeling, AI pipeline design, real-time chat experience, training management UI, credit system, Stripe integration, and all the supporting tools. In production, the platform already serves dozens of leaders, with thousands of credits consumed on real pastoral content generation.
Key Differentiator
The key differentiator of KeryxAI is not “AI-generated sermons” in the abstract, but the way it layers three types of pastoral context: a curated theological dataset, each user’s personal archive (uploaded sermons and studies), and configurable style preferences. The result is that the assistant behaves differently for each pastor, respecting doctrine, vocabulary, and sermon structure they already use in their church.
From an engineering perspective, the project stands out for implementing a LangGraph-based RAG pipeline with pgvector tailored to pastoral content, with separate retrievers for global theology vs. user-specific material, and exposing that as a multi-tenant SaaS API with credit-based billing. For the end user, it feels much closer to a “digital co-pastor” that actually speaks the language of Brazilian churches, instead of just a generic Bible chatbot.
Architecture
- Landing (Next.js 15): Marketing and acquisition layer with SEO-focused pages and Framer Motion animations, deployed on Vercel with conversion tracking.
- App (React 19 + Vite): Main dashboard with real-time chat, conversation history, training management (uploaded documents and sermons), and billing/credits panel.
- TanStack Router/Query: Frontend routing and data-fetching stack, providing cache, mutation, and invalidation organized by resources (chats, trainings, billing).
- API (Fastify 5 + TypeScript): Core REST API exposing authentication, chats, trainings, credits, billing operations, and payment webhooks.
- Drizzle ORM + PostgreSQL: Typed data layer with versioned schemas and migrations, plus pgvector to store and query document embeddings efficiently.
- Redis + BullMQ: Job queue system for async processing of trainings, heavy content generation tasks, and any work that shouldn’t block API requests.
- AI Engine (LangGraph + LangChain): Orchestrates the RAG flow - document chunking, embedding creation, context selection, and final response generation.
- Stripe: Credit-based billing with subscription plans, recurring charges, and webhooks to keep credit balances and subscription status in sync.
Technical Highlights
- Designed and implemented a multi-tenant SaaS API in Fastify 5 with TypeScript and Drizzle, covering authentication, credit-based billing, Stripe webhooks, and strict tenant isolation.
- Built a RAG pipeline with LangGraph, LangChain, and pgvector, splitting the knowledge base into a global theological dataset and per-user archives, with different retrievers and prompts.
- Implemented an async training pipeline where users upload sermons and studies that are normalized, chunked, embedded, and indexed via BullMQ queues backed by Redis.
- Developed a React 19 dashboard using TanStack Router/Query and Socket.IO for real-time chat, training management, feedback capture, and credit usage visibility.
- Created a high-performance Next.js 15 landing page with Framer Motion, optimized for SEO and conversion tracking on Vercel.
- Integrated Stripe for subscription and credit billing and AWS SES for reliable transactional email flows around onboarding and usage alerts.