Link Shortener (ft. Convex custom domains)
You might see cvx.so links around Convex content, such as https://cvx.so/fireship for our recent fireship ad campaign.
For the last 18+ months, this short link service has been powered by a Convex project:
https://github.com/jamwt/convex-link-shortener
Shamefully though, this redirection service has delivered an entire react app to your browser to work. That app established a connection to a Convex deployment, and resolved the domain / path to a full URL using a Convex query. Finally, the app issued a
window.location.replace to achieve the redirection.Code here: https://github.com/jamwt/convex-link-shortener/blob/main/src/App.jsx#L6
While this works, it's extremely heavyweight for a link shortener. It also means
curl and other things that don't run JavaScript are out of luck. But since Convex didn't have custom domains, it was the only way to go.Well, fast forward to today! We just added an HTTP endpoint at the .site URL:
https://github.com/jamwt/convex-link-shortener/commit/2c480aad962c66c7f7bf74c6970ee1be921150ca#diff-22ae6ac3563719a97f99af3980d10844cb0544e14f25f6c2ca41155c4c86eea5
Then, using Convex's brand new "custom domains" feature, we're aliasing
cvx.so to the HTTP action domain, aromatic-magpie-742.convex.site. Voila! A high-perf redirection service without any react app needed.I've kept the react app in the codebase in case you want to use that method, though. Feel free to use this link shortener for anything you need.
This custom domain feature will be released to Convex Pro customers... very soon.
Happy to answer any questions about custom domains, this link shortener, or headless service development on Convex.

