Deployment¶
tldrq runs on three services: Supabase holds the data and handles sign-in, Vercel runs the Next.js app, and GitHub Pages serves this documentation. Setting up a new deployment takes five steps.
1. Supabase project¶
- Create a project at supabase.com.
- Open its SQL editor and run
supabase/schema.sql(see Database). - From the project's API settings, copy the project URL and the anon public key. They become
NEXT_PUBLIC_SUPABASE_URLandNEXT_PUBLIC_SUPABASE_ANON_KEY.
Warning
schema.sql drops the application's tables and function before creating them. Never run it against a
database whose data you want to keep.
2. OAuth providers¶
The sign-in page offers exactly two providers, GitHub and Google. Enable both in Supabase's Auth providers. Each needs an OAuth app at the provider whose callback is Supabase's, not tldrq's:
- In Google Cloud Console, create an OAuth client ID for a web application.
- Add
https://<project-ref>.supabase.co/auth/v1/callbackas an authorized redirect URI. - Paste the client ID and secret into Supabase's Google provider, and enable it.
- In GitHub Developer Settings, create an OAuth App.
- Set its authorization callback URL to
https://<project-ref>.supabase.co/auth/v1/callback. - Paste the client ID and secret into Supabase's GitHub provider, and enable it.
3. URL configuration¶
In Supabase's Auth URL configuration:
- Site URL: the production URL,
https://tldrq.com. -
Redirect URLs: every address sign-in may return to. Sign-in returns to the origin it started from, so list each one:
https://tldrq.com/auth/callback https://tldrq.com/auth/callback-desktop http://localhost:3000/auth/callbackThe second is for the desktop app, the third for local development. Add any preview deployment's origin you want to sign in on too. See Authentication.
4. Vercel¶
- Import the GitHub repository into Vercel as a Next.js project.
- Add the environment variables, for both the Production and Preview environments:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYSLACK_WEBHOOK_URL(optional; see Configuration)
- Deploy, then add the custom domain.
From then on, Vercel deploys master to production and builds a preview deployment for every pull request. Its
checks, "Vercel" and "Vercel Preview Comments", are required before merging to master
(see Branch protection).
Next.js inlines the NEXT_PUBLIC_ variables at build time, so redeploy after changing them.
5. Verify¶
Work through this checklist after a new deployment, or after changing auth or environment settings:
- Visiting the site signed out redirects to
/login. - Signing in with GitHub works, and so does signing in with Google.
- The four default collections (Videos, Tweets, Articles, Repos) exist after the first sign-in.
- Saving a YouTube URL files it in Videos, with a thumbnail.
- Saving a GitHub repository files it in Repos, with stars and forks.
- A share link opens in a private browser window, without signing in.
- Desktop sign-in completes, if you use the desktop app.
- A sign-in message arrives in Slack, if
SLACK_WEBHOOK_URLis set.
The desktop app¶
The desktop app has nothing to deploy: it loads https://tldrq.com, so it picks up every web deploy. Users build
the DMG themselves (Desktop App Internals).
The docs site¶
This site is built and published by .github/workflows/docs.yml to GitHub Pages at https://docs.tldrq.com; see
CI, Dependencies & Releases.