A Next.js application built with Payload CMS and deployed on Cloudflare Workers. This platform helps discover and connect with Christian business peer advisory groups across the United States.
Note: This can only be deployed on Paid Workers right now due to size limits.
Kingdom1820 provides a searchable directory of faith-based professional development programs, with an emphasis on Christian business peer advisory groups. The platform features automated data collection via AI-powered web scraping and a user-friendly interface for browsing and filtering programs.
- π Advanced Search & Filtering - Comprehensive faceted search with 11 filters including location, meeting format, frequency, length, type, attendance size, religious affiliation, conferences, speakers, and training programs
- π€ AI-Powered Data Extraction - Automated program discovery using Firecrawl's agent endpoint
- π Comprehensive Program Data - Meeting details, contact info, features, and more
- π¨ Professional Design - Clean, responsive interface with indigo (#560591) color scheme
- βοΈ Cloudflare Infrastructure - Deployed on Workers with D1 database and R2 storage
The main collection storing information about faith-based professional programs:
Core Information:
- Name, description
- Religious affiliation (Protestant/Catholic)
- Complete address with geocoded coordinates
Meeting Details:
- Format (In-person, Online, Both)
- Frequency (Weekly, Monthly, Quarterly)
- Length (1-2, 2-4, 4-8 hours)
- Type (Peer group, Forum, Small group)
- Average attendance
Additional Features:
- Conference offerings (None, Annual, Multiple)
- Outside speakers availability
- Education/training programs
Contact Information:
- Email, phone, website
- Source URLs with citations
Manages prompts for the Firecrawl AI agent to extract program data:
- Title - Descriptive name for the prompt
- Prompt - Natural language instructions for data extraction
- Status - Draft or Active
- Max Credits - Optional spending limit per execution
- Version History - Full tracking of prompt iterations
Authentication-enabled collection for admin panel access.
Upload and storage collection for images using R2.
Kingdom1820 uses the Firecrawl SDK (@mendable/firecrawl-js) to autonomously discover and extract program data from across the web.
- Agent Prompts are created in the admin panel with natural language instructions
- The Firecrawl SDK submits the prompt and automatically polls for completion
- The Firecrawl agent autonomously searches the web based on the prompt (no timeout limits)
- Data is extracted and validated against a Zod schema
- Programs are automatically saved as drafts with citations
- Duplicates are intelligently updated based on name, city, and state
Note: The SDK handles all polling and timeout management - jobs run until Firecrawl completes them naturally.
import { runAgentPrompt } from '@/lib/agentPrompts'
// Execute a prompt by ID
const result = await runAgentPrompt(promptId)
// Returns statistics:
// {
// total: 100, // Programs found by agent
// created: 65, // New programs created
// updated: 35, // Existing programs updated
// failed: 0, // Failed saves
// errors: [] // Error details
// }The agent automatically provides citations for all extracted data. Citations are stored in the sourceUrl field as a JSON array:
["https://www.c12group.com/locations", "https://www.example.com/directory"]- Framework: Next.js 15 (App Router)
- CMS: Payload CMS 3.63
- Database: Cloudflare D1 (SQLite)
- Storage: Cloudflare R2
- Deployment: Cloudflare Workers
- Data Extraction: Firecrawl SDK (@mendable/firecrawl-js v4.10.0)
- Validation: Zod schemas
- Styling: CSS with modern features
- Node.js 18.20.2+ or 20.9.0+
- pnpm 9 or 10
- Cloudflare account
-
Clone the repository
-
Install dependencies:
pnpm install
-
Set up environment variables in
.env:PAYLOAD_SECRET=your-secret-here FIRECRAWL_API_KEY=your-firecrawl-key
-
Authenticate with Wrangler:
pnpm wrangler login
-
Run database migrations:
pnpm payload migrate
-
Start development server:
pnpm dev
The app will be available at http://localhost:3000 and the admin panel at http://localhost:3000/admin.
Wrangler automatically binds your Cloudflare services for local development. It will create local mock services when running pnpm dev.
For available Wrangler commands, run:
pnpm wrangler help-
Create your migrations:
pnpm payload migrate:create
-
Deploy to Cloudflare:
pnpm run deploy
This will:
- Run migrations against production D1
- Build the application
- Deploy to Cloudflare Workers
You can integrate these steps into your CI/CD pipeline.
When making schema changes:
- Update collection definitions in
src/collections/ - Generate migration:
pnpm payload migrate:create
- Review generated migration in
src/migrations/ - Run migration:
pnpm payload migrate
Required environment variables:
PAYLOAD_SECRET- Secret key for Payload CMS (generate withopenssl rand -hex 32)FIRECRAWL_API_KEY- API key for Firecrawl serviceCLOUDFLARE_ENV- Environment name (optional, for deployments)
src/
βββ app/
β βββ (frontend)/ # Public-facing pages
β β βββ page.tsx # Home page
β β βββ programs/ # Program search and detail pages
β βββ api/ # API routes (reserved for future use)
βββ collections/ # Payload CMS collections
β βββ Programs.ts # Main program data
β βββ AgentPrompts.ts # AI extraction prompts
β βββ Users.ts # Authentication
β βββ Media.ts # File uploads
βββ lib/
β βββ firecrawl.ts # Firecrawl service with Zod schemas
β βββ agentPrompts.ts # Agent execution utility
βββ migrations/ # Database migrations
βββ payload.config.ts # Payload CMS configuration
Full GraphQL support is not guaranteed when deployed due to upstream Workers issues.
This template requires the Paid Workers plan due to bundle size limits (3MB). Keep library imports minimal to avoid hitting limits.
Enable logs in the Cloudflare dashboard to monitor your application. See docs for instructions.
If you have questions or issues:
- Join the Payload Discord
- Start a GitHub Discussion
MIT