Skip to content

Background Jobs Inventory

All background jobs are standalone Node.js scripts in the project root. They use node-cron for scheduling and are managed by PM2 in production (ecosystem.config.js).

Summary by Category

Category Count Description
Social Media Publishing 15 Post content to Facebook, Instagram, LinkedIn, TikTok
Content Scheduling & Feed Management 11 Schedule posts, manage content planner, pull feeds
Content & Media Generation 11 AI-powered content creation and image generation
User-Specific Media Generation 9 Generate branded media for individual users
Media Processing & Image Correction 15 Validate and correct generated images
Thumbnail & Image Processing 8 Generate thumbnails, merge logos/footers
Token Management & Authentication 5 Refresh OAuth tokens for social platforms
Account Disconnect & Token Validation 3 Detect expired tokens, notify users
Branding & Template Management 9 Apply brand colors, manage template sets
Analytics & Insights 6 Fetch social media metrics and aggregate data
AI Content & Knowledge Base (RAG) 20 AI content generation, industry classification, RAG pipeline
Notifications & Email 5 Send emails and Slack alerts
Billing & Payments 3 Process webhooks, invoice handling
RSS & News Feeds 4 Monitor and process RSS feeds
Data Import & Library Management 8 Import Excel/CSV content, manage library
Database Maintenance & Utilities 6 Data migrations, relationship fixes

Total at the project root: ~108 job_*.js files (3 are fully commented out/deprecated). The 138 figure that previously appeared here was incorrect.

Additional job files live elsewhere and are documented in their own sections at the bottom of this file: - 5 jobs under user_specific_contents_ai/ — see User-Specific AI Jobs - 3 jobs under dashboard/services/ — see Dashboard Sub-Application - 3 standalone generate_*.js scripts at the project root — see Standalone Generators below

Grand total across all locations: ~119 active job/script files.


Category 1: Social Media Publishing

# File Schedule PM2 Purpose
1 job_facebook_publish.js */10s Yes Publish image posts to Facebook pages
2 job_facebook_video_publish.js */10s Yes Publish video posts to Facebook pages
3 job_facebook_carousal_publish.js */10s Yes Publish carousel posts to Facebook pages
4 job_facebook_link_publish.js */10s Yes Publish link posts to Facebook pages
5 job_instagram_publish.js */10s Yes Publish image posts to Instagram (container API)
6 job_instagram_video_publish.js */10s Yes Publish video reels to Instagram
7 job_instagram_carousal_publish.js */10s Yes Publish carousel posts to Instagram
8 job_linkedin_publish.js */10s Yes Publish image posts to LinkedIn
9 job_linkedin_video_publish.js */10s Yes Publish video posts to LinkedIn
10 job_linkedin_carousal_publish.js */10s Yes Publish carousel/document posts to LinkedIn
11 job_linkedIn_link_publish.js */10s Yes Publish link posts to LinkedIn
12 job_linkedin_repost_publish.js */10s No Repost content on LinkedIn
13 job_tiktok_content_publish.js */10s Yes Publish video content to TikTok
14 job_update_fb_posted_status.js */10s No Update post status after Facebook publishing
15 job_update_posted_status.js */10s Yes Update content planner status after publishing

Category 2: Content Scheduling & Feed Management

# File Schedule PM2 Purpose
16 job_auto_post.js */2min Yes Auto-schedule posts from library to content planner
17 job_status_schedule.js */30s Yes Update content planner post statuses (ready/pending)
18 job_status_schedule1.js */30s Yes Secondary scheduling status processor
19 job_cp_schedule.js */10s Yes Process content planner scheduling queue
20 job_content_schedule.js */10s Yes Schedule content from library into content planner
21 job_schedule_pending.js */10s Yes Process pending schedule requests
22 job_cp_feed.js */10s Yes Pull social media feed content into content planner
23 job_cp_feed_video.js */10s Yes Pull video feed content into content planner
24 job_first_comment.js */30s Yes Generate first comments for scheduled posts using AI
25 job_dynamic_post.js */10s Yes Generate dynamic posts with stock images and AI text
26 job_pending_post.js */10s Yes Process pending post entries

Category 3: Content & Media Generation

