Schedule posts to Bluesky with Cloudflare workers. skyscheduler.work
cf tool bsky-tool cloudflare bluesky schedule bsky service social-media cloudflare-workers
at main 192 lines 7.1 kB view raw view rendered
1# SkyScheduler 2 3[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 4[![Deploy to Cloudflare Workers](https://img.shields.io/badge/deploy-cloudflare_workers-F38020?logo=cloudflareworkers)](https://deploy.workers.cloudflare.com/?url=https://github.com/socksthewolf/skyscheduler) 5 6![SkyScheduler Dashboard](/assets/dashboard.png) 7 8## Overview 9 10SkyScheduler is a lightweight 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. 11 12## Features 13 14- **Multiple user/account handling**: Manage multiple users/bsky accounts easily 15- **Bluesky Post Scheduling**: Schedule multiple posts to your Bluesky account 16- **Hourly Time Slots**: Time selection is limited to hourly intervals to optimize worker execution and reduce unnecessary runs 17- **Post Threading**: Schedule entire post threads with full media support per post! 18- **Simple Setup**: Fairly minimal setup and easy to use 19- **Supports media posts**: Automatically handles content tagging and formatting your media so that it looks the best on BSky. Image transforms via Cloudflare Images 20- **Handles Link Embeds**: Post your content with a link embed easily! 21- **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 22- **Repost anything**: Need to retweet something made out of SkyScheduler? Yeah, you can. 23- **Invite Keys**: Want to throttle the signups to your portal or keep the pool to friends/org only? Use invite keys to manage signups 24 25## Getting Started 26 27### Prerequisites 28 29- Node.js (v24.11 or later) 30- Package Manager 31- Cloudflare Pro Workers account (you will hit CPU limits otherwise) 32 33### Installation 34 351. Clone the repository 36 37```bash 38git clone https://github.com/socksthewolf/skyscheduler.git 39cd skyscheduler 40``` 41 422. Copy environment variables template 43 44```bash 45cp .dev.vars.example .dev.vars 46``` 47 483. Configure your `.dev.vars` file with the following environment variables: 49 - `BETTER_AUTH_SECRET` - the cryptographic hash to use better auth ([you can generate one from this page](https://www.better-auth.com/docs/installation)) 50 - `BETTER_AUTH_URL` - the working url of your site (this should be "*" in dev). 51 - `DEFAULT_ADMIN_USER` - the admin bsky handle 52 - `DEFAULT_ADMIN_PASS` - the admin password 53 - `DEFAULT_ADMIN_BSKY_PASS` - the above account's bsky app password 54 - `TURNSTILE_PUBLIC_KEY` - the turnstile public key for captcha 55 - `TURNSTILE_SECRET_KEY` - the turnstile secret key for captcha 56 - `RESIZE_SECRET_HEADER` - a header value that will be included on requests while trying to resize images. Protects the resize bucket while still making it accessible to CF Images. 57 58**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>`. 59 60_Alternatively_, make a file like `.env.prod` and use `npx wrangler secret bulk FILENAME` to upload all the settings at once. 61 624. Update your `wrangler.toml` with changes that reflect your account. 63 - You'll need to update the values for the kv, r2, queues, d1 to reflect the bindings on your account. 64 - Also make sure you update the `BETTER_AUTH_URL` to your working url as well. 65 - Do remember to update/remove the domain bindings! 66 675. Install dependencies 68 69```bash 70npm install 71``` 72 736. Run the development server 74 75```bash 76npm run dev 77``` 78 797. Deploy the application to Cloudflare Workers. You might need to login to your Cloudflare account if you haven't already. 80 81```bash 82npm run deploy 83``` 84 858. Create your D1 tables using the following command, this will set up your tables both locally and remotely. 86 87**NOTE**: If you encounter issues running remotely, you can run the command again. 88 89```bash 90npm run migrate:all 91``` 92 939. Modify any site information located in: 94 95 - `limits.ts` - site configuration and application limits 96 - `siteinfo.ts` - site information such as name, description, domain, etc 97 - `.ssclirc` - sitemap domain 98 - `site.webmanifest` - naming and color schemes 99 10010. Run your application and go to `/setup`. This will create the admin account. 101 102## Configuration 103 104### Environment Variables 105 106Ensure you have configured the `.dev.vars` file with the necessary credentials and settings. The file is git-ignored to protect your sensitive information. 107 108### Application Variables 109 110Most of the application can be modified with `wrangler.toml`'s vars section or via `src/limits.ts`. Both files are heavily commented to explain what the options control. 111 112### Site Variables 113 114Modifying key values such as meta tag data, the application name and any descriptions is fully controlled via `src/siteinfo.ts`. Changing these fields will modify the rest of the application's web output. 115 116### Minimization 117 118The application by default is configured to use the minified versions of the scripts in `assets/js` and `assets/css`. By default, all minimized files will rebuild whenever any typescript file is changed or the application is deployed/ran. 119 120## Project Structure 121 122```text 123skyscheduler/ 124├── assets/ 125│ ├── css/ 126│ ├── dep/ 127│ ├── icons/ 128│ ├── js/ 129│ └── thumbs/ 130├── src/ 131│ ├── auth/ 132│ ├── classes/ 133│ ├── db/ 134│ ├── endpoints/ 135│ ├── layout/ 136│ ├── middleware/ 137│ ├── pages/ 138│ ├── utils/ 139│ └── validation/ 140├── migrations/ 141├── .dev.vars 142├── .node-version 143├── .markdownlint.json 144├── .minify.json 145├── .ssclirc 146├── drizzle.config.ts 147├── package.json 148├── tsconfig.json 149└── wrangler.toml 150``` 151 152### Middleware Stack 153 154#### Server 155 156- BetterAuth - site login/authentication 157- BetterAuthCloudflare - helper for BetterAuth on CF 158- hono - request routing/processing 159- uuid - id generation 160- zod - data validation 161- image-dimensions - image data validation 162- date-fns - date processing helpers 163- drizzle - database orm/schemas 164- just - js helper library 165- human-id - passphrase generation for invite keys 166 167#### Client 168 169- htmx - client requests and responsiveness 170- tribute - client autocomplete library 171- toastify - client notifications 172- dropzone - file upload negotiation 173- pico - styling, tabs, modals 174- countable - dynamic input counter 175 176## Contributions 177 178We welcome contributions! Here's some ways to contribute: 179 180- Report bugs 181- Suggest enhancements 182- [Sponsor](https://ko-fi.com/socksthewolf/tip) 183 184## License 185 186This project's source code is licensed under the MIT License 187Name, Logos and Branding are copyright SocksTheWolf, all rights reserved. 188 189See the [LICENSE](LICENSE) file for details. 190 191--- 192_Source hosted on [Github](https://github.com/SocksTheWolf/SkyScheduler), mirrored on [tangled](https://tangled.org/socksthewolf.com/skyscheduler)_