Operations & Cron Jobs

All scheduled tasks and recurring automation required to run this site.

Cron API Endpoints

HTTP POST endpoints for Jenkins or any external scheduler. All require an X-API-Key header matching the CRON_API_KEY environment variable.

Generate Daily Questions

Active

Generates 10 daily questions from current news headlines using AI.

Schedule: 0 12 * * * (Daily at 12:00 UTC)
Endpoint: POST /api/cron/generate-daily-questions

Requires X-API-Key header with CRON_API_KEY value.

Generate Crisis Questions

Active

Generates 100 crisis-related questions using AI for users in difficult situations.

Schedule: 0 12 * * * (Daily at 12:00 UTC)
Endpoint: POST /api/cron/generate-crisis-questions

Requires X-API-Key header.

Generate Trending Questions

Active

Generates 10 trending seasonal/topical questions from current news.

Schedule: 0 12 * * * (Daily at 12:00 UTC)
Endpoint: POST /api/cron/generate-trending-questions

Requires X-API-Key header.

Generate Question Categories

Active

Categorizes uncategorized questions using AI.

Schedule: 0 12 * * * (Daily at 12:00 UTC)
Endpoint: POST /api/cron/generate-question-categories

Requires X-API-Key header.

Build Question Categories

Active

Rebuilds the question category index from all categorized questions.

Schedule: 0 12 * * * (Daily at 12:00 UTC)
Endpoint: POST /api/cron/build-question-categories

Requires X-API-Key header.

Activate Scheduled Questions

Active

Activates questions that are scheduled for today across all audience segments.

Schedule: 0 6 * * * (Daily at 6:00 AM UTC)
Endpoint: POST /api/cron/activate-scheduled-questions

Requires X-API-Key header.

Deploy Daily Questions

Active

Selects one question per audience segment (16 total) and schedules them for tomorrow.

Schedule: 0 6 * * * (Daily at 6:00 AM UTC)
Endpoint: POST /api/cron/deploy-daily-questions

Requires X-API-Key header.

Generate Segmented Questions

Active

Generates new segmented questions for specified audience(s). Accepts ?audience= and ?count= params.

Schedule: Every 10 days
Endpoint: POST /api/cron/generate-segmented-questions?audience=all&count=30

Requires X-API-Key header. Audience: all, children, teens, college, parents, seniors, theologians, new-believers, young-professionals, empty-nesters, marketplace-leaders, single-adults, creative-professionals, blue-collar, military, healthcare, pastors.

Process Email Sequences

Active

Processes pending email sequences: onboarding, topic follow-ups, crisis care check-ins, weekly digests, and re-engagement emails.

Schedule: 0 14 * * * (Daily at 2:00 PM UTC)
Endpoint: POST /api/cron/process-email-sequences

Requires X-API-Key header. Supports ?dry_run=true.

Legacy GitHub Actions Workflows

These ran as GitHub Actions and have been replaced by the API endpoints above. All are set to workflow_dispatch (manual trigger only).

Generate Questions (Legacy)

Disabled

Legacy GitHub Actions workflow. Replaced by /api/cron/* endpoints above.

Schedule: 0 12 * * * (Daily at 12:00 UTC)
Command: npm run script:generate-daily-questions && ...

Workflow: .github/workflows/generate-questions.yml.

Deploy Segmented Questions (Legacy)

Disabled

Legacy GitHub Actions workflow. Replaced by /api/cron/* endpoints above.

Schedule: 0 6 * * * (Daily at 6:00 AM UTC)
Command: npm run script:activate-scheduled-questions && npm run script:deploy-daily-questions

Workflow: .github/workflows/deploy-segmented-questions.yml.

Process Email Sequences (Legacy)

Disabled

Legacy GitHub Actions workflow. Replaced by /api/cron/* endpoints above.

Schedule: 0 14 * * * (Daily at 2:00 PM UTC)
Command: npx tsx app/scripts/process_email_sequences.ts

Workflow: .github/workflows/email-sequences.yml.

Build & Push to ECR

Disabled

Builds the Docker image and pushes versioned + latest tags to AWS ECR.

Schedule: On push to main
Command: docker build + push to AWS ECR

Workflow: .github/workflows/main.yml. Currently manual-trigger only.

Server-Side Intervals

These run automatically inside the Node.js process via setInterval. No external configuration needed.

Rate Limit Store Cleanup

Active

Cleans up expired rate limit entries from the in-memory store to prevent memory leaks.

Frequency: Every 5 minutes
Source: setInterval in app/.server/middleware/rateLimit.ts

Runs automatically when the server is running. No external configuration needed.

Related Questions Cache Cleanup

Active

Removes expired cache entries from MongoDB to keep the related questions cache fresh.

Frequency: Every 30 minutes
Source: setInterval in app/.server/dao/RelatedQuestionsCache.ts

Runs automatically when the server is running. No external configuration needed.

Email Sequences (Event-Driven)

These are triggered by user actions and processed by the Process Email Sequences cron endpoint above. Defined in app/.server/services/EmailSequenceEngine.ts.

Onboarding Sequence

Trigger: User signup

24 hoursWelcome email
72 hours (3 days)Topic suggestions
168 hours (7 days)Weekly reflection

Topic Follow-up

Trigger: User answers a question

24 hoursFollow-up with related content

Crisis Care

Trigger: Crisis keyword detected in user input

24 hoursCheck-in email
72 hoursFollow-up with resources

Re-engagement

Trigger: User inactivity detected

VariesEncouragement email with personalized content

Quick Reference

JobScheduleTypeStatus
Generate Daily Questions0 12 * * * (Daily at 12:00 UTC)API EndpointActive
Generate Crisis Questions0 12 * * * (Daily at 12:00 UTC)API EndpointActive
Generate Trending Questions0 12 * * * (Daily at 12:00 UTC)API EndpointActive
Generate Question Categories0 12 * * * (Daily at 12:00 UTC)API EndpointActive
Build Question Categories0 12 * * * (Daily at 12:00 UTC)API EndpointActive
Activate Scheduled Questions0 6 * * * (Daily at 6:00 AM UTC)API EndpointActive
Deploy Daily Questions0 6 * * * (Daily at 6:00 AM UTC)API EndpointActive
Generate Segmented QuestionsEvery 10 daysAPI EndpointActive
Process Email Sequences0 14 * * * (Daily at 2:00 PM UTC)API EndpointActive
Rate Limit Store CleanupEvery 5 minutesServer IntervalActive
Related Questions Cache CleanupEvery 30 minutesServer IntervalActive
Generate Questions (Legacy)0 12 * * * (Daily at 12:00 UTC)GitHub ActionDisabled
Deploy Segmented Questions (Legacy)0 6 * * * (Daily at 6:00 AM UTC)GitHub ActionDisabled
Process Email Sequences (Legacy)0 14 * * * (Daily at 2:00 PM UTC)GitHub ActionDisabled
Build & Push to ECROn push to mainGitHub ActionDisabled