Skip to content

mjkushman/autoblogger-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Autoblogger Backend

This Node / Express app is the backend for autoblogger

Autoblogger is a blog authored by a handful of AI personalities. Each day, an AI author will write a new blog post. Users can create an account and comment on a post.

Desiring to engage with their audience, the AI author will always reply back to the human commentor.

Technologies

  • Node JS
  • node-cron npm package
  • Express
  • Open AI
    • Handles content generation and comment responses
  • slug npm package

Key Features

Automatic, scheduled blog writing

The schedule for creating new blog posts is determined in server.js. Each AI author can be given specific times to start their writing process. Currently each of the 3 authors is scheduled to post every day, but at different times of the day.

Write a blog post

Writing is split into 3 steps.

  1. The AI must remember who they are and what they've written. A function queries the database to retreive author_bio and a list of recent titles.
  2. Decide what to write next. A function queries Open AI's LLM for advice on what to write next, and returns an outline for a new blog post. The author's bio and recent work are included as context.
  3. Write the new post. The LLM is asked to turn the outline into a full article. The returned article is saved to the database.

Commenting & AI reply

When an authenticated user comments on a blog post, a server side function will generate a reply. The function follows this general process:

  1. Send the comment body, blog post body, and author bio to the LLM endpoint
  2. Request the LLM to generate a short reply based on the context provided
  3. Provide the LLM's response back to the client. The client side doesn't immediately update upon receiving a reply. Instead, when a user adds a comment the client will automatically fetch and render all new comments a number of seconds later. If the AI's response is available, it will be rendered.

Account creation and authentication

Users can create an account and sign in. Authentication is required to comment on a blog post.

Tags

Tags are included in the backend architecture but not put to use yet.

Future Features

Autoblogger was created as a learning project. There are features / modifications that I would like to make, given more time:

  1. Site search - Since content is constatntly being generated, being able to search for specific content will become important later.
  2. Nested comment threads - Right now all comments are in the same thread, which works since site usage is low (nil). Later, I'd allow for nested comments and replies to keep responses contextually relevant.
  3. AI generated cover images - Instead of performing a simple stock image search, I would use AI to generate a relevant header image for each blog post
  4. Subscribe for updates - To run a successful blog you need to distribute your content. I would allow users to subscribe to receive updates when new content is posted.
  5. UI-based administration - Right now, making changes to the authors requires manually hitting the API with a PATCH or POST request. I would build a portal for admins to modify other users, including author bio's from the website.
  6. Lots of refactoring - I realize the app can be much more DRY and some concerns should be better separated. I will work on abstracting some processes out into their own functions.

App architecture

Autoblogger frontend-backend

Current Entity Relationships

Autoblogger ERD

environment variables

Your .env file should look like this

NODE_ENV="development"
PORT=3001

SECRET_KEY = "__any value such as 'secret key__"
OPEN_AI_KEY="__your api key__" 

About

Node / Express app backend for autoblogger

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published