# Deploy on your own
Since the GitHub API only allows a limited number of requests per hour, my `https://github-stats-extended.vercel.app/api` could possibly hit the rate limiter. If you host it on your own Vercel server, then you do not have to worry about anything. Also, if you don't want to give my GitHub-Stats-Extended instance access to your private contributions but still want to include these contributions in your stats, you can simply host your own instance.
## First step: get your Personal Access Token (PAT)
For deploying your own instance of GitHub Stats Extended, you will need to create a GitHub Personal Access Token (PAT). Below are the steps to create one and the scopes you need to select for both classic and fine-grained tokens.
Selecting the right scopes for your token is important in case you want to display private contributions on your cards.
### Classic token
* Go to [Account -> Settings -> Developer Settings -> Personal access tokens -> Tokens (classic)](https://github.com/settings/tokens).
* Click on `Generate new token -> Generate new token (classic)`.
* Scopes to select:
* repo
* read:user
* Click on `Generate token` and copy it.
### Fine-grained token
> [!WARNING]\
> This limits the scope of commits to public repositories only.
* Go to [Account -> Settings -> Developer Settings -> Personal access tokens -> Fine-grained tokens](https://github.com/settings/personal-access-tokens).
* Click on `Generate new token -> Generate new token`.
* Enter a token name
* Select an expiration date
* Select `All repositories`
* Scopes to select under `Permissions`:
* Commit statuses: read-only
* Contents: read-only
* Issues: read-only
* Metadata: read-only (added automatically when selecting above scopes)
* Pull requests: read-only
* Click on `Generate token` and copy it.
## On Vercel
### :film\_projector: [Check Out Step By Step Video Tutorial By @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107)
Click on the deploy button to get started!
[](https://vercel.com/import/project?template=https://github.com/stats-organization/github-stats-extended)
:hammer_and_wrench: Recommended: Step-by-step guide on setting up your own Vercel instance
1. Go to [vercel.com](https://vercel.com/).
2. Click on `Log in`.

3. Sign in with GitHub by pressing `Continue with GitHub`.

4. Sign in to GitHub and allow access to all repositories if prompted.
5. Fork this repo.
6. Go back to your [Vercel dashboard](https://vercel.com/dashboard).
7. To import a project, click the `Add New...` button and select the `Project` option.

8. Search for the forked Git Repository and import it by clicking the `Import` button.
9. Create a Personal Access Token (PAT) as described in the [previous section](#first-step-get-your-personal-access-token-pat).
10. Add the PAT as an environment variable named `PAT_1` (as shown).

11. As `Root directory` select the `apps/backend` folder.
12. Click deploy, and you're good to go. See your domains to use the API!
13. optional: add an SQL database; by using e.g. the ["Nile" integration](https://vercel.com/marketplace/nile) or by manually setting the environment variable `POSTGRES_URL`
14. optional: [create your own OAuth App](https://github.com/settings/developers) and set environment variables `OAUTH_REDIRECT_URI`, `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` on Vercel accordingly
15. optional: in addition to the Vercel project based on the `apps/backend` folder, create a second project based on the `apps/frontend` folder. No environment variables needed.
:hammer_and_wrench: Step-by-step guide for deploying on other platforms
1. Fork or clone this repo as per your needs
2. Move `express` from the devDependencies to the dependencies section of `package.json`
| Name | Description | Supported values |
|---|---|---|
CACHE_SECONDS |
Sets the cache duration in seconds for the generated cards. This variable takes precedence over the default cache timings for the public instance. If this variable is not set, the default cache duration is 24 hours (86,400 seconds). | Any positive integer or 0 to disable caching |
WHITELIST |
A comma-separated list of GitHub usernames that are allowed to access your instance. If this variable is not set, all usernames are allowed. | Comma-separated GitHub usernames |
GIST_WHITELIST |
A comma-separated list of GitHub Gist IDs that are allowed to be accessed on your instance. If this variable is not set, all Gist IDs are allowed. | Comma-separated GitHub Gist IDs |
EXCLUDE_REPO |
A comma-separated list of repositories that will be excluded from stats and top languages cards on your instance. This allows repository exclusion without exposing repository names in public URLs. This enhances privacy for self-hosted instances that include private repositories in stats cards. | Comma-separated repository names |
FETCH_MULTI_PAGE_STARS |
Enables fetching all starred repositories for accurate star counts, especially for users with more than 100 repositories. This may increase response times and API points usage, so it is limited to 10 fetches - i.e. 1000 repos - on the public instance. | true or false or a maximum number of fetches |