My App

Convex Setup

Convex is hosted on two different types of URLs:

  • CONVEX_URL (e.g. abcd.convex.cloud) - The main URL for Convex queries and mutations.
  • CONVEX_SITE_URL (e.g. abcd.convex.site) - The URL for HTTP Actions on Convex.

Why do we need both?

While we are using Convex for our application, the authentication is provided by the better-auth package. better-auth is hosted through the HTTP Actions feature of Convex, which requires a separate URL (CONVEX_SITE_URL) to function properly.

Convex Environment Variables

Currently, there are the following ENV Vars on Convex (set them up in your dashboard):

  • BETTER_AUTH_SECRET - Generate one locally with openssl rand -base64 32
  • WEB_DEPLOYMENT_URL - Where the Next.js app is running. Recommend to be set as http://localhost:3000 for development.
  • CONVEX_SITE_URL - Usually in the format https://some-phrase-num.convex.site. This variable should be auto injected by Convex.