GithubHelp home page GithubHelp logo

remotion-dev / github-unwrapped-2021 Goto Github PK

View Code? Open in Web Editor NEW
47.0 2.0 9.0 3.34 MB

The source code for #GitHubUnwrapped 2021

Home Page: https://2021.githubunwrapped.com

JavaScript 0.20% TypeScript 99.63% CSS 0.14% Shell 0.03%
github remotion unwrapped

github-unwrapped-2021's Introduction

This is the repo for the 2021 version. Go to the 2022 version!

Try it out live: https://2021.githubunwrapped.com

A platform that generates a year in review video for each GitHub user. Built with Next.JS, Remotion and AWS Lambda.

Scaling strategy

To allow hundreds of people to render their video at the same time, we applied multiple strategies for scaling:

  • Caching the video whenever possible. Before each render, a database lock is created to avoid multiple renders for the same GitHub user to be accidentally created.
  • A random region will be selected for each render to distribute renders to avoid hitting the concurrency limit.
  • Two AWS sub-accounts are used for rendering which each have their own concurrency limit of 1000 functions in parallel per region. In hindsight, it would have been easier to ask AWS for an increase.

Setup

  1. Run yarn to install dependencies.
  2. Rename .env.example to .env
  3. Set up your AWS account according to the Remotion Lambda Setup guide. We use multiple accounts for load-balancing:
    • Use AWS_KEY_1 instead of REMOTION_AWS_ACCESS_KEY_ID and AWS_SECRET_1 instead of REMOTION_AWS_SECRET_ACCESS_KEY.
    • You can use AWS_KEY_2 and AWS_SECRET_2 to load-balance between two accounts, or paste the same credentials as before to use the same account.
    • In src/set-env-for-key.ts, we rotate the environment variables.
  4. Deploy the functions into your AWS account(s):
    yarn deploy
    
  5. For caching the videos and GitHub API responses, set up a MongoDB (I use a free MongoDB Atlas Cloud instance) to save the videos. Set the connection string as MONGO_URL
  6. For fetching data from GitHub, create a personal access token in your user settings and set it as GITHUB_TOKEN.

You now have all environment variables.

Run the web app:

npm run dev

Edit the template in the Remotion preview:

npm run preview

To deploy, connect your repository to Vercel or Heroku.

Don't forget to also set the environment variables there too.

License

The code in this repository: Licensed under MIT.
The Remotion library: Notice that for some entities a company license is needed. Read the terms here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.