Skip to content

Repository files navigation

SkyScheduler

Deploy Cloudflare Workers Tip Bluesky followers

License: MIT NodeJS Version Website Mozilla HTTP Grade

GitHub Runs ESLint Checks GitHub code size GitHub repo size

SkyScheduler Dashboard

Overview

Project Created At GitHub Last Commit

SkyScheduler is a fully-fledged Cloudflare Workers-based microservice application that allows you and/or your team to schedule/repost posts to a Bluesky account effortlessly.

Perfect for content creators and social media managers who want to plan their social media content in advance.

Features

  • Multiple user/account handling: Manage multiple users/bluesky accounts easily.
  • Bluesky Post/Retweet Scheduling: Schedule multiple posts to your Bluesky account.
  • Custom Time Slots: Time selection is limited to 1hr/30m/15m/10m/5m intervals (configurable, default 1hr) to optimize worker execution and reduce unnecessary runs.
  • Post Threading: Schedule entire post threads with full media support per post!
  • Simple Setup: Fairly minimal setup and easy to use.
  • Supports media posts: Automatically handles content tagging and formatting your media so that it looks the best on BSky. Image transforms via Cloudflare Images.
  • Handles Link Embeds: Post your content with a link embed easily!
  • Automatic reposting: Schedule how many times you want your post to be reposted on the network. Get more visibility and engagement without having to do more work.
  • Repost anything: Need to retweet something made externally from outside of SkyScheduler? Yeah, you can.
  • Invite Keys: Optionally throttle the signups of your service to select groups? Use invite keys to manage signups.
  • SSG Page Generation: Most pages can be automatically built and served statically, to save on processing overhead.

Getting Started

Prerequisites

  • Node.js
  • Cloudflare Pro Workers account (you will hit CPU limits under the free account due to BetterAuth and egress to ATProto)

Installation

Clicking the Cloudflare Badge should get you a mostly one-click install. Manual instructions are provided below.

  1. Clone the repo
git clone https://github.com/socksthewolf/skyscheduler.git
cd skyscheduler
  1. Copy environment variables template
cp .env.example .env
  1. Configure your .env file based off the .env.example file. Comments to what each variable needs to be set to can be found in there.

Note: When deploying, these variables should also be configured as secrets in your Cloudflare worker dashboard. You can also do this via npx wrangler secret put <NAME_OF_SECRET>.

Alternatively, make a file like .env.prod and use npx wrangler secret bulk .env.prod to upload all the settings at once.

  1. Update your wrangler.toml with changes that reflect your account.

    • You'll need to update the values for the KV, R2, Queues, D1 to reflect the bindings on your account.
    • Also make sure you update the BETTER_AUTH_URL to your working URL as well.
    • If you allow image resizing, you should also modify IMAGE_SETTINGS's bucket_url to the correct host.
    • Do remember to update/remove the domain bindings!
  2. Install dependencies

npm install
  1. Modify any site information located in:

    • /src/appInfo.ts - site information such as name, description, domain, etc.
    • /src/config.ts - site configuration and feature flags
    • /src/limits.ts - application limits (usually do not need to change much of anything here)
  2. Deploy the application to Cloudflare Workers. You might need to login to your Cloudflare account if you haven't already.

npm run deploy -- --secrets-file=.env

NOTE: You can also run dev by using npm run dev.

  1. Create your D1 tables using the following command, this will set up your tables both locally and remotely.
npm run migrate:all

NOTE: If you encounter issues running this command, you can run npm run migrate:remote or npm run migrate:local respectively.

  1. Run your application and go to /setup. This will create the admin account.

Configuration

Environment Variables

Ensure you have configured the .env file with the necessary credentials and settings. The file is git-ignored to protect your sensitive information.

Application Variables

Most of the application can be modified with wrangler.toml's vars section, src/config.ts or via src/limits.ts.

Both files are heavily commented to explain what the options control.

Site Variables

Modifying key values such as meta tag data, the application name and any descriptions is fully controlled via src/appInfo.ts.

Changing the values in that file will modify the visual display of the application's web output.

Minimization

SkyScheduler uses the minified versions of the scripts in assets/js and assets/css.

These are generated on the fly whenever any typescript file is changed or the application is deployed/ran.

Commands

SkyScheduler comes with a lot of commands to help manage the service. Documentation on the commands can be found in package.json.

The most important ones to know:

  • build - builds static website files.
    • Note: Automatically is called by wrangler builds.
  • dev - runs the app in a local environment.
  • generate - run anytime you modify a file in the src/db folder.
    • This will generate SQL migration files.
  • migrate - commit the SQL migrations to local/prod databases.
  • migrate:local - migrates the SQL changes to your local dev instance.
  • migrate:prod - does the same but commits remotely.
    • Note: This has a chance of wrangler failing to commit, you may have to run it more than once (it is safe to execute).
  • invite:generate - generates a valid invite key.
  • invite:local/remote - commits an invite key to the invite store.
  • openapi - builds the OpenAPI spec.
    • This is not automatically called by anything in the application, but there is a GitHub Action (openapi.yml) that uploads to artifacts.
    • Give the output file to the WAF.
  • types - whenever wrangler.toml changes or wrangler updates, run this command.

Project Structure

skyscheduler/
├── assets/
│   ├── .well-known/
│   ├── css/
│   ├── dep/
│   ├── fonts/
│   ├── icons/
│   ├── js/
│   ├── screenshots/
│   └── thumbs/
├── bin/
├── src/
│   ├── @types/
│   ├── auth/
│   ├── classes/
│   ├── db/
│   ├── endpoints/
│   ├── layout/
│   ├── middleware/
│   ├── pages/
│   ├── statics/
│   ├── utils/
│   └── validation/
├── migrations/
├── .vscode/
├── .github/
├── .env.example
├── .node-version
├── .markdownlint.json
├── auth.config.ts
├── drizzle.config.ts
├── eslint.config.ts
├── package.json
├── tsconfig.json
└── wrangler.toml

Middleware Stack

Server

  • BetterAuth - site login/authentication
  • Hono - request routing/processing
  • uuid - id generation
  • zod - data validation
  • image-dimensions - image data validation
  • date-fns - date processing helpers
  • drizzle - database ORM/schemas
  • just - JS helper library

Client

Contributions

We welcome contributions! Here's some ways to contribute:

  • Report bugs
  • Suggest enhancements
  • Sponsor

License

Project's source code is licensed under the MIT License. Name, Logos and Branding are copyright SocksTheWolf, all rights reserved.

See the LICENSE file for details.


Source hosted on GitHub, mirrored on tangled