Skip to content
Dokknet Example Integration
Python HTML JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Dokknet Integration Example

Status: prototype

See live at:


This repository contains an example documentation site that integrates the Dokknet Paywall.

The documentation is built as a static site with Mkdocs using the Material theme. The site is hosted in an AWS S3 bucket with Cloudflare as a CDN. A custom Mkdocs plugin in the paywall_plugin folder generates paywall pages with the /paywall prefix for each documentation page. (This plugin will be provided as a PyPI package in the future.) A Cloudflare Worker in the cf-worker directory handles the paywall integration and serves the paywall pages instead of the requested page if the paywall is triggered.



  1. Install the Miniconda Python virtual environment manager.
  2. Create development environment and install dependencies with: conda env create -f environment.yml (from the repo root).
  3. Activate virtual environment: conda activate dokknet_example
  4. Node 12 (recommended install via Node Version Manager)
  5. The latest version of yarn.

Run site locally

Run mkdocs serve to run the site locally. There is no way to run Cloudflare Workers locally currently in this repo.



  1. Development prerequisites.
  2. An AWS account and a user with CLI credentials that has CloudFormation and S3 permissions.
  3. A Cloudflare account with a domain added and with Workers Unlimited enabled. Note your Cloudflare account id and zone id for later. (You can find them on the Overview page of the Cloudflare Dashboard for your domain on the right side towards the bottom of the page.)

One-time setup

  1. Create a CNAME record in Cloudflare for your root domain to target ${DOMAIN_NAME}.s3-website-${AWS_REGION} following the instructions here. (Replace domain name and AWS region with your values.)
  2. Create an API token in the your Cloudflare profile (use "Edit Cloudflare Workers" template) and save it in a secure location (eg. password manager).
  3. Edit the route in cf-worker/wrangler.toml to your domain.


Provide AWS credentials in the AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION environment variables. Provide Cloudflare credentials in the CF_ACCOUNT_ID, CF_ZONE_ID and CF_API_TOKEN environment variables.

Deployment command

./scripts/ -d {domain_name}

You can’t perform that action at this time.