# Automated Meme Generation System

n8n AI Instagram FastAPI

Github Repo: https://github.com/0xarchit/carbon-now-sh-api

Github Repo: https://github.com/0xarchit/n8n-templates

# Architecture

graph LR
    A[AI Agent<br/>n8n] --> B[Carbon API<br/>FastAPI]
    B --> C[Instagram<br/>Auto-post]

# Components

# 1. AI Agent (n8n Workflow)

  • Purpose: Automated meme generation and Instagram posting
  • Stack: n8n + Mistral LLM + Memory + Scheduling
  • Features:
    • Scheduled meme generation (customizable intervals)
    • Sarcastic programming humor using Mistral AI
    • Persistent memory to avoid repetition
    • Automated Instagram posting via FB Graph API
    • Cloudinary integration for image hosting

# 2. Carbon API (FastAPI Service)

  • Purpose: Convert code snippets to beautiful images
  • Stack: FastAPI + Playwright + Carbon.now.sh
  • Features:\
    • Pre-configured Seti theme with Hack font
    • No watermarks or distractions
    • Docker containerized
    • CORS enabled

# Quick Start

# Carbon API

cd carbon-api
docker build -t carbon-api .
docker run -p 8000:8000 carbon-api

# AI Agent Setup

  1. Import ai-agent/instagram_autopost.json into your n8n instance
  2. Configure credentials:
    • Mistral Cloud API
    • Facebook Graph API (Instagram)
    • Cloudinary (optional)
  3. Update URLs to point to your Carbon API deployment
  4. Set schedule trigger as needed

# Live Demo

Carbon API: https://zeroxcarbon.onrender.com/docs

Instagram: https://www.instagram.com/echosarcasm


# Prerequisites

  • Docker or Python 3.11+
  • Playwright (auto-installed)
  • n8n instance (self-hosted or cloud)
  • Mistral Cloud account
  • Facebook Developer account (Instagram Basic Display)
  • Cloudinary account (optional)

# Configuration

# AI Agent Workflow

  1. Schedule Trigger: Set your posting frequency
  2. Mistral LLM: Configure API credentials
  3. Carbon API URL: Point to your deployed Carbon service
  4. Instagram: Configure FB Graph API credentials
  5. Memory: Maintains context to avoid duplicate memes

# Carbon API

  • Theme: Seti (dark)
  • Font: Hack 12px
  • Output: JPG at 90% quality
  • No line numbers or window controls

# Workflow Process

graph TD
    A[Schedule Trigger] --> B[AI Agent]
    B --> C[Memory Check]
    C --> D[Caption Generator]
    D --> E[Carbon API]
    E --> F[Cloudinary]
    F --> G[Instagram Auto-post]
  1. Schedule Trigger → Starts the automation
  2. AI Agent → Generates witty programming meme
  3. Memory Check → Ensures uniqueness
  4. Caption Generator → Creates Instagram-ready text
  5. Carbon API → Converts code to beautiful image
  6. Cloudinary → Uploads image (optional)
  7. Instagram → Auto-posts to your account

# Customization

  • Meme Style: Edit prompts in AI Agent nodes
  • Visual Theme: Modify Carbon API parameters
  • Posting Schedule: Adjust Schedule Trigger intervals
  • Platforms: Extend to Twitter, LinkedIn, etc.

# License

Open source - feel free to fork and customize for your own automated meme empire!