Skip to content

Fork the repository

Why you must work from your own fork, and how to fork, clone and test it.

About 15 min · Verified 8 October 2026

0 of 6 steps done0%

Why you must fork, and what breaks if you do not#

The workshop app lives in a public repository owned by the instructor: Amaan-Khan14/shortlink. It is tempting to skip the fork and use that repository directly, because cloning works without one. Do not. Four things go wrong, and the first two only show up later, in the CI/CD guides.

A fork is your own copy under your own GitHub account. You can push to it, you can install the GitHub App on it, and you can edit files such as the buildspec without affecting anyone else. You can still pull in future instructor changes from the original (called upstream).

Fork and clone#

Fork the repository on GitHub#

Open github.com/Amaan-Khan14/shortlink and click ForkCreate a new fork.

  • Owner: your own GitHub account (not an organisation you do not control).
  • Repository name: keep shortlink unless you have a reason to rename it. If you rename it, enter the new name under My values.
  • Copy the main branch only: leave this checked.

Click Create fork.

You should see
Your browser shows github.com/<GITHUB_USER>/shortlink with the line “forked from Amaan-Khan14/shortlink”.

Save your GitHub username#

Click My values in the header, enter your GitHub username (and the repository name if you changed it). The commands below and in later chapters will then use your fork.

Clone your fork#

Run this on your computer, in the folder where you keep projects.

Your computerClone your fork
git clone https://github.com/<GITHUB_USER>/shortlink.git
cd shortlink

Replace <GITHUB_USER> with your own value (or fill in the known ones once under My values at the top of the page).

Confirm you cloned your fork, not the original:

Your computerCheck the remote
git remote -v
Expected output
origin  https://github.com/your-username/shortlink.git (fetch)
origin  https://github.com/your-username/shortlink.git (push)

If the URL contains Amaan-Khan14, you cloned the original. Delete the folder and clone again from your fork's URL.

Add the original as upstream (optional)#

This lets you pull in later fixes from the instructor.

Your computerAdd upstream
git remote add upstream https://github.com/Amaan-Khan14/shortlink.git
git remote -v

To update your fork later: git fetch upstream, then git merge upstream/main, then git push origin main.

Look around the repository#

Repository layout
shortlink/
├── shortlink-api/            Node.js 20 + Express + PostgreSQL backend
│   ├── src/                  application code
│   ├── db/schema.sql         database schema (applied by scripts/init-db.js)
│   └── scripts/init-db.js    idempotent schema installer
├── shortlink-web/            React 18 + Vite frontend
├── appspec.yml               CodeDeploy instructions (guide 2)
└── deploy/
    ├── buildspec-api.yml     CodeBuild: test and package the API (guide 2)
    ├── buildspec-web.yml     CodeBuild: test and build the website (guide 3)
    ├── buildspec-web-deploy.yml   CodeBuild: sync the build to S3 (guide 3)
    └── hooks/                CodeDeploy lifecycle scripts (guide 2)

You do not need to understand the CI/CD files yet. They are explained when you use them.

Run the tests#

This proves your computer and your copy of the code are healthy before you spend any money.

Test the API#

The API tests use mocks and need no database.

Your computerAPI tests
cd shortlink-api
npm ci
npm test
cd ..
You should see
Tests: 36 passed, 36 total

Test the website#

Your computerWeb tests
cd shortlink-web
npm ci
npm test
cd ..
You should see
Tests: 23 passed (23)
Tests fail or npm ci errors
  • npm ci needs a lockfile and Node 20 or newer. Run node --version. If it is older, install Node 22 LTS and try again.
  • On a corporate network npm ci may fail to reach the registry. Try a personal network or ask your instructor for a proxy setting.
  • If you edited files in the fork, run git status to see what changed, then git stash to set the changes aside while you debug.

Next: build the network.

Found a mistake? Edit this page on GitHub.