livepeer / livepeer/studio

implement vanity URLs

Open
#200 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
88
Forks
37
PR merge metrics
No merged PRs in 30d

Description

Now that we have the API server talking to Consul we can do pretty much whatever we want for vanity URLs. Off the top of my head, I like the idea of having users pick an "account name" and using that as a slug in the first part of the URL. Basically:

Old: `https://cdn.livepeer.com/hls/q6h6uwjf3oe63liv/index.m3u8`
New: `https://cdn.livepeer.com/livepeer/iameli/index.m3u8`

Rough implementation:
1. New field on `user` called `slug`. In my example, it would be set to `livepeer`.
1. New database table and API endpoints for `/api/vanity-url`. Fields: `{id, streamId, slug}`. For my example stream, my `slug` would be "iameli".
1. When a new stream activates (`POST /api/stream/:id/setactive`) check to see if that streamId has a `vanity-url`. If so, create a Consul route like so:
```
/{user.slug}/{vanityUrl.slug}/* --> /hls/{stream.id}/*
```
Simple as that.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the API server's user and stream handling, the database schema, and the POST /api/stream/:id/setactive path. Trace how Consul routes are created, then define the user slug and /api/vanity-url data and endpoints. Done means an active stream with a vanity URL creates the specified /{user.slug}/{vanityUrl.slug}/* route to /hls/{stream.id}/*.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.