---
title: "Password Protect Static Sites with PageCrypt"
description: "PageCrypt password-protects static sites without a backend by encrypting an HTML page at build time with the Web Crypto API."
url: "https://swe.quest/articles/password-protect-static-sites-with-pagecrypt-9cbe6d338b080939"
canonical: "https://render.com/blog/static-site-auth-pagecrypt"
source: "Render"
published: "2022-02-01"
difficulty: "medium"
kind: "How-to"
reading_minutes: 4
tags: ["frontend","security","javascript"]
---

# Password Protect Static Sites with PageCrypt

A post on [Render](https://swe.quest/sources/render.md), published 2022-02-01, 4 min read, How-to. Original: [https://render.com/blog/static-site-auth-pagecrypt](https://render.com/blog/static-site-auth-pagecrypt)

## Summary

PageCrypt password-protects static sites without a backend by encrypting an HTML page at build time with the Web Crypto API. The page ships with a password prompt, and the encrypted content sits in a hidden \<pre\> element that is decrypted client-side once the correct password is entered. It encrypts only a single HTML file and supports one shared password, so CSS, JavaScript and images must be inlined (for example as data URIs) to be protected. The walkthrough runs the PageCrypt CLI in a package.json build step with the password supplied through a $PASSWORD environment variable. It also covers "magic links" that pass the password in a URI fragment, which is not sent over the network but persists in browser history.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [Security](https://swe.quest/tags/security.md) (Security)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)

## Prerequisites

- static site hosting
- npm build scripts ([easy posts on Build systems](https://swe.quest/tags/build-systems.md?difficulty=easy))

## Keywords

PageCrypt, Web Crypto API, Render, StatiCrypt

## Related posts

- [SQLite Doesn't Come With Encryption. Here's What Developers Actually Use.](https://swe.quest/articles/sqlite-doesn-t-come-with-encryption-here-s-what-developers-actually-use-ebbfd7763f73e8f8.md): Turso · 2026-09-01 · Medium · 11 min read · SQLite, Cryptography, Storage engines
  SQLite ships without encryption, and since SQLite 3.32.0 removed the undocumented SQLITE\_HAS\_CODEC hook in 2020, the options are SQLCipher (mature but painful across major versions, AES-256-CBC+HMAC only), the proprietary $2,000 SEE from the SQLite team, and SQLite3MultipleCiphers (community successor that can read SQLCipher formats).
- [Front-End Web Deep Dive: Runtime Config](https://swe.quest/articles/front-end-web-deep-dive-runtime-config-e96590c65250b21e.md): Heroku Engineering · 2026-10-15 · Medium · 2 min read · Frontend, Configuration management, Deployment, JavaScript
  Heroku's Front-End Web Cloud Native Buildpack provides runtime configuration for static web apps by writing PUBLIC\_WEB\_-prefixed environment variables into the HTML \<head\> as data-\* attributes each time the bundled static server starts.
- [How we built it: incident.io Status Pages](https://swe.quest/articles/how-we-built-it-incident-io-status-pages-37acc4f93c86c23d.md): incident.io · 2023-04-19 · Medium · 8 min read · Caching, React, Frontend, Serverless, CDN & edge
  incident.io built its Status Pages product in three months on Vercel and Next.js, using Incremental Static Regeneration with per-fetch revalidate times (e.g. 30s) so the backend serves only a couple of requests per minute regardless of traffic spikes.
- [Bun v0.6.8](https://swe.quest/articles/bun-v0-6-8-d3a463075fc8738e.md): Bun · 2023-06-09 · Medium · 7 min read · JavaScript, Testing, Runtimes & VMs, Cryptography
  Bun v0.6.8 adds a built-in Bun.password API for argon2 (default) and bcrypt password hashing.
- [Supercharging Directus on Railway with a Static Frontend](https://swe.quest/articles/supercharging-directus-on-railway-with-a-static-frontend-06dcb86215b2424e.md): Railway · 2024-12-13 · Medium · 8 min read · Python, GraphQL, Web performance, CI/CD, Frontend
  A custom Python static site generator replaces per-request GraphQL fetching from a Directus CMS, which was slow and loaded the server, for a school newspaper site.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