# File Schedule PM2 Purpose
27 job_content_generation.js */30s Yes Generate AI content for library using multiple LLMs
28 job_new_content_generation.js */30s Yes Newer content generation pipeline
29 job_urgent_generation.js */10s Yes Priority content generation for urgent requests
30 job_generate_images.js */10s Yes Generate design images from templates via Polotno
31 job_design_generation.js */10s Yes Generate design compositions from library content
32 job_dynamic_post_generation.js */10s Yes Generate dynamic post images with stock photos
33 job_new_post_generation.js */10s Yes New post generation pipeline
34 job_temp_post_generation.js */10s Yes Temporary/draft post generation
35 job_post_urgent_generation.js */10s Yes Priority post image generation
36 job_generation_complete.js */30s Yes Finalize generation, send notifications
37 job_user_media_gen_temporary.js */10s No Generate temporary user media

Category 4: User-Specific Media Generation

# File Schedule PM2 Purpose
38 job_user_media_generation.js */10s Yes Generate branded media for user library items
39 job_temp_user_media_generation.js */10s Yes Generate temporary user media from templates
40 job_regen_translated_user_media.js */10s Yes Regenerate media after content translation
41 job_usermedia_image1.js */10s Yes User media image processor (variant 1)
42 job_usermedia_image2.js */10s Yes User media image processor (variant 2)
43 job_usermedia_image3.js */10s Yes User media image processor (variant 3)
44 job_usermedia_image4.js */10s No User media image processor (variant 4)
45 job_usermedia_image5.js */10s No User media image processor (variant 5)
46 job_usermedia_image6.js */10s No User media image processor (variant 6)

Category 5: Media Processing & Image Correction

# File Schedule PM2 Purpose
47 job_media_image_correction.js */10s Yes Replace placeholder images with AI-generated ones
48 job_user_media_correction.js */10s Yes Correct user media images using AI generation
49 job_user_media_correction_error_image.js */10s No Retry failed image corrections
50 job_media_color_correction.js */10s No Adjust brand colors in media templates
51 job_post_color_image_verification.js */10s Yes Validate image color consistency with Gemini AI
52 job_post_image_correction.js */10s No Correct images that failed validation
53 job_post_validation.js */10s No Validate library post images (colors, AI content check)
54 job_text_color_change.js */10s No Fix text colors in Polotno templates
55 job_ucl_text_correction.js */10s Yes Correct text colors in user content library
56 job_color_check.js */10s No Validate brand/accent colors in rendered images
57 job_user_media_Validation.js */10s No Validate user media color consistency
58 job_user_media_ValidationImgChanges.js */10s No Check if user media images need replacement
59 job_user_media_visibility.js */10s Yes AI-based text visibility analysis on media
60 job_validate_errorMedia.js */10s No Retry validation for previously failed media
61 job_checkMedia_contentImage.js */10s Yes Verify generated media has proper images/thumbnails

Category 6: Thumbnail & Image Processing

# File Schedule PM2 Purpose
62 job_thumbnail.js */15s No Generate thumbnails for uploads (500px width)
63 job_thumbnail0.js */15s No Thumbnail generation (newest first order)
64 job_thumbnail1.js */1min No Thumbnails for category IDs 442-452
65 job_thumbnail2.js */1min No Thumbnails for category IDs 418-428
66 job_cus_post_thumbnail.js */15s No Thumbnails for custom user posts
67 job_auto_merge_images.js */5min Yes Merge company logos/footers onto scheduled posts
68 job_update_merge_image.js */5min No Retroactively add logos to existing scheduled posts
69 job_carousel_pdf.js */10s No Generate carousel PDFs for LinkedIn

Category 7: Token Management & Authentication

# File Schedule PM2 Purpose
70 job_refresh_fb_token.js Daily midnight Yes Refresh Facebook/Instagram long-lived tokens
71 job_weekly_refresh_fb_token.js Every 3 days Yes Weekly Facebook token refresh for paying subscribers
72 job_refresh_In_token.js */30s Yes Refresh LinkedIn OAuth tokens
73 job_tiktok_refresh.js */30min No Refresh TikTok access tokens
74 job_vertex_token.js */50min Yes Refresh Google Vertex AI access tokens

Category 8: Account Disconnect & Token Validation

# File Schedule PM2 Purpose
75 job_auto_disconnect.js Every 12h Yes Detect invalid/expired social media tokens
76 job_new_auto_disconnect.js Every 12h No Enhanced version with Meta and LinkedIn checks
77 job_revoke_token_mail.js Every 6h No Send email notifications about expired tokens

Category 9: Branding & Template Management

# File Schedule PM2 Purpose
78 job_media_brand.js */10s No Apply brand colors to media templates
79 job_brand_favtempset.js */10s No Generate branded versions of favorite template sets
80 job_tempset_branding.js */5min No Process template set branding jobs
81 job_update_color_logo.js */2min Yes Re-render content planner items with updated branding
82 job_holiday_post_branding.js */2min No Apply branding to holiday/event posts
83 job_updateTemplateValid.js */6s Yes Validate default templates (colors, figures, SVGs)
84 job_template_svg_fix.js Sequential No Fix SVG references in default templates
85 job_figure_find_polotno.js */10s No Catalog figure/SVG elements in templates
86 job_update_organization_common.js */1min No Create color variants for organization-common media

Category 10: Analytics & Insights

# File Schedule PM2 Purpose
87 dashboard/services/job_account_insights.js */30s Yes Fetch follower/engagement from FB, IG, LinkedIn
88 dashboard/services/job_post_insights.js Every 12h Yes Fetch per-post metrics from social APIs
89 dashboard/services/job_growth_insights.js 10min past 12h Yes Calculate growth deltas for post insights
90 monthly_account_insights.js Periodic No Aggregate monthly account follower data
91 monthly_post_insights.js Periodic No Aggregate monthly post engagement metrics
92 job_ig_permalink.js */10s No Fetch and store Instagram post permalinks

Category 11: AI Content & Knowledge Base (RAG Pipeline)

# File Schedule PM2 Purpose
93 job_website_info.js */5min Yes Scrape company websites via Python for AI processing
94 user_specific_contents_ai/job_brand_positioning_ai.js */30s Yes Generate AI brand positioning using Gemini
95 user_specific_contents_ai/job_objective_ai.js */30s Yes Generate AI business objectives using Gemini
96 user_specific_contents_ai/job_recom_subjects_ai.js */30s Yes Generate AI-recommended content subjects using LLaMA
97 user_specific_contents_ai/job_content_translation.js */15s No Translate content between languages using LLaMA
98 user_specific_contents_ai/job_translate_and_rephrase.js */30s No Translate and rephrase content using Gemini
99 generate_company_industry.js */40s No Classify company industry using Cloud RAG
100 generate_organization_profile.js */40s No Generate org profiles using AI and Python
101 generate_template_industry.js */30s No Classify template set industries using Cloud RAG
102 update_company_industry.js */50s No Re-classify company industries using Gemini
103 update_template_industry.js */50s No Re-classify template industries using Gemini
104 update_cloud_knowledge_base.js */40s No Create/update cloud RAG corpora for accounts
105 user_specific_content.js */50s No Generate user-specific RAG-based library content
106 RAG_content_for_categories.js */1min No Generate category-specific content using RAG
107 RAG_recom_subjects.js */1min No Recommend subjects using RAG pipeline
108 Rag_userSpecific_CustomContent.js */3min No Generate personalized content using RAG + Python
109 reel_ideas_rag.js */40s No Generate reel/video ideas using RAG and AI
110 Nova-Pro_KnowledgeBased_img_Searchterm.js */1min No Generate image search terms using Nova Pro
111 csv_image_ideas_search_terms.js */40s No Generate image prompts for CSV-uploaded content
112 fetch_industry_keywords_tempset.js */20s No Generate industry keywords for template sets

Category 12: Notifications & Email

# File Schedule PM2 Purpose
113 job_send_mail.js */1min No Process email queue via SendGrid
114 slack_notifications.js 2:30 & 10:30 UTC No System health Slack reports (feeds, planner, scheduling)
115 slack_notifications_post_disconnect.js Daily midnight No Slack report on disconnected social accounts
116 newnotification.js 5x daily No Content planner status Slack reports
117 need_to_reconnect_sm.js */1min No Send reconnection reminder emails

Category 13: Billing & Payments

# File Schedule PM2 Purpose
118 job_invoice_paid.js */10s Yes Process paid invoice events, update subscriptions
119 job_paddle_webhook.js */5s No Process Paddle webhook events from queue
120 job_paddle_Admin_webhook_mail.js */30s No Send admin notification emails for Paddle events

Category 14: RSS & News Feeds

# File Schedule PM2 Purpose
121 job_rss.js 10min interval No Basic RSS feed reader (prototype/test)
122 job_check_daily_rss_feed.js */10s No Process daily RSS feed content for accounts
123 job_check_rss_feed_available.js */10s No Validate RSS feed URL availability
124 job_check_daily_account_news.js */10s No Check news relevant to user accounts

Category 15: Data Import & Library Management

# File Schedule PM2 Purpose
125 job_library.js */10s Yes Manage library content status updates
126 job_excel_to_library.js */1s Yes Import Excel/XLSX files into content library
127 job_excel_to_MasterLibrary.js */1s No Import Excel content to master library
128 job_csvFileUpload.js */10s No Process CSV uploads for content library
129 job_reel_idea_csvUpload.js */10s No Import reel ideas from CSV uploads
130 job_update_library_content_new.js */1s No Update library content with new data
131 job_UpdateFolderToLibrary.js */1s No Map library items to folders by subject
132 pixabay_s3upload.js */15s No Download Pixabay images and upload to S3

Category 16: Database Maintenance & Utilities

# File Schedule PM2 Purpose
133 job_subj1.js Once (startup) No Map industry-subject relationships (migration)
134 job_subject_verify.js Once (startup) No Verify subjects with library content timestamps
135 job_update_mauth.js */10s No Link default social accounts to member auth records
136 job_update_drivelog.js N/A No Deprecated (fully commented out)
137 job_update_error_file.js N/A No Deprecated (fully commented out)
138 job_update_media.js N/A No Deprecated (fully commented out)

PM2 Configuration

File: ecosystem.config.js

~37 processes are defined for PM2 management. Key PM2 settings: - exec_mode: 'fork' (single instance per job) - autorestart: true - watch: false - Some jobs receive args (e.g., '100' for batch size)

No error_file / out_file paths are configured per process. PM2 falls back to its default ~/.pm2/logs/<app>-{out,error}.log. See Logging & Observability.


User-Specific AI Jobs (user_specific_contents_ai/)

These are PM2-managed AI workers that produce per-account content. Full details in User-Specific AI Jobs.

File PM2 name Cron Purpose
job_brand_positioning_ai.js brandPositioning-AI-Response */30s Generate brand positioning Q&A from company research
job_objective_ai.js objective-AI-Response */30s Generate strategic objectives from approved brand positioning
job_recom_subjects_ai.js recomSubjects-AI-Response */30s Recommend content subjects from brand + objectives
job_content_translation.js (job-queue, type TCON) */15s Translate library content to a target language
job_translate_and_rephrase.js (job-queue, type RTCON) */30s Translate + rephrase + enqueue follow-up RGEN

Dashboard Service Jobs (dashboard/services/)

Three PM2-managed jobs that ingest social-platform metrics. Full details in Dashboard Sub-Application.

File Cron Purpose
dashboard/services/job_account_insights.js */30s Snapshot follower/engagement totals per platform
dashboard/services/job_growth_insights.js every 12h at :10 Compute delta metrics between snapshots
dashboard/services/job_post_insights.js */30s Fetch per-post metrics from social APIs

Standalone Generators

Three top-level cron scripts that are NOT registered in ecosystem.config.js. They run as independent Node processes with their own node-cron schedules and an isOnProcess re-entry guard. To run them under PM2 you must launch them manually.

File Cron Purpose
generate_company_industry.js */40s Classify company industry via Vertex Cloud RAG
generate_organization_profile.js */40s Generate organization profile (uses subprocess spawn)
generate_template_industry.js */30s Industry classification for design templates

See RAG Pipeline for the underlying Cloud RAG / Vertex AI integration.


Job Type Codes

The job-queue model in tJobs uses short type codes. The list below was reconciled against actual code references in the verification audit.

Earlier versions of this doc listed type codes that don't appear in code (DPGEN, UMGEN, MCC, TCH, FC, RTCON) and missed codes that do (BGEN, CLKB, GEML, HPB, PIC, TCC). The list below is what the codebase actually references; the running database may have additional codes from old jobs. Run SELECT type, COUNT(*) FROM tJobs GROUP BY type ORDER BY 2 DESC to settle the canonical production list.

Type codes used in the current codebase

Code Likely meaning Producer / consumer Notes
CGEN Content Generation job_content_generation.js AI text content generation
UGEN User Content Generation job_user_content_generation.js User-specific AI content
DGEN Design Generation job_design_generation.js Polotno template rendering
BGEN (Branding generation?) grep finds in code Verify exact role
TIV Text/Image Validation image-validation jobs Color contrast analysis
UCL Update Color/Logo job_update_color_logo.js Apply branding to posts
TSB Template Set Branding template-branding jobs Brand entire template sets
TCON Translate Content user_specific_contents_ai/job_content_translation.js Translate library content
RGEN Regenerate enqueued by job_translate_and_rephrase.js Regenerate visuals after content edit
TCC (Text content change?) grep finds in code Verify exact role
PIC (Post image correction?) grep finds in code Verify exact role
HPB (?) grep finds in code Verify exact role
CLKB (Cloud knowledge base?) grep finds in code; relates to RAG corpus Verify exact role
GEML (Generate email?) grep finds in code Verify exact role

Codes that need investigation

For the codes whose meaning is uncertain (BGEN, TCC, PIC, HPB, CLKB, GEML), the team should:

  1. Run SELECT DISTINCT type, COUNT(*) FROM tJobs GROUP BY type to confirm which are still active
  2. Find the producer (the file that does INSERT INTO tJobs ... type = '<code>')
  3. Find the consumer (the worker that does WHERE type = '<code>')
  4. Document the actual purpose

Earlier-claimed but unverified codes

The previous version of this doc listed these codes; they were not found in current code references. They may be historical / removed:

Code Previously claimed
DPGEN Design Post Generation
UMGEN User Media Generation
MCC Media Color Correction
TCH Text Color Change
FC First Comment
RTCON Rephrase + Translate Content

If any of these are still in tJobs rows, the consumer code may be a job not yet found, or these may be dead types. Verify before treating as removed.

See Content Pipeline for the end-to-end status machine and how these types chain.


Known Discrepancies

The audit that produced this section found mismatches between code, this inventory, and ecosystem.config.js. Fix or reconcile before the next deployment.

Jobs in code, missing from this inventory

These exist on disk but were not previously listed:

File Notes
job_post_schedule.js PM2-managed as App Friday_Cron
job_update_cpchannel_accounts.js Maintains channel↔account mappings
job_usermedia_image.js Base user media image processor (variants 1–3 are listed; the base file was missed)

Jobs listed in this inventory, missing from code

These are mentioned in the tables above but no longer exist on disk:

File Likely status
job_update_posted_status.js (Category 1, #15) Consolidated into another job, or removed
job_usermedia_image4.js (Category 4, #44) Never created or removed
job_usermedia_image5.js (Category 4, #45) Never created or removed
job_usermedia_image6.js (Category 4, #46) Never created or removed

ecosystem.config.js references that don't resolve

PM2 will fail to start these — verify and either create the file or remove the entry:

Referenced script Issue
./job_account_insights.js Wrong path. File is at dashboard/services/job_account_insights.js
./job_post_insights.js Wrong path. File is at dashboard/services/job_post_insights.js
./job_companyDetails-AI-Res.js ❌ File does not exist
./job_library_search_terms.js ❌ File does not exist
./job_post_ginsights.js ❌ File does not exist
./job_subject_content_generation.js ❌ File does not exist
./user_specific_contents_ai/job_content_ai.js ❌ File does not exist (the actual files in this directory have different names — see User-Specific AI Jobs)

When fixing these, prefer updating ecosystem.config.js over creating empty stubs. If the referenced functionality has been merged into another job, just remove the PM2 entry.