A personal site built with Next.js, TypeScript, and Node.js. next build writes a static site to out/, and GitHub Actions publishes that folder to GitHub Pages. Point your own domain at it from the repository settings.
All visitor-facing copy, projects, and links live in src/content/site.ts. The projects and biography there are starter copy. Replace them before you share the site.
Node.js 20.9 or newer is required.
npm install
npm run dev
Open http://localhost:3000.
To preview the static files GitHub Pages will serve:
npm run build
npm run preview
Then open http://127.0.0.1:4173.
GitHub Pages on the free plan is available for public repositories. Private repositories need a plan that includes Pages.
This folder currently sits inside the git repository at your home directory. Publish it as its own repository so it does not get committed there.
main.git init
git add .
git commit -m "Add static Next.js portfolio"
git branch -M main
git remote add origin [email protected]:YOUR_USERNAME/YOUR_REPOSITORY.git
git push -u origin main
The workflow in .github/workflows/deploy.yml builds the site and deploys out/ on every push to main. The first run needs the Pages source set to GitHub Actions, or the deploy job will fail.
A user site repository named YOUR_USERNAME.github.io is served at the root. A project repository is served at https://YOUR_USERNAME.github.io/YOUR_REPOSITORY/ until a custom domain is attached. This project assumes the site is served from /, which is what you want once your domain points at GitHub Pages. If you need the project URL to work before DNS is ready, set NEXT_PUBLIC_BASE_PATH to /YOUR_REPOSITORY in the workflow’s build step and rebuild.
Add the domain in GitHub before you change DNS. That order avoids someone else claiming the hostname while it points at GitHub.
example.com or www.example.com) and save.*.example.com.Because this site deploys with GitHub Actions, you do not need a CNAME file in the repository. The domain saved in Pages settings is what GitHub uses.
example.com)Add all four A records and all four AAAA records. If your provider supports ALIAS or ANAME, you can use that instead of the A/AAAA records and point @ at YOUR_USERNAME.github.io.
| Type | Name | Value |
|---|---|---|
| A | @ |
185.199.108.153 |
| A | @ |
185.199.109.153 |
| A | @ |
185.199.110.153 |
| A | @ |
185.199.111.153 |
| AAAA | @ |
2606:50c0:8000::153 |
| AAAA | @ |
2606:50c0:8001::153 |
| AAAA | @ |
2606:50c0:8002::153 |
| AAAA | @ |
2606:50c0:8003::153 |
Also add a CNAME record so www reaches the same site:
| Type | Name | Value |
|---|---|---|
| CNAME | www |
YOUR_USERNAME.github.io |
Point that CNAME at YOUR_USERNAME.github.io, not at YOUR_USERNAME.github.io/repository and not at the *.pages.github.io host shown in the Pages settings.
If the custom domain saved in GitHub is example.com, GitHub redirects www.example.com to it. If you save www.example.com instead, the apex redirects to www.
www.example.com)| Type | Name | Value |
|---|---|---|
| CNAME | www |
YOUR_USERNAME.github.io |
Check the records once they propagate:
dig example.com +noall +answer -t A
dig www.example.com +nostats +nocomments +nocmd
The A answers should be the four GitHub Pages addresses above. The www answer should be a CNAME to YOUR_USERNAME.github.io.