Server Rendering a GitHub Repo

Create a GitHub Personal Access Token

In this app, we are going to fetch files inside a GitHub repository using the GitHub API. To do that, we need to create a token. Creating a GitHub Personal Access Token (PAT) is the simplest way do that.

You can create it from the GitHub's account settings page. Here's how to do it:

Play Now

When you are creating a GitHub PAT, you need to select a scope. Here we need the repo scope only. When you choose the repo scope, your token can read & write any GitHub repository you can access.

So, do not push your accessToken to Git or share it publicly.

Now create a file called .env.local and add the following content:

GITHUB_PAT=<Enter the GitHub PAT you copied>
Q: What's the functionality of the `.env.local` file in this context?

🙏 We need your help

We need your help to keep maintain & add new content to this course. Here's how you can support us: