Back to X Sched

Deploying X Sched

After you purchase X Sched, you’ll get an email with a license key and a private link to a zip file. Download and extract the zip file.

The extracted folder contains the minified X Sched code that you need to deploy to Vercel. Before doing that, open the .env file in a text editor (e.g., VS Code, Sublime Text).

Tip: Nearly every section includes a screen recording that demonstrates the required task. It's highly recommended to watch them

.env file

This file contains all the API keys and configurations required for running X Sched. It’s the only file you need to configure before deploying X Sched.

LICENSE_KEY=__REPLACE_THIS__ 

X_API_KEY=__REPLACE_THIS__
X_API_SECRET=__REPLACE_THIS__

INNGEST_EVENT_KEY=__REPLACE_THIS__
INNGEST_SIGNING_KEY=__REPLACE_THIS__

UPLOADTHING_SECRET=__REPLACE_THIS__
UPLOADTHING_APP_ID=__REPLACE_THIS__

POSTGRES_URL=__REPLACE_THIS__

NEXTAUTH_SECRET=__REPLACE_THIS__

First step: Copy and paste the license key you received and set it as the value for the LICENSE_KEY environment variable.

.env file
LICENSE_KEY=25B973EE-example-A7497846-710GE48F

X_API_KEY=KpLwiN-example-cdGlq
X_API_SECRET=RpZOntDVcLOyUDEJ-example-cwbenC7oioxfddcsHnb45

INNGEST_SIGNING_KEY=__REPLACE_THIS__
INNGEST_EVENT_KEY=__REPLACE_THIS__

UPLOADTHING_SECRET=__REPLACE_THIS__
UPLOADTHING_APP_ID=__REPLACE_THIS__

POSTGRES_URL=__REPLACE_THIS__

NEXTAUTH_SECRET=__REPLACE_THIS__

Next, we’ll go through how to retrieve the values for the other environment variables.

Requirements

The setup uses bash, so make sure it’s available in your environment. If you’re on Windows, consider using Git BASH). On Unix-based systems (OSX, Linux), bash is the default.

You also need the latest Node.js LTS version with NPM installed.

You don’t need to have existing accounts for the required services. However, if you’re already signed up, you can use your existing accounts.

Setting up services

X Sched depends on the following APIs and services. You need to be signed up or create an account for each of them:

  • X API – Needed for posting on X
  • Inngest – Used for scheduling threads and other background tasks
  • Uploadthing – Stores all the images and videos
  • Vercel – Hosts your X Sched instance
Tip: I recommend using the GitHub login option since all these services support it and the signup process is smoother compared to email.

X API

Visit the X Developer Portal and click "Sign up for Free Account". On the next screen, fill out the field "Describe all of your use cases of Twitter’s data and API" by copying and pasting the following text:

I aim to use the Twitter API for scheduling, publishing, and managing content through a tool called X Sched. This tool will streamline my Twitter content management by allowing me to create, edit, and schedule tweets in advance. Additionally, X Sched will utilize the API for uploading media such as images and videos, which will be included in posts

On the next page, click "Create Project". Name your project, e.g., "X Sched". For "Use case", choose "Doing something else", and copy and paste the text from before into the "Project description" field. Name your new app, e.g., "X Sched - Your Name". The name has to be unique.

If everything goes smoothly, you should see a screen with your API Key and API Key Secret. Copy these two values into the .env file and replace the values of X_API_KEY and X_API_SECRET with them.

.env file
LICENSE_KEY=25B973EE-example-A7497846-710GE48F

X_API_KEY=KpLwiN-example-cdGlq
X_API_SECRET=RpZOntDVcLOyUDEJ-example-cwbenC7oioxfddcsHnb45

INNGEST_EVENT_KEY=__REPLACE_THIS__
INNGEST_SIGNING_KEY=__REPLACE_THIS__

UPLOADTHING_SECRET=__REPLACE_THIS__
UPLOADTHING_APP_ID=__REPLACE_THIS__

POSTGRES_URL=__REPLACE_THIS__

NEXTAUTH_SECRET=__REPLACE_THIS__

We’ll configure the callback URLs for our X app later, but for now, let’s continue with the other services.

Inngest

Sign up to Inngest and go through the onboarding process. Click on "Sync App" and copy the INNGEST_SIGNING_KEY. Leave the App URLinput empty for now. We’ll return to it later. At the top of the page, switch to the "Events" tab and also copy the INNGEST_EVENT_KEY. Add both values to the .env file.

.env file
LICENSE_KEY=25B973EE-example-A7497846-710GE48F

X_API_KEY=KpLwiN-example-cdGlq
X_API_SECRET=RpZOntDVcLOyUDEJ-example-cwbenC7oioxfddcsHnb45

INNGEST_SIGNING_KEY=signkey-prod-b5df744sfafum9ddb-example-d04af372545390e82b4ec194
INNGEST_EVENT_KEY=CjNQTU1v9H_A2Ph0ktXQM2y5yEdfsfi7xp-example-sDGTo78eBRN4J9rfJby8ScVZw

UPLOADTHING_SECRET=__REPLACE_THIS__
UPLOADTHING_APP_ID=__REPLACE_THIS__

POSTGRES_URL=__REPLACE_THIS__

NEXTAUTH_SECRET=__REPLACE_THIS__

Uploadthing

Sign up to Uploadthing, create a new app, and copy the UPLOADTHING_SECRET and UPLOADTHING_APP_ID into the .env file

⚠️ You can't switch the default region on the free plan
.env file
LICENSE_KEY=25B973EE-example-A7497846-710GE48F

X_API_KEY=KpLwiN-example-cdGlq
X_API_SECRET=RpZOntDVcLOyUDEJ-example-cwbenC7oioxfddcsHnb45

INNGEST_SIGNING_KEY=signkey-prod-b5df744sfafum9ddb-example-d04af372545390e82b4ec194
INNGEST_EVENT_KEY=CjNQTU1v9H_A2Ph0ktXQM2y5yEdfsfi7xp-example-sDGTo78eBRN4J9rfJby8ScVZw

UPLOADTHING_SECRET=sk_live_88c4b8c3a7fbf-example-44f69b1b656c80bfb8d38703ef42f35
UPLOADTHING_APP_ID=t3f-example-sy4

POSTGRES_URL=__REPLACE_THIS__

NEXTAUTH_SECRET=__REPLACE_THIS__

Vercel

Create a Vercel account. Before we deploy X Sched, we need to set two more environment variables.

To get the POSTGRES_URL, open the Vercel dashboard and navigate to the "Storage" tab where you can create a new Postgres instance.

Open the detail view of the newly created Postgres instance, click on the ".env.local" tab and copy the POSTGRES_URL

.env file
LICENSE_KEY=25B973EE-example-A7497846-710GE48F 

X_API_KEY=KpLwiN-example-cdGlq
X_API_SECRET=RpZOntDVcLOyUDEJ-example-cwbenC7oioxfddcsHnb45

INNGEST_SIGNING_KEY=signkey-prod-b5df744sfafum9ddb-example-d04af372545390e82b4ec194
INNGEST_EVENT_KEY=CjNQTU1v9H_A2Ph0ktXQM2y5yEdfsfi7xp-example-sDGTo78eBRN4J9rfJby8ScVZw

UPLOADTHING_SECRET=sk_live_88c4b8c3a7fbf-example-44f69b1b656c80bfb8d38703ef42f35
UPLOADTHING_APP_ID=t3f-example-sy4

POSTGRES_URL=postgres://default:dU-example-q@ep-lucky-dew-189934-pooler.eu-central-1.postgres.vercel-storage.com/verceldb?sslmode=require

NEXTAUTH_SECRET=__REPLACE_THIS__
Tip: You can also use a different Postgres provider such as Supabase or Neon

NEXTAUTH_SECRET

Before deploying X Sched, we need to set the NEXTAUTH_SECRET, the last environment variable. This variable is used internally to encrypt the session. Either use a long, difficult-to-guess string or copy and paste the following randomly generated value:

.env file
LICENSE_KEY=25B973EE-example-A7497846-710GE48F 

X_API_KEY=KpLwiN-example-cdGlq
X_API_SECRET=RpZOntDVcLOyUDEJ-example-cwbenC7oioxfddcsHnb45

INNGEST_SIGNING_KEY=signkey-prod-b5df744sfafum9ddb-example-d04af372545390e82b4ec194
INNGEST_EVENT_KEY=CjNQTU1v9H_A2Ph0ktXQM2y5yEdfsfi7xp-example-sDGTo78eBRN4J9rfJby8ScVZw

UPLOADTHING_SECRET=sk_live_88c4b8c3a7fbf-example-44f69b1b656c80bfb8d38703ef42f35
UPLOADTHING_APP_ID=t3f-example-sy4

POSTGRES_URL=postgres://default:dU-example-q@ep-lucky-dew-189934-pooler.eu-central-1.postgres.vercel-storage.com/verceldb?sslmode=require

NEXTAUTH_SECRET=d2927096-example-35e5ad672a4f

Now all environment variables in your .env file should have a value, and we are ready to deploy X Sched to Vercel.

Deployment 🚀

cd into the extracted X Sched directory and run the following command:

npx zx ./deploy.mjs

This command applies the necessary database migrations and deploys the app to Vercel

You might need to log into your Vercel account if this is your first time using the Vercel CLI on your machine. If you get an error such as "Error: No existing credentials found. Please run `vercel login`", run npx vercel login first, and then the deploy command again

If you now open the Vercel dashboard, you should see your X Sched instance. Click on the link under the app’s name to visit the website.

X Sched instance link

Configuring App URLs

X Callback URL

For the last step, copy your app’s URL and go back to the X Developer Portal. Go to your app’s settings and click on the "Set up" button under "User authentication settings".

Select "Read and write and Direct message", turn on "Request email from users", choose "Web App, Automated App or Bot" as the type of your app, and set the callback URL like this (adjust the first part):

https://YOUR-XSCHED-INSTANCE.vercel.app/api/auth/callback/twitter

Also use your X Sched URL as the "Website URL", "Terms of service" and "Privacy policy". Finally click "Save" and you’re done here.

Inngest App URL

Open the Inngest dashboard and click on "Sync app". Enter the following URL in the App URL field (adjust the first part):

https://YOUR-XSCHED-INSTANCE.vercel.app/api/inngest

Click on "Sync App" and you’re also done here

Enjoy 🎉

Open your X Sched instance and log in with your X credentials. Publish a post or schedule a thread for later. Upload an image, save a draft, and perfect it before publishing. The initial setup might have been a bit tedious, but now you’re done and can use X Sched forever.

f you’re struggling with anything in this guide or something doesn’t work as expected, please don’t hesitate to DM me on X


How to Update a Deployed Version

Updating your deployed version is straightforward. Follow these steps:

  1. Download the latest version of X Sched from Gumroad.
  2. Unzip the downloaded file.
  3. Replace the .env values. You can either add the new values manually or replace the .env file with the one from your last deployed version.
  4. cd into the unzipped directory and run the following command:
    npx zx ./deploy.mjs
  5. Follow the CLI prompts to link your local project to the existing X Sched deployment on Vercel.
  6. If successful, the update will be deployed to your existing X Sched instance.

X Sched