Skip to content

gumroad/shortest

Repository files navigation

Shortest

shortest.com

Local Development Setup Guide

This guide will help you set up the Shortest project for local development.

Prerequisites

  • Node.js
  • pnpm

Getting Started

  1. Clone the repository:

    git clone https://github.com/gumroad/shortest.git
    cd shortest
  2. Install dependencies:

    npm install -g pnpm
    pnpm install

For Gumroad Vercel Team Members:

  1. Run vercel env pull to get the latest environment variables

For Other Contributors:

  1. Run pnpm run setup to configure the environment variables.
  2. The setup wizard will ask you for information. Refer to "Services Configuration" section below for more details.

Set up the database:

pnpm drizzle-kit generate
pnpm db:migrate
pnpm db:seed # creates stripe products, currently unused

Services Configuration

You'll need to set up the following services for local development. If you're not a Gumroad Vercel team member, you'll need to either run the setup wizard pnpm run setup or manually configure each of these services and add the corresponding environment variables to your .env.local file:

Clerk
  1. Go to clerk.com and create a new app.
  2. Name it whatever you like and disable all login methods except GitHub. Clerk App Login
  3. Once created, copy the environment variables to your .env.local file. Clerk Env Variables
Vercel Postgres
  1. Go to your dashboard at vercel.com.
  2. Navigate to the Storage tab and click the Create Database button. Vercel Create Database
  3. Choose Postgres from the Browse Storage menu. Neon Postgres
  4. Copy your environment variables from the Quickstart .env.local tab. Vercel Postgres .env.local
Anthropic
  1. Go to your dashboard at anthropic.com and grab your API Key.
    • Note: If you've never done this before, you will need to answer some questions and likely load your account with a balance. Not much is needed to test the app. Anthropic API Key
Stripe
  1. Go to your Developers dashboard at stripe.com.
  2. Turn on Test mode.
  3. Go to the API Keys tab and copy your Secret key. Stripe Secret Key
  4. Go to the terminal of your project and type pnpm run stripe:webhooks. It will prompt you to login with a code then give you your STRIPE_WEBHOOK_SECRET. Stripe Webhook Secret
GitHub OAuth
  1. Create a GitHub OAuth App:

    • Go to your GitHub account settings.
    • Navigate to Developer settings > OAuth Apps > New OAuth App.
    • Fill in the application details:
      • Application name: Choose any name for your app
      • Homepage URL: Set to http://localhost:3000 for local development
      • Authorization callback URL: Use the Clerk-provided callback URL (found in below image) Github OAuth App
  2. Configure Clerk with GitHub OAuth:

    • Go to your Clerk dashboard.
    • Navigate to Configure > Social Connections > GitHub.
    • Select Use custom credentials
    • Enter your Client ID and Client Secret from the GitHub OAuth app you just created.
    • Add repo to the Scopes Clerk Custom Credentials

Running the Application

Once you have set up the environment variables and installed dependencies, run the development server:

pnpm dev

Open http://localhost:3000 in your browser to see the app in action.

Running Tests

To run specs:

pnpm vitest