This repository is a reusable self-hosted template for a split deployment:
your-frontend-domain.example: Cloudflare-hosted static frontendyour-api-domain.example: localcloudflaredtunnel -> local C backend- data storage: local SQLite + exported JSON mirror + local avatar files
This version has been sanitized for public release:
- removed project-specific Cloudflare Tunnel UUIDs and hostnames
- removed personal admin account data and replaced it with template values
- replaced public API domain examples with placeholders
- replaced example admin credentials with generic starter values that you should change immediately
web/static frontend filesbackend/C backend (libmicrohttpd+sqlite3+jansson+curl+openssl)data/warehouse-blog.sqlite3local SQLite databasedata/export/site-state.jsonJSON mirror exportdata/uploads/avatars/local avatar filestools/api_health_logger.pyhelper logger / health checkerbackend/deploy/cloudflared/config.api.example.ymlexample tunnel config
sudo dnf install -y gcc make pkgconf-pkg-config unzip curl ca-certificates libmicrohttpd-devel sqlite-devel jansson-devel libcurl-devel openssl-devel python3sudo apt-get update
sudo apt-get install -y build-essential pkg-config unzip curl ca-certificates libmicrohttpd-dev libsqlite3-dev libjansson-dev libcurl4-openssl-dev libssl-dev python3cd backend
make
cd ..cp ./backend/scripts/server.env.example ./backend/scripts/server.env
set -a
source ./backend/scripts/server.env
set +a
./backend/warehouse-blog-serverOpen local test page:
The frontend uses the following API base resolution order:
window.WAREHOUSE_API_BASEdata-api-baseon the root HTML element- same-origin for
localhost/IP - fallback placeholder:
https://your-api-domain.example
Before production deployment, replace the placeholder with your real API origin.
Upload the contents of web/ to your Cloudflare static hosting project for your own domain.
- Install
cloudflared cloudflared tunnel logincloudflared tunnel create your-blog-api- Bind
your-api-domain.exampleto that tunnel - Use the example config from
backend/deploy/cloudflared/config.api.example.yml
Example:
cloudflared tunnel route dns your-blog-api your-api-domain.example
cloudflared --config ~/.cloudflared/config.yml tunnel run your-blog-api- For local HTTP testing keep
WB_COOKIE_SECURE=0 - For production HTTPS, change it to
WB_COOKIE_SECURE=1 - Update
WB_ALLOWED_ORIGINSso it only contains your real frontend origins - Leave
WB_COOKIE_DOMAIN=''unless you explicitly want to widen cookie scope
python3 ./tools/api_health_logger.py --local http://ip/api/health --public https://your-api-domain.example/api/health --profile https://your-api-domain.example/api/site-profile?lang=enThe logger writes to ./logs/api-health.log by default.