Skip to content

upstash/purple-squirrel

Repository files navigation

Open-Source Job Application Search Engine

purple-squirrel

Overview

Tech Stack

Deploy your own

Step 1: Clone the repository
  1. Clone the repository:
    git clone https://github.com/upstash/purple-squirrel.git
    cd purple-squirrel
  2. Create a .env file in the root directory, and copy the contents of .env.local.example into it.
  3. Fill the environment variables as described in the next steps.
Alternatively you can use the Vercel Deploy Button:

Deploy with Vercel

Step 2: Connect your mailbox

Note: This tutorial will be based on Gmail, but you can set up an IMAP connection with any other provider. We recommend creating a separate email like [email protected] and forwarding job mails there. You can also create a folder like JOBS and configure the application to read from that folder in the setup step.

  1. Complete the following steps described in this tutorial.
    • Turn on Less secure apps.
    • Create and use App Passwords.
    • Turn on IMAP in Gmail.
  2. Fill the following environment variables in your .env file:
    • IMAP_USERNAME: Your mail address
    • IMAP_PASSWORD: App Password you generated
    • IMAP_HOST: imap.gmail.com
    • IMAP_PORT: 993
Step 3: Set up Upstash
  1. Open an Upstash account.
  2. Switch to Vector tab in Console.
  3. Click Create Index.
  4. Think of a name and select a region close to your users, Embedding Model, Dimensions and Metric should be set like below.
    create-index
  5. Click Next -> Click Create.
  6. Fill the following environment variables in your .env file, which can be found and copied in your index page:
    • UPSTASH_VECTOR_REST_URL: Your endpoint
    • UPSTASH_VECTOR_REST_TOKEN
      env-index
  7. Switch to QStash tab in Console
  8. Fill the following environment variables in your .env file, which can be found and copied in your QStash page:
    • QSTASH_URL
    • QSTASH_TOKEN
      env-qstash

QStash free plan has a limit of 500 messages per day. This will limit your mail pipeline to approximately 200 applicants per day. We recommend upgrading to the pay as you go plan. See QStash Pricing for more information.

Step 4: Set up uploadthing
  1. Sign in to uploadthing.
  2. Click Create a new app.
  3. Think of a name and select an app default region close to your users.
    create-uploadthing
  4. Fill the following environment variables in your .env file, which can be found and copied in the API Keys tab:
    • UPLOADTHING_TOKEN
      env-uploadthing
Step 5: Set OpenAI API key
  1. Go to OpenAI Platform -> API keys and login to your account.
  2. Click Create new secret key.
  3. Enter a name and click Create secret key.
    openai-key
  4. Don't forget to copy and save your key. Fill the following environment variable in your .env file:
    • OPENAI_API_KEY
Step 6: Set up Basic Auth
  1. Decide if you want Basic Auth in your application, and set the following environment variable in your .env file:
    BASIC_AUTH_ENABLED=true
    or
    BASIC_AUTH_ENABLED=false
  2. If you want Basic Auth, fill the following environment variables in your .env file:
    • BASIC_AUTH_USERNAME
    • BASIC_AUTH_PASSWORD
Step 7: Deploy & Setup
  1. Deploy your application to Vercel with the following command:
    vercel
  2. Go to your project at Vercel Dashboard for the next steps.
  3. Learn the Production Domain of your application from the Project tab.
    domain
  4. Go to Settings -> Environment Variables, copy and paste your .env file.
  5. Fill the following environment variable with the Production Domain (Not the Deployment URL) of your application:
  6. Go to the Deployments tab and redeploy your application.
    redeploy
  7. Visit https://your-app.vercel.app/setup to set up your application.
setup

→ Your application is ready to use!

Local development

A local tunnel is required in local development since QStash requires a publicly available API to send messages to. This tutorial is based on localtunnel.me but you can use any service of your choice.

Step 1: Create a local tunnel
npx localtunnel --port 3000
Step 2: Fill environment variables

Copy the output URL and fill the following environment variable in .env.local

LOCAL_TUNNEL_URL=<YOUR_URL>

Fill the rest of the environment variables in .env.local as described in the Deploy your own section.

Step 3: Install dependencies & run the project
npm install
npm run dev
Step 4: Setup
  1. Visit http://localhost:3000/setup to set up your application.
setup

→ Your application is ready to use!

In local development, mail pipeline is triggered only once instead of creating a schedule since local server is not expected to be always available.

Contributing

We welcome contributions to improve this project. Please feel free to submit issues or pull requests.