Skip to content

thephilgray/fauxios-ai

Repository files navigation

Fauxios

Fauxios Logo

Fauxios is an automated content generation and social media platform. It leverages AI and serverless technologies to create news articles and videos, and post them to social media channels.

Table of Contents

Architecture

The project is built on a serverless architecture using SST to manage AWS resources. The frontend is an Astro site.

Article Generation

The core of the article generation is an AWS Step Function (FauxiosOrchestrator) that automates the following steps:

  1. Generate Article Content: A Lambda function (generateArticleContent) uses generative AI to write an article.
  2. Generate Article Image: A Lambda function (generateArticleImage) creates an image for the article.
  3. Assemble Post: A Lambda function (assemblePost) combines the article content and image into a final post format and stores it in DynamoDB.
  4. Post to Socials: A Lambda function (postToSocials) posts the generated article to social media platforms like Twitter and Facebook.

This workflow is triggered by a daily cron job.

Video Generation

Video generation is handled by a separate AWS Step Function (VideoOrchestrator) and Remotion for rendering.

  1. Parallel Asset Generation:
    • Voiceover: An AWS Polly-powered Lambda (generateVoiceover) creates a voiceover from a headline.
    • Avatar: A RunwayML-powered Lambda (generateAvatar) creates a talking avatar video from a quote.
  2. Final Video Rendering:
    • A final Lambda function (renderVideo) invokes a Remotion Lambda function to composite the generated assets (voiceover, animated cartoon, avatar) into a single video.

For more details, see the Video Generation Architecture document.

Setup

  1. Prerequisites:

    • Node.js (v18 or later)
    • An AWS account with credentials configured for SST.
    • SST CLI installed globally.
  2. Clone the repository:

    git clone <repository-url>
    cd fauxios-project
  3. Install dependencies:

    npm install
  4. Configure Secrets: This project uses SST's sst.Secret to manage API keys and other secrets for services like Twitter, Facebook, Gemini, and RunwayML. You will need to set these secrets in your SST environment.

    Example:

    npx sst secret set TwitterApiKey "your_api_key" --stage dev

    Refer to sst.config.ts for the full list of secrets required.

Usage

Deploying to AWS

To deploy the entire stack (including the Astro site, APIs, and all serverless functions) to your AWS account, run:

sst deploy --stage dev

Local Development

To run the Astro frontend locally for development:

sst dev

This will start a local development server at http://localhost:4321.

Invoking Workflows

To manually trigger the article generation workflow, you can use the SST shell to execute scripts in the context of your deployed backend.

sst shell --stage dev -- node packages/scripts/invoke-generator.ts

This command runs the invoke-generator.ts script, which starts an execution of the FauxiosOrchestrator Step Function.

Scripts

This project includes scripts for data maintenance, diagnostics, and seeding. These scripts should be run within the SST shell to provide them with the necessary AWS context.

To run a script, use the following command structure, replacing <stage-name> with the target stage (e.g., dev, develop) and <script-name> with the name of the script you want to run.

sst shell --stage <stage-name> -- npm run <script-name>

Available Scripts

  • invoke-generator: Manually triggers the article generation workflow.
  • clear-articles-by-date: Removes articles from the database based on their creation date.
  • normalize-sources: Normalizes the source text files used for content generation.
  • reindex-articles: Updates each article to ensure it is included in all GSIs. This is essential after creating a new GSI or if you suspect an index is out of sync.
  • scan-topics: A diagnostic script to inspect the topic attribute of all articles in the database.
  • seed-authors: Seeds the database with an initial set of authors.
  • seed-pinecone: Seeds the Pinecone index with vectors from the source documents.
  • setup-index: Sets up the initial Pinecone index.

Key Technologies

About

Automated AI generated satirical news site and publishing platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •