I want an SSG that routes to real HTML pages and doesn't load JavaScript unless it's necessary. Is that so much to ask?
npm install
npm run build
npm run dev# Run type-checking and formatting
npm run check
# Fix lint errors
npm run lint:fix
# Run tests
npm run testThis tool allows interaction with the stack without having to manually update files and databases or generate IDs. By default the CLI will interact with the local Cloudflare development environment, but it's possible to interact with the production Cloudflare instance by adding an --omit=dev flag.
Available resource types: article, note, page
# Create a new resource and start editing it
npm run cli -- new <resourceType>
# Commit the currently-edited resource to the datastore
npm run cli -- commit
# List existing resources
npm run cli -- list <resourceType>
# Read an existing resource
npm run cli -- read <resourceID>
# Edit an existing resource
npm run cli -- edit <resourceID>
# Discard the current edit
npm run cli -- discard
# Check if there are resources being edited
npm run cli -- status
# Generate a slug for the given text
npm run cli -- slugify <quotedText>FIXME: These instructions do not include how to download existing media
-
Create an
.envfile and a.dev.varsfile withAPI_TOKEN=<token>if needed for any other services. -
Create a Cloudflare API token in the Cloudflare dashboard. Recommended scopes: minimal permissions for Workers and D1 (or the specific services you need).
- In Cloudflare: My Profile → API Tokens → Create Token → choose a template or custom policy with least privilege.
-
On your host machine (before opening the devcontainer) export the token so VS Code can forward it into the container:
export CLOUDFLARE_API_TOKEN="your_token_here"-
Reopen or rebuild the devcontainer in VS Code so the
CLOUDFLARE_API_TOKENis injected into the container. -
The devcontainer will automatically install
wrangleron first create. After the container is ready, verify authentication:
bash .devcontainer/wrangler-setup.sh- Now that
wrangleris authenticated, initialize the database if needed:
# Download the existing remote database to a file
npx wrangler d1 export stack_db --remote --output=./database.sql
# Initialize the local database with the downloaded data
npx wrangler d1 execute stack_db --local --file=database.sql-
Run
npm run devto run a local server, and then runnpm run buildto build the pages. The home page on the dev server will throw a404error until the pages are built! -
Visit
http://localhost:8788/in a browser to navigate to the site
- Build command:
npm run build - Build output directory:
build
NODE_ENV:productionNODE_VERSION:18TZ:America/New_YorkAPI_TOKEN:<secret>