Levercast

Self-Hosting

Deploy your own instance of Levercast.

Levercast is a Next.js application that can be self-hosted on Vercel or any platform that supports Node.js.

Tech Stack

ComponentTechnology
FrameworkNext.js 15 (App Router)
AuthenticationClerk
DatabaseNeon (Serverless Postgres)
ORMDrizzle
AIVercel AI SDK + OpenAI (GPT-4o-mini)
File StorageVercel Blob
StylingTailwind CSS 4 + shadcn/ui
AnalyticsPostHog

Prerequisites

  • Node.js 18+
  • A Neon Postgres database
  • A Clerk application (dev or production)
  • An OpenAI API key

Environment Variables

Copy .env.example to .env.local and fill in the required values:

Required

VariableDescription
DATABASE_URLNeon Postgres connection string
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYClerk publishable key
CLERK_SECRET_KEYClerk secret key
OPENAI_API_KEYOpenAI API key for reformatting

Platform Connections

VariableDescription
LINKEDIN_CLIENT_IDLinkedIn OAuth app client ID
LINKEDIN_CLIENT_SECRETLinkedIn OAuth app client secret
LINKEDIN_REDIRECT_URILinkedIn OAuth callback URL
X_CLIENT_IDX OAuth 2.0 client ID
X_CLIENT_SECRETX OAuth 2.0 client secret
X_REDIRECT_URIX OAuth callback URL (optional for local dev)
FACEBOOK_APP_IDFacebook app ID for Instagram
FACEBOOK_APP_SECRETFacebook app secret
FACEBOOK_REDIRECT_URIInstagram OAuth callback URL

Optional

VariableDescription
CLERK_WEBHOOK_SIGNING_SECRETWebhook secret for Clerk user sync
CIRCLE_API_BASE_URLCircle API base URL (default: https://app.circle.so)
INSTAGRAM_DEFAULT_IMAGE_URLFallback image for Instagram posts
BLOB_READ_WRITE_TOKENVercel Blob token for image uploads
CRON_SECRETSecret for the scheduled publish cron endpoint
NEXT_PUBLIC_POSTHOG_KEYPostHog project API key
NEXT_PUBLIC_POSTHOG_HOSTPostHog ingest host (default: /ingest)

Database Setup

Levercast uses Drizzle ORM with Neon Postgres. Run migrations to set up the schema:

npx drizzle-kit generate   # generate migration files
npx drizzle-kit migrate    # apply migrations

Running Locally

npm install
npm run dev

The dev server starts at http://localhost:3847.

Deploying to Vercel

  1. Push your code to a Git repository
  2. Import the project in Vercel
  3. Add all environment variables in Vercel Dashboard → Settings → Environment Variables
  4. Deploy

Clerk Webhook

For user sync, add a webhook in the Clerk Dashboard pointing to:

https://your-domain/api/webhooks/clerk

Set the CLERK_WEBHOOK_SIGNING_SECRET environment variable to the signing secret from Clerk.

Cron Jobs

For scheduled post publishing, configure a Vercel Cron job to hit /api/cron/publish. Set the CRON_SECRET environment variable to match the secret Vercel sends with cron requests.

On this page