{"HOST":"","_config":{"name":"renderer","base_url":"https://lightswitch.jeffreybue.com","paths":{"assetsFolder":"/assets/","assetsRoute":"/_/","storageFolder":"","storageRoute":"/_/storage/","downloadsRoute":"/downloads/","downloadsFolder":"","partials":"/src/partials/index.js","templates":"/src/templates/index.js","markdown":"/src/markdown/index.js","tables":"/src/tables/index.js","mustache":"/utils/hooks/mustacheFunctions.js","apiDataTrx":"/utils/hooks/apiDataTrx.js","states":"/utils/lib/states.js"},"hosts":["localhost","www.localhost","127.0.0.1","lightswitch.jeffreybue.com"],"environment_switch":"development","endpoints":{},"routes":[{"host":"","path":"/","template":"home"},{"host":"","path":"/about/?","template":"about"}],"404pagetypes":[]},"assetsDate":{"css":"v=20261125T134823","js":"v=20261125T135015"},"urlprops":{"pathname":"/","pagetype":"home","params":null,"query":{"api":"true"}},"isMobile":false,"isDev":true,"statesArray":[{"abbr":"ALL","display":"All States"},{"abbr":"AL","display":"Alabama"},{"abbr":"AK","display":"Alaska"},{"abbr":"AZ","display":"Arizona"},{"abbr":"AR","display":"Arkansas"},{"abbr":"CA","display":"California"},{"abbr":"CO","display":"Colorado"},{"abbr":"CT","display":"Connecticut"},{"abbr":"DE","display":"Delaware"},{"abbr":"DC","display":"District Of Columbia"},{"abbr":"FL","display":"Florida"},{"abbr":"GA","display":"Georgia"},{"abbr":"HI","display":"Hawaii"},{"abbr":"ID","display":"Idaho"},{"abbr":"IL","display":"Illinois"},{"abbr":"IN","display":"Indiana"},{"abbr":"IA","display":"Iowa"},{"abbr":"KS","display":"Kansas"},{"abbr":"KY","display":"Kentucky"},{"abbr":"LA","display":"Louisiana"},{"abbr":"ME","display":"Maine"},{"abbr":"MD","display":"Maryland"},{"abbr":"MA","display":"Massachusetts"},{"abbr":"MI","display":"Michigan"},{"abbr":"MN","display":"Minnesota"},{"abbr":"MS","display":"Mississippi"},{"abbr":"MO","display":"Missouri"},{"abbr":"MT","display":"Montana"},{"abbr":"NE","display":"Nebraska"},{"abbr":"NV","display":"Nevada"},{"abbr":"NH","display":"New Hampshire"},{"abbr":"NJ","display":"New Jersey"},{"abbr":"NM","display":"New Mexico"},{"abbr":"NY","display":"New York"},{"abbr":"NC","display":"North Carolina"},{"abbr":"ND","display":"North Dakota"},{"abbr":"OH","display":"Ohio"},{"abbr":"OK","display":"Oklahoma"},{"abbr":"OR","display":"Oregon"},{"abbr":"PA","display":"Pennsylvania"},{"abbr":"RI","display":"Rhode Island"},{"abbr":"SC","display":"South Carolina"},{"abbr":"SD","display":"South Dakota"},{"abbr":"TN","display":"Tennessee"},{"abbr":"TX","display":"Texas"},{"abbr":"UT","display":"Utah"},{"abbr":"VT","display":"Vermont"},{"abbr":"VI","display":"Virgin Islands"},{"abbr":"VA","display":"Virginia"},{"abbr":"WA","display":"Washington"},{"abbr":"WV","display":"West Virginia"},{"abbr":"WI","display":"Wisconsin"},{"abbr":"WY","display":"Wyoming"}],"cloudFlareHeaders":{"cfRay":"a60da09d1a98910d-CMH","connectingIp":"216.73.216.91","country":"US","forwardedFor":"216.73.216.91,162.159.114.54"},"allHeaders":{"host":"lightswitch.jeffreybue.com","x-forwarded-for":"216.73.216.91,162.159.114.54","user-agent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","accept":"*/*","cf-ray":"a60da09d1a98910d-CMH","cdn-loop":"cloudflare; loops=1","cf-connecting-ip":"216.73.216.91","cf-ipcountry":"US","cf-visitor":"{\"scheme\":\"https\"}","x-forwarded-proto":"https","x-cloud-trace-context":"5916c85b076bc2a9443be62ac90b6406/10378838355037376668","traceparent":"00-5916c85b076bc2a9443be62ac90b6406-90090a7e9533d09c-00","forwarded":"for=\"162.159.114.54\";proto=https","accept-encoding":"gzip, br"},"states":{"ALL":"All States","AL":"Alabama","AK":"Alaska","AZ":"Arizona","AR":"Arkansas","CA":"California","CO":"Colorado","CT":"Connecticut","DE":"Delaware","DC":"District Of Columbia","FL":"Florida","GA":"Georgia","HI":"Hawaii","ID":"Idaho","IL":"Illinois","IN":"Indiana","IA":"Iowa","KS":"Kansas","KY":"Kentucky","LA":"Louisiana","ME":"Maine","MD":"Maryland","MA":"Massachusetts","MI":"Michigan","MN":"Minnesota","MS":"Mississippi","MO":"Missouri","MT":"Montana","NE":"Nebraska","NV":"Nevada","NH":"New Hampshire","NJ":"New Jersey","NM":"New Mexico","NY":"New York","NC":"North Carolina","ND":"North Dakota","OH":"Ohio","OK":"Oklahoma","OR":"Oregon","PA":"Pennsylvania","RI":"Rhode Island","SC":"South Carolina","SD":"South Dakota","TN":"Tennessee","TX":"Texas","UT":"Utah","VT":"Vermont","VI":"Virgin Islands","VA":"Virginia","WA":"Washington","WV":"West Virginia","WI":"Wisconsin","WY":"Wyoming"},"stats":[{"value":8,"suffix":"","label":"Middleware stages per request","sub":"route → render"},{"value":30,"suffix":"s","label":"Hard request timeout","sub":"connect-timeout"},{"value":2,"suffix":"","label":"Experiment systems built in","sub":"cookie + bucket"},{"value":1,"suffix":"","label":"Command to run everything","sub":"docker-compose up"}],"pipeline":[{"n":"01","name":"Redirects","title":"Redirects first","file":"redirects.json → routeHandler.checkRedirects","body":"Before any route matches, the request is checked against redirects.json. Patterns are full-path regex (301 or 302), the query string is preserved, and a hit short-circuits everything downstream."},{"n":"02","name":"Route","title":"Host + path routing","file":"server/middleware/routeHandler.js","body":"The hostname must be on the config allow-list, then the path is matched as a full-path regex. Named groups like (?<slug>…) become data.urlprops.params. Paths are normalised — lowercase, + becomes -, trailing slash added — with a 301 if anything changed."},{"n":"03","name":"Bucket test","title":"Deterministic bucket tests","file":"server/middleware/bucketTestingHandler.js","body":"No cookie needed: hash(path) % templates.length picks the variant, so the same URL always renders the same template. The winning variant name is logged on every request."},{"n":"04","name":"Data","title":"The data object is built","file":"server/middleware/dataHandler.js","body":"If the route names an endpoint, the API is fetched (1:1 browser-path → API-path), headers merged, and an encrypted text/plain body decrypted with KRYPTOPASS. Then states, Cloudflare headers, device flags and config are folded in — and per-template data loaders run."},{"n":"05","name":"Content","title":"Markdown & tables join in","file":"server/middleware/contentHandler.js","body":"Registered Markdown files become HTML under _content, CSVs become row arrays. When a named URL group matches a slug or table name, that content is promoted to _content.markdown / _content.table for the template to drop straight in."},{"n":"06","name":"Variation","title":"Cookie split tests","file":"server/middleware/variationHandler.js","body":"A route can list alternate templates. Each visitor is randomly assigned control or a variant, stored for 30 days in a cookie named sha256(path). On localhost a query param forces any variant for QA."},{"n":"07","name":"Template rules","title":"Last-word template rules","file":"server/middleware/templateHandler.js","body":"After experiments, template_rules get the final say: the first matching named condition wins and swaps the template. The built-in singleRecord rule fires when an API payload contains exactly one person."},{"n":"08","name":"Render","title":"Mustache renders, whitespace collapses","file":"routeHandler.renderRoute","body":"YAML front matter is Mustache-rendered and merged onto the data, partials (HEAD, HEADER, FOOTER, FOOT) are stitched in, whitespace is collapsed, and the page ships. Add ?api=true locally to see the exact data object instead of HTML."}],"pillars":[{"icon":"🧭","tag":"Routing","title":"Regex routes, human URLs","text":"Host and path are plain regex in config.js. Named capture groups flow straight into the page data, so /california/ and /articles/my-post/ need no router code at all."},{"icon":"🗂️","tag":"Data","title":"One data object per page","text":"API payload, YAML front matter, Markdown, CSV tables, states and Cloudflare geo — merged into a single object your template simply reads from. What you see at ?api=true is what the template got."},{"icon":"🧪","tag":"Experiments","title":"Two ways to test, zero setup","text":"Cookie variations for classic A/B splits and deterministic bucket tests for URL-stable variants. Both report into dataLayer and the /seo-tracking/ beacon automatically."},{"icon":"✍️","tag":"Content","title":"Writers write Markdown","text":"Drop a .md file in src/markdown, register it, and it renders as HTML in any template. CSVs become iterable tables the same way. No deploy pipeline for a comma."},{"icon":"⚡","tag":"Performance","title":"Fast by construction","file":"","text":"Above-the-fold CSS is inlined in the head, HTML whitespace is collapsed, assets are minified by Gulp with cache-busted URLs, and static files carry 30-day cache headers."},{"icon":"🛡️","tag":"Safety","title":"Guardrails included","text":"Host allow-list, 30-second timeout, staging basic-auth, AES-decrypted API bodies, path-traversal-proof storage proxying, and an error template that renders instead of leaking a stack."}],"_content":{"markdown":{},"table":{},"_alltables":{},"_allmarkdown":{}},"title":"Light Switch — Cloud Run Renderer","description":"Light Switch (Cloud Run Renderer) is a lightweight HTML & Mustache renderer: regex routing, one data object per page, built-in experiments, Markdown content and Gulp-compiled assets.","h1":"Flip the switch. Ship the page."}