Skip to content

Somesh-S-Dev/Post-Scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Post Automater

An AI-powered RSS-to-LinkedIn auto-posting system using Google Gemini API and official LinkedIn API. Fully legal, cost-free, and production-ready.

Features

  • πŸ€– AI Content Generation - Uses Google Gemini (free tier) to transform RSS articles into engaging LinkedIn posts
  • πŸ“° Multi-Topic RSS Integration - Fetch "AI News" or "Dark Side of AI" from multiple sources
  • 🏒 Company Filtering - Focus on major AI companies (Nvidia, OpenAI, Gemini, Claude, Perplexity, etc.)
  • πŸ“€ LinkedIn Publishing - Official OAuth2 API integration for posting with image support
  • πŸ“‹ Queue Management - Queue articles, edit AI-generated content, schedule for later
  • πŸ–ΌοΈ Image Assets - Automatically download and attach images from articles
  • πŸ”„ Deduplication - Automatic detection of already-processed articles
  • ⏰ Scheduled Posts - Set custom date/time for each post or daily automation
  • πŸ” Secure Configuration - Environment-based secrets management
  • πŸ“Š Structured Logging - Winston-based comprehensive logging
  • ✨ Manual Approval Mode - Review and edit before posting

Tech Stack

  • Runtime: Node.js (latest LTS)
  • Server: Express.js
  • Database: PostgreSQL with Drizzle ORM
  • AI: Google Gemini API (free tier)
  • API: Official LinkedIn OAuth2 API
  • Scheduling: node-cron
  • Frontend: React + Vite + Tailwind CSS
  • Forms: React Hook Form + Zod validation
  • Logging: Winston

Prerequisites

  • Node.js 20.x or later
  • PostgreSQL database
  • Google Gemini API key (free)
  • LinkedIn Developer App (OAuth2 credentials)

πŸ“– Quick Start Guide

New to the Queue System? See QUEUE_FEATURES.md for:

  • Complete API endpoint documentation
  • Multi-topic RSS fetching guide
  • Image handling and asset management
  • Scheduled publishing workflow
  • Troubleshooting and best practices

Setup

1. Clone and Install

npm install

2. Configure Environment

Copy .env.example to .env and fill in your values:

cp .env.example .env

Required environment variables:

  • DATABASE_URL - PostgreSQL connection string
  • GEMINI_API_KEY - Get from Google AI Studio
  • LINKEDIN_ACCESS_TOKEN - OAuth2 bearer token
  • LINKEDIN_PERSON_URN - Your LinkedIn URN (urn:li:person:xxxxxxx)

Optional:

  • MANUAL_APPROVAL - Set to true to save posts as drafts instead of auto-publishing
  • DEBUG_MODE - Enable verbose logging

3. Setup Database

Push the schema to your database:

npm run db:push

Or manually apply the migration (see database_migration.sql).

4. Get LinkedIn Credentials

  1. Create a LinkedIn Developer App
  2. Get your OAuth2 access token
  3. Get your LinkedIn Person URN using the LinkedIn API

Running

Development

npm run dev

Server runs on port 5000 with:

  • Hot reload on file changes
  • Console logging
  • Error diagnostics

Production Build

npm run build
npm start

API Endpoints

Get All Posts

GET /api/posts

Returns array of all posts with metadata.

Example response:

[
  {
    "id": 1,
    "articleUrl": "https://example.com/article",
    "linkedinPostId": "...",
    "title": "Article Title",
    "contentSnippet": "...",
    "generatedContent": "AI-generated post content...",
    "published": true,
    "createdAt": "2026-02-14T10:00:00Z"
  }
]

Create Post

POST /api/posts
Content-Type: application/json

{
  "articleUrl": "https://example.com",
  "title": "Article Title",
  "contentSnippet": "Snippet...",
  "generatedContent": "Post content...",
  "published": false
}

Trigger Daily Cycle

POST /api/posts/trigger

Manually runs the daily post cycle (fetch RSS β†’ generate β†’ publish).

πŸ“‹ Queue Management API

The queue system allows you to:

  1. Fetch articles by topic (AI_NEWS or DARK_SIDE_AI)
  2. Add to queue with one-click auto-drafting
  3. Edit content before publishing
  4. Schedule posts for specific date/time
  5. Publish manually or let the scheduler handle it

Quick Queue Endpoints

Method Endpoint Purpose
GET /api/queue View pending/draft posts
POST /api/queue/fetch-articles Fetch articles by topic
POST /api/queue/add Add article to queue
PUT /api/queue/:id Edit draft content
POST /api/queue/:id/schedule Schedule for publishing
POST /api/queue/:id/publish Publish immediately
POST /api/queue/publish-due Batch publish all due posts
DELETE /api/queue/:id Cancel post

πŸ“š Full documentation: See QUEUE_FEATURES.md for complete endpoint specifications, workflow examples, and usage patterns.

Automation

Posts are automatically published daily at 9 AM UTC via the scheduler.

To change the schedule, edit server/routes.ts:

cron.schedule("0 9 * * *", async () => {
  // 0 9 * * * = 9 AM every day
  // Change the cron expression as needed
  await postService.runDailyCycle();
});

How It Works

  1. RSS Fetch - Fetches latest articles from configured feeds
  2. Deduplication - Checks if article was already processed
  3. Content Generation - Sends article to Gemini API for LinkedIn-optimized content
  4. Storage - Saves draft to database
  5. Publishing - Posts to LinkedIn (or saves as draft if MANUAL_APPROVAL=true)
  6. Logging - Records success/failure with detailed logs

Configuration

RSS Feeds

Currently configured feeds:

  • Google News (AI topic)
  • arXiv (Computer Science - AI)

To add more, edit server/services/rssService.ts.

Gemini Prompt

Customize the AI prompt in server/providers/geminiProvider.ts to:

  • Change tone (professional, casual, technical, etc.)
  • Adjust length (currently 150-250 words)
  • Add/remove hashtag requirements
  • Specify content structure

Database Schema

Posts table structure:

CREATE TABLE posts (
  id SERIAL PRIMARY KEY,
  article_url TEXT UNIQUE NOT NULL,
  linkedin_post_id TEXT,
  title TEXT,
  content_snippet TEXT,
  generated_content TEXT,
  published BOOLEAN DEFAULT FALSE,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  error TEXT
);

Logging

Logs are written to console and files:

  • combined.log - All logs
  • error.log - Errors only

Rotate logs based on file size in production.

Development

Type Checking

npm run check

Database Migrations

npm run db:push

Push schema changes to database.

License

MIT Β© 2026 Kamatchi Somesh

Contributing

Contributions welcome! Feel free to:

  • Report bugs
  • Suggest features
  • Submit pull requests
  • Improve documentation

Support

For issues or questions:

  1. Check the logs (combined.log, error.log)
  2. Verify environment variables in .env
  3. Ensure database connectivity
  4. Review API credentials validity

Legal Notice

This project uses:

  • Official LinkedIn API - Compliant with LinkedIn's terms of service
  • Legitimate RSS feeds - No web scraping or automation violations
  • Free tier services - No paid APIs required
  • Open source dependencies - Respects all licenses

Always ensure your automated posting complies with LinkedIn's automation policies and your target platform's terms of service.


Built with ❀️ using modern Node.js, AI, and open-source technologies.

About

An AI-powered RSS-to-LinkedIn auto-posting system using Google Gemini API and official LinkedIn API. Fully legal, cost-free, and production-ready.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages