[TOC]
-
You will need to deploy your frontend to Vercel, backend is optional and you will gain bonus marks if you successfully modified backend and deployed it.
-
There are several steps, please patiently go through each of them.
Deploy deploy deploy 🚀! While having our Bigbrain working locally is fun and all, there's no point if you can't show it off to everyone else 😎!
Normally, we have to run both our frontend & backend on terminal. Vercel however, can handle them for us! All we need to do is to configure our HTTP requests in frontend to go to our deployed URL, instead of our localhost URL.
- Make sure you are in Bigbrain repository.
An image guide is available for some of the instructions below. You can toggle their visibility by clicking on the respective text - for example:
Make sure to also read the tips given by Vercel as you progress. Don't just blindly follow the instructions given, as there will be inputs that you will need to modify accordingly for your needs.
-
A private github account: Vercel requires you to link your repositories to deploy. If you do not currently have an account, you should create one by following the link: https://github.com/signup
-
A Vercel account: Vercel offers us a serverless method to deploy our backend repository. The setup is completely free and does not require any payment methods for sign-up. Create an account and select Continue with GitHub so that your accounts can be linked: https://vercel.com/signup.
Why do all of this?
Visual explanation of what we're trying to do
We're attempting to link our code to Vercel. To do this, we will be using a Github account as an intermediary.-
In a separate window, log in to your GitHub account and select New repository.
-
Name your repository, e.g. "
bigbrain-deploy", and make sure to select Private. Then hit Create Repository. -
Just in case you missed it, please ensure the Github repo is private.
-
You should be automatically navigated to your created repository. Back on your terminal, use the following code to update your GitHub repository.
# Replace <SSH_URL> with your Github repository's SSH URL.
# The SSH URL can be found in the empty Github repo you just created.
# E.g. git@github.com:USERNAME/bigbrain-deploy.git
$ git remote add deploy <SSH_URL>
$ git push deploy
After running the command, your GitHub repository should then be populated with the code from your backend.
NOTE: Whenever you want to update your Github repository (hence Vercel as well), run git push deploy after changes have been added and committed. If you only run git push this will send your changes to Gitlab, not Github.
Getting a "git@github.com: Permission denied (publickey) or similar access rights error? You'll need to add your SSH-Key to Github! Just like we did for Gitlab in git-intro. See instructions below, and then attempt to push again.
- Generate a new SSH Key (optional): https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
- Add SSH key to Github: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
Vercel is a cloud platform as a service company. Vercel architecture is built around composability.
-
Add and commit all changes and push them up to the repository:
$ git push deploy
If you forget to add, commit and push deploy, you may get
404 not_founderrors later on. -
On the Vercel homepage, log into Vercel and then select the
Add New...button andProjectselection. -
Select
Importon the repository that you created in GitHub.Can't see your github repo? Follow the
Adjust GitHub App Permissions →link and instructions. -
Select
Deployto deploy your repository and wait shortly for your repository to be built. Make sure to choose the correct directory for deployment, e.g.backendorfrontend, alternatively you can create separate github repository for frontend and backend.If successful, you should see a "Congratulations" and on your
Dashboardsee your deployment with a green "Ready" Status.First, click on
Inspect Deploymentat the bottom of the page. You should end up on theDeployment Detailspage. If the build log mentionsnpm ERR! code 1go back to your project and click on theSettingstab. Then scroll down and change the Node version to 16. Afterwards, go back to theDeploymentstab and click on the ellipsis button of your latest deployment. Then clickRedeploy. -
Make your deployed url contain your zID. Go to
Project Settings>Domains>Edit, and modify your domain name to include your zID, e.g.z1234444-bigbrain-fe-deploy.vercel.app. -
Congratulations! You've now deployed your frontend onto the web...somewhat. If you navigate to your deployed url, you should see your frontend in action!
However, as soon as you try to make api calls to backend, you'll start running into server errors. This is fine as backend deployment is optional and you will gain bonus marks if you successfully modified backend and deployed it.
Unlike the frontend, it could be hard to configure backend deployment. You will need to figure out how to use Vercel with Upstash for key-value storage and modify how backend handles database operations to use Upstash. It may also be necessary for you to add a vercel.json file to the backend repository to configure the deployment.
You may find these resources helpful:
-
Open progress.csv and modify the
FE_DEPLOYED_URLto your newly deployed site, e.g. https://z1234444-anything-you-want.vercel.app.A reminder that the
FE_DEPLOYED_URLmust contain your zID exactly once. You may need to go to Settings > Domains > and edit your deployed url to include your zID. -
You don't need to add
BE_DEPLOYED_URLinprogress.csvbut you need to connect your deployed frontend with your deployed backend if you have deployed backend.
1. Vercel is not deploying the code you expect
-
Remember to
git add,git commitandgit push deploy. This will ensure that Github and hence Vercel receive your updated code. -
After you've pushed your code to GitHub, ensure the commit hash on GitHub matches the one on Vercel.

-
You can also check if Vercel has the correct files, by clicking on Your project > Source. Ensure that each file is as expected. Check for example if the
DEPLOYED_URLwas updated.
2. Incorrect format for deployed URL
- Ensure the URL begins with
httporhttps. Also check that it doesn't end with/.
3. You've changed branches at some point
- Go to Settings > Git. Scroll down to Production Branch and change the name of the branch.
- Additionally if you go to the Deployments tab, you may see that it says Preview, like in the image below. For the latest deployment, click on the ellipse icon (three horizontal dots) on the very right and click 'Promote to production'.

-
Your project > Deployment > Click on the latest deployment > Log
-
Instead of having
console.logoutput to a terminal, it gets output here. -
Any
console.logstatements in your server or function implementations, will also show here.

2. General tips & Additional resources
-
Debugging can require running
git push deployfrequently. Whenever that occurs, it will redeploy your project. Keep in mind that Vercel only allows 100 deployments a day. -
If deployment is failing during setup, read the error message by going to Your project > Deployment > Click on the latest deployment > Read the deployment details.
- Use
gittoadd,commit, andpushyour changes on your master branch. This time, you don't usegit push deployas that only updates Vercel and Github, not Gitlab. Your GitLab pipeline should also pass. - Check that your code has been uploaded to your Gitlab repository on this website (you may need to refresh the page).
If you have pushed your latest changes to master on Gitlab no further action is required! At the due date and time, we automatically collect your work from what's on your master branch on Gitlab.









