Skip to content

jackdbd/personal-website

Repository files navigation

personal-website

HSTS preload HSTS preload HSTS preload

My personal website and blog, built with 11ty and Workbox. Hosted on Cloudflare Pages.

Features

Installation

Clone the repo:

git clone git@github.com:jackdbd/personal-website.git

This project should work on Node.js >=22.0.0.

ℹ️ What's that flake.nix?

This project uses a nix dev shell to define a virtual environment with all the necessary dependencies. Thanks to Nix and this .envrc file, you can activate this environment simply by entering the root directory of this repository (and waiting a few seconds).

If you don't use Nix, you can safely ignore the flake.nix file in the repository root.

In alternative to the Nix dev shell provided by this repository, you could use a Node.js version manager like nvm, asdf, or volta.

If you want to run scrips/tests that rely on Playwright, you will also need to install/update the browsers it uses:

npx playwright install

Development

Watch all templates, CSS, JS, and automatically refresh the browser:

npm run dev

Go to http://localhost:8080/ to visit the website.

In alternative, develop and preview the site with wrangler (this is useful when developing functions that will be deployed to Cloudflare Pages Functions):

npm run wrangler

Go to http://localhost:8788/ to visit the website.

Test the production build locally

Build all templates, CSS, JS, _headers file and the service worker:

npm run build

Serve the production build:

npm run site:serve

Deploy

Just push to the remote repository. This GitHub workflow will automatically deploy the website to Cloudflare Pages.

  • Each push on the main branch will trigger a production deployment.
  • Each push on any other branch will trigger a preview deployment.

⚠️ Node.js version on Cloudflare Pages

Don't forget to set the environment variables NODE_ENV and NODE_VERSION in the Cloudflare Pages dashboard. In particular, NODE_VERSION is used by the Cloudflare Pages V2 build system.

Security

Run a security audit on the HTTP headers

Generate the _headers file which will be used by Cloudflare Pages:

node scripts/headers.mjs

Check the Content-Security-Policy and the other security headers with these online tools:

Security policy

See SECURITY.md.

Dependencies

Production dependencies

This project has 51 dependencies.

Package Version
@11ty/eleventy 3.0.0-alpha.6
@11ty/eleventy-fetch ^4.0.1
@11ty/eleventy-navigation ^0.3.5
@11ty/eleventy-plugin-rss ^1.2.0
@11ty/eleventy-plugin-syntaxhighlight ^5.0.0
@11ty/eleventy-plugin-webc ^0.11.2
@11ty/is-land ^4.0.0
@google-cloud/storage ^7.10.2
@google-cloud/text-to-speech ^5.2.0
@jackdbd/content-security-policy ^3.0.0
@jackdbd/eleventy-plugin-ensure-env-vars ^1.2.0
@jackdbd/eleventy-plugin-telegram ^2.2.0
@jackdbd/eleventy-plugin-text-to-speech 3.1.0
@jackdbd/hosting-utils ^1.0.0
@jackdbd/permissions-policy ^1.0.0
autoprefixer ^10.4.19
clean-css ^5.3.3
cloudinary ^2.2.0
cssnano ^6.1.2
debug ^4.3.4
eleventy-plugin-broken-links ^2.2.1
eleventy-plugin-embed-cloudinary ^1.0.2
eleventy-plugin-embed-twitter ^1.4.0
eleventy-plugin-emoji ^1.1.0
eleventy-plugin-helmet ^0.2.2
eleventy-plugin-nesting-toc ^1.3.0
eleventy-plugin-reading-time ^0.0.1
eleventy-plugin-vimeo-embed ^1.3.8
eleventy-plugin-youtube-embed ^1.10.2
esbuild ^0.20.2
globby ^14.0.1
html-minifier-terser ^7.2.0
instant.page ^5.2.0
luxon ^3.4.4
markdown-it ^14.1.0
markdown-it-anchor ^8.6.7
npm-run-all ^4.1.5
pagefind ^1.1.0
postcss ^8.4.38
postcss-cli ^11.0.0
sanitize-html ^2.13.0
slugify ^1.6.6
stripe ^15.5.0
tailwindcss ^3.4.3
terser ^5.31.0
workbox-build ^7.1.0
workbox-core ^7.1.0
workbox-expiration ^7.1.0
workbox-precaching ^7.1.0
workbox-routing ^7.1.0
zod ^3.23.5

Development dependencies

This project has 22 devDependencies: @hint/hint-performance-budget, @jackdbd/checks, @thi.ng/transclude, @types/yargs, form-data, himalaya, hint, lighthouse, openpgp, playwright, playwright-start, prettier, prettier-plugin-tailwindcss, pretty-error, serve, snoowrap, taze, tsm, typescript, uuid, wrangler, yargs.

Troubleshooting

Troubleshooting the service worker

When developing, open Chrome DevTools, go to Application > Service Workers and check that:

  • Update on reload is enabled. This ensures that the latest service worker will be installed and activated on the page.
  • Bypass for network is disabled. This ensures that the route matchers, route handlers and runtime caches of the service worker will be used.

License

© 2020 - 2024 Giacomo Debidda // MIT License