[{"data":1,"prerenderedAt":2203},["ShallowReactive",2],{"navigation_docs":3,"-developers-redis":613,"-developers-redis-surround":2200},[4,39,101,378,540,562,584,606],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":38},"Start","i-lucide-rocket","\u002Fstart","1.start",[10,14,18,22,26,30,34],{"title":11,"path":12,"stem":13},"Our approach","\u002Fstart\u002Four-approach","1.start\u002F0.our-approach",{"title":15,"path":16,"stem":17},"Introduction","\u002Fstart\u002Fintroduction","1.start\u002F1.introduction",{"title":19,"path":20,"stem":21},"Concepts","\u002Fstart\u002Fconcepts","1.start\u002F2.concepts",{"title":23,"path":24,"stem":25},"Glossary","\u002Fstart\u002Fglossary","1.start\u002F3.glossary",{"title":27,"path":28,"stem":29},"Try it locally","\u002Fstart\u002Ftry-it-locally","1.start\u002F4.try-it-locally",{"title":31,"path":32,"stem":33},"Features","\u002Fstart\u002Ffeatures","1.start\u002F5.features",{"title":35,"path":36,"stem":37},"Questions","\u002Fstart\u002Ffaq","1.start\u002F6.faq",false,{"title":40,"icon":41,"path":42,"stem":43,"children":44,"page":38},"Run SHADE","i-lucide-server","\u002Frun","2.run",[45,49,53,57,61,65,69,73,77,81,85,89,93,97],{"title":46,"path":47,"stem":48},"Setting up an instance (Coolify)","\u002Frun\u002Fcoolify","2.run\u002F1.coolify",{"title":50,"path":51,"stem":52},"Console commands","\u002Frun\u002Fconsole","2.run\u002F10.console",{"title":54,"path":55,"stem":56},"Rotating APP_SECRET","\u002Frun\u002Frotating-app-secret","2.run\u002F11.rotating-app-secret",{"title":58,"path":59,"stem":60},"Checking an instance","\u002Frun\u002Fdoctor","2.run\u002F12.doctor",{"title":62,"path":63,"stem":64},"Self-hosting by hand","\u002Frun\u002Fown-server-by-hand","2.run\u002F13.own-server-by-hand",{"title":66,"path":67,"stem":68},"NixOS (experimental)","\u002Frun\u002Fnixos","2.run\u002F14.nixos",{"title":70,"path":71,"stem":72},"Self-hosting without Coolify","\u002Frun\u002Fown-server","2.run\u002F2.own-server",{"title":74,"path":75,"stem":76},"Hosting the site on a static host","\u002Frun\u002Fstatic-hosts","2.run\u002F3.static-hosts",{"title":78,"path":79,"stem":80},"Licence","\u002Frun\u002Flicence","2.run\u002F4.licence",{"title":82,"path":83,"stem":84},"Updating and backups","\u002Frun\u002Fupdating-and-backups","2.run\u002F5.updating-and-backups",{"title":86,"path":87,"stem":88},"Troubleshooting","\u002Frun\u002Ftroubleshooting","2.run\u002F6.troubleshooting",{"title":90,"path":91,"stem":92},"Logs, request ids, traces and metrics","\u002Frun\u002Flogs","2.run\u002F7.logs",{"title":94,"path":95,"stem":96},"Maintenance mode","\u002Frun\u002Fmaintenance-mode","2.run\u002F8.maintenance-mode",{"title":98,"path":99,"stem":100},"Usage limits","\u002Frun\u002Fusage-limits","2.run\u002F9.usage-limits",{"title":102,"icon":103,"path":104,"stem":105,"children":106},"Guide","i-lucide-book-open","\u002Fguide","3.guide",[107,109,147,192,210,280,310,364],{"title":102,"path":104,"stem":108},"3.guide\u002Findex",{"title":110,"icon":111,"path":112,"stem":113,"children":114,"page":38},"Content","i-lucide-file-text","\u002Fguide\u002Fcontent","3.guide\u002F1.content",[115,119,123,127,131,135,139,143],{"title":116,"path":117,"stem":118},"Collections and entries","\u002Fguide\u002Fcontent\u002Fcollections","3.guide\u002F1.content\u002F1.collections",{"title":120,"path":121,"stem":122},"Field types","\u002Fguide\u002Fcontent\u002Ffields","3.guide\u002F1.content\u002F2.fields",{"title":124,"path":125,"stem":126},"Drafts, publishing and version history","\u002Fguide\u002Fcontent\u002Fversions","3.guide\u002F1.content\u002F3.versions",{"title":128,"path":129,"stem":130},"Languages","\u002Fguide\u002Fcontent\u002Flanguages","3.guide\u002F1.content\u002F4.languages",{"title":132,"path":133,"stem":134},"Data sources","\u002Fguide\u002Fcontent\u002Fdata-sources","3.guide\u002F1.content\u002F5.data-sources",{"title":136,"path":137,"stem":138},"Media","\u002Fguide\u002Fcontent\u002Fmedia","3.guide\u002F1.content\u002F6.media",{"title":140,"path":141,"stem":142},"Search","\u002Fguide\u002Fcontent\u002Fsearch","3.guide\u002F1.content\u002F7.search",{"title":144,"path":145,"stem":146},"Trash","\u002Fguide\u002Fcontent\u002Ftrash","3.guide\u002F1.content\u002F8.trash",{"title":148,"icon":149,"path":150,"stem":151,"children":152,"page":38},"Website","i-lucide-globe","\u002Fguide\u002Fwebsite","3.guide\u002F2.website",[153,156,160,164,168,172,176,180,184,188],{"title":148,"path":154,"stem":155},"\u002Fguide\u002Fwebsite\u002Fwebsite","3.guide\u002F2.website\u002F1.website",{"title":157,"path":158,"stem":159},"Scroll scenes","\u002Fguide\u002Fwebsite\u002Fscroll-scenes","3.guide\u002F2.website\u002F10.scroll-scenes",{"title":161,"path":162,"stem":163},"Pages and posts","\u002Fguide\u002Fwebsite\u002Fpages","3.guide\u002F2.website\u002F2.pages",{"title":165,"path":166,"stem":167},"The visual editor","\u002Fguide\u002Fwebsite\u002Fvisual-editor","3.guide\u002F2.website\u002F3.visual-editor",{"title":169,"path":170,"stem":171},"Roles and locks","\u002Fguide\u002Fwebsite\u002Froles-and-locks","3.guide\u002F2.website\u002F4.roles-and-locks",{"title":173,"path":174,"stem":175},"Header and footer","\u002Fguide\u002Fwebsite\u002Fheader-and-footer","3.guide\u002F2.website\u002F5.header-and-footer",{"title":177,"path":178,"stem":179},"Theme","\u002Fguide\u002Fwebsite\u002Ftheme","3.guide\u002F2.website\u002F6.theme",{"title":181,"path":182,"stem":183},"Redirects","\u002Fguide\u002Fwebsite\u002Fredirects","3.guide\u002F2.website\u002F7.redirects",{"title":185,"path":186,"stem":187},"Site settings","\u002Fguide\u002Fwebsite\u002Fsite-settings","3.guide\u002F2.website\u002F8.site-settings",{"title":189,"path":190,"stem":191},"The site","\u002Fguide\u002Fwebsite\u002Fthe-site","3.guide\u002F2.website\u002F9.the-site",{"title":193,"icon":194,"path":195,"stem":196,"children":197,"page":38},"Publishing","i-lucide-send","\u002Fguide\u002Fpublishing","3.guide\u002F3.publishing",[198,202,206],{"title":199,"path":200,"stem":201},"Publishing and preview","\u002Fguide\u002Fpublishing\u002Fpublishing","3.guide\u002F3.publishing\u002F1.publishing",{"title":203,"path":204,"stem":205},"Builds","\u002Fguide\u002Fpublishing\u002Fbuilds","3.guide\u002F3.publishing\u002F2.builds",{"title":207,"path":208,"stem":209},"CDN caches","\u002Fguide\u002Fpublishing\u002Fcaches","3.guide\u002F3.publishing\u002F3.caches",{"title":211,"icon":212,"path":213,"stem":214,"children":215,"page":38},"People, security and privacy","i-lucide-shield","\u002Fguide\u002Fpeople-and-security","3.guide\u002F4.people-and-security",[216,220,224,228,232,236,240,244,248,252,256,260,264,268,272,276],{"title":217,"path":218,"stem":219},"People in SHADE","\u002Fguide\u002Fpeople-and-security\u002Fpeople-in-shade","3.guide\u002F4.people-and-security\u002F0.people-in-shade",{"title":221,"path":222,"stem":223},"Team and roles","\u002Fguide\u002Fpeople-and-security\u002Fteam","3.guide\u002F4.people-and-security\u002F1.team",{"title":225,"path":226,"stem":227},"Errors and security alerts","\u002Fguide\u002Fpeople-and-security\u002Ferrors","3.guide\u002F4.people-and-security\u002F10.errors",{"title":229,"path":230,"stem":231},"Exporting an instance","\u002Fguide\u002Fpeople-and-security\u002Fexporting","3.guide\u002F4.people-and-security\u002F11.exporting",{"title":233,"path":234,"stem":235},"Organisations","\u002Fguide\u002Fpeople-and-security\u002Forganisations","3.guide\u002F4.people-and-security\u002F12.organisations",{"title":237,"path":238,"stem":239},"Signing in through an identity provider (team)","\u002Fguide\u002Fpeople-and-security\u002Fidentity-providers","3.guide\u002F4.people-and-security\u002F13.identity-providers",{"title":241,"path":242,"stem":243},"System status","\u002Fguide\u002Fpeople-and-security\u002Fsystem-status","3.guide\u002F4.people-and-security\u002F14.system-status",{"title":245,"path":246,"stem":247},"Appearance","\u002Fguide\u002Fpeople-and-security\u002Fappearance","3.guide\u002F4.people-and-security\u002F15.appearance",{"title":249,"path":250,"stem":251},"Accounts and personal pages","\u002Fguide\u002Fpeople-and-security\u002Faccounts","3.guide\u002F4.people-and-security\u002F2.accounts",{"title":253,"path":254,"stem":255},"Signing in (team)","\u002Fguide\u002Fpeople-and-security\u002Fsign-in","3.guide\u002F4.people-and-security\u002F3.sign-in",{"title":257,"path":258,"stem":259},"API tokens","\u002Fguide\u002Fpeople-and-security\u002Fapi-tokens","3.guide\u002F4.people-and-security\u002F4.api-tokens",{"title":261,"path":262,"stem":263},"Audit log","\u002Fguide\u002Fpeople-and-security\u002Faudit","3.guide\u002F4.people-and-security\u002F5.audit",{"title":265,"path":266,"stem":267},"Request protection","\u002Fguide\u002Fpeople-and-security\u002Fprotection","3.guide\u002F4.people-and-security\u002F6.protection",{"title":269,"path":270,"stem":271},"Personal data per person","\u002Fguide\u002Fpeople-and-security\u002Fprivacy","3.guide\u002F4.people-and-security\u002F7.privacy",{"title":273,"path":274,"stem":275},"Data retention","\u002Fguide\u002Fpeople-and-security\u002Fretention","3.guide\u002F4.people-and-security\u002F8.retention",{"title":277,"path":278,"stem":279},"Consent banner","\u002Fguide\u002Fpeople-and-security\u002Fconsent","3.guide\u002F4.people-and-security\u002F9.consent",{"title":281,"icon":282,"path":283,"stem":284,"children":285,"page":38},"Services","i-lucide-plug","\u002Fguide\u002Fservices","3.guide\u002F5.services",[286,290,294,298,302,306],{"title":287,"path":288,"stem":289},"Email","\u002Fguide\u002Fservices\u002Femail","3.guide\u002F5.services\u002F1.email",{"title":291,"path":292,"stem":293},"Opening hours","\u002Fguide\u002Fservices\u002Fopening-hours","3.guide\u002F5.services\u002F4.opening-hours",{"title":295,"path":296,"stem":297},"Webhooks","\u002Fguide\u002Fservices\u002Fwebhooks","3.guide\u002F5.services\u002F5.webhooks",{"title":299,"path":300,"stem":301},"Locations","\u002Fguide\u002Fservices\u002Flocations","3.guide\u002F5.services\u002F6.locations",{"title":303,"path":304,"stem":305},"VAT rates","\u002Fguide\u002Fservices\u002Fvat-rates","3.guide\u002F5.services\u002F7.vat-rates",{"title":307,"path":308,"stem":309},"Channels","\u002Fguide\u002Fservices\u002Fchannels","3.guide\u002F5.services\u002F8.channels",{"title":311,"icon":312,"path":313,"stem":314,"children":315,"page":38},"InstalledModules","i-lucide-puzzle","\u002Fguide\u002Fmodules","3.guide\u002F6.modules",[316,320,324,328,332,336,340,344,348,352,356,360],{"title":317,"path":318,"stem":319},"Modules","\u002Fguide\u002Fmodules\u002Fmanaging","3.guide\u002F6.modules\u002F1.managing",{"title":321,"path":322,"stem":323},"Dutch services (module)","\u002Fguide\u002Fmodules\u002Fnl","3.guide\u002F6.modules\u002F10.nl",{"title":325,"path":326,"stem":327},"Editorial (module)","\u002Fguide\u002Fmodules\u002Feditorial","3.guide\u002F6.modules\u002F11.editorial",{"title":329,"path":330,"stem":331},"Appointments (module)","\u002Fguide\u002Fmodules\u002Fappointments","3.guide\u002F6.modules\u002F2.appointments",{"title":333,"path":334,"stem":335},"Shop (the commerce module)","\u002Fguide\u002Fmodules\u002Fshop","3.guide\u002F6.modules\u002F3.shop",{"title":337,"path":338,"stem":339},"Untrusted modules","\u002Fguide\u002Fmodules\u002Funtrusted","3.guide\u002F6.modules\u002F4.untrusted",{"title":341,"path":342,"stem":343},"Analytics (module)","\u002Fguide\u002Fmodules\u002Fanalytics","3.guide\u002F6.modules\u002F5.analytics",{"title":345,"path":346,"stem":347},"Error forwarding (module)","\u002Fguide\u002Fmodules\u002Ferror-forwarding","3.guide\u002F6.modules\u002F6.error-forwarding",{"title":349,"path":350,"stem":351},"Client programs","\u002Fguide\u002Fmodules\u002Fprograms","3.guide\u002F6.modules\u002F7.programs",{"title":353,"path":354,"stem":355},"Import and export (module)","\u002Fguide\u002Fmodules\u002Fimport","3.guide\u002F6.modules\u002F8.import",{"title":357,"path":358,"stem":359},"Payments (module)","\u002Fguide\u002Fmodules\u002Fpayments","3.guide\u002F6.modules\u002F8.payments",{"title":361,"path":362,"stem":363},"Forms (module)","\u002Fguide\u002Fmodules\u002Fforms","3.guide\u002F6.modules\u002F9.forms",{"title":365,"icon":366,"path":367,"stem":368,"children":369,"page":38},"AI assistants","i-lucide-bot","\u002Fguide\u002Fai","3.guide\u002F7.ai",[370,374],{"title":371,"path":372,"stem":373},"AI assistants (MCP)","\u002Fguide\u002Fai\u002Fassistants","3.guide\u002F7.ai\u002F1.assistants",{"title":375,"path":376,"stem":377},"Connecting an AI assistant","\u002Fguide\u002Fai\u002Fconnecting","3.guide\u002F7.ai\u002F2.connecting",{"title":379,"icon":380,"path":381,"stem":382,"children":383,"page":38},"Developers","i-lucide-code","\u002Fdevelopers","4.developers",[384,388,392,396,400,404,408,412,416,420,424,428,432,435,489,493,497,501,536],{"title":385,"path":386,"stem":387},"Architecture","\u002Fdevelopers\u002Farchitecture","4.developers\u002F1.architecture",{"title":389,"path":390,"stem":391},"Capabilities","\u002Fdevelopers\u002Fcapabilities","4.developers\u002F10.capabilities",{"title":393,"path":394,"stem":395},"Trust","\u002Fdevelopers\u002Ftrust","4.developers\u002F11.trust",{"title":397,"path":398,"stem":399},"Redis and the ports","\u002Fdevelopers\u002Fredis","4.developers\u002F12.redis",{"title":401,"path":402,"stem":403},"The worker container role","\u002Fdevelopers\u002Fworker","4.developers\u002F13.worker",{"title":405,"path":406,"stem":407},"kv: a module's own key-value storage","\u002Fdevelopers\u002Fkv","4.developers\u002F14.kv",{"title":409,"path":410,"stem":411},"Processes: long-running work on the worker","\u002Fdevelopers\u002Fprocesses","4.developers\u002F15.processes",{"title":413,"path":414,"stem":415},"Network: a module's outgoing calls","\u002Fdevelopers\u002Fnetwork","4.developers\u002F16.network",{"title":417,"path":418,"stem":419},"Realtime","\u002Fdevelopers\u002Frealtime","4.developers\u002F17.realtime",{"title":421,"path":422,"stem":423},"Private files","\u002Fdevelopers\u002Ffiles","4.developers\u002F18.files",{"title":425,"path":426,"stem":427},"Notify","\u002Fdevelopers\u002Fnotify","4.developers\u002F19.notify",{"title":429,"path":430,"stem":431},"Collections","\u002Fdevelopers\u002Fcollections","4.developers\u002F2.collections",{"title":337,"path":433,"stem":434},"\u002Fdevelopers\u002Funtrusted","4.developers\u002F20.untrusted",{"title":436,"icon":312,"path":437,"stem":438,"children":439},"Writing a plugin","\u002Fdevelopers\u002Fmodules","4.developers\u002F3.modules\u002Findex",[440,442,446,450,454,458,462,466,470,473,477,481,485],{"title":441,"path":437,"stem":438},"Writing a module",{"title":443,"path":444,"stem":445},"Module SDK and tooling","\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling","4.developers\u002F3.modules\u002F1.sdk-and-tooling",{"title":447,"path":448,"stem":449},"Connecting accounts with OAuth2","\u002Fdevelopers\u002Fmodules\u002Foauth","4.developers\u002F3.modules\u002F10.oauth",{"title":451,"path":452,"stem":453},"Calls between modules","\u002Fdevelopers\u002Fmodules\u002Fcalls-between-modules","4.developers\u002F3.modules\u002F11.calls-between-modules",{"title":455,"path":456,"stem":457},"Experimental parts","\u002Fdevelopers\u002Fmodules\u002Fexperimental-parts","4.developers\u002F3.modules\u002F12.experimental-parts",{"title":459,"path":460,"stem":461},"The manifest","\u002Fdevelopers\u002Fmodules\u002Fmanifest","4.developers\u002F3.modules\u002F2.manifest",{"title":463,"path":464,"stem":465},"Routes","\u002Fdevelopers\u002Fmodules\u002Froutes","4.developers\u002F3.modules\u002F3.routes",{"title":467,"path":468,"stem":469},"Admin screens and the site part","\u002Fdevelopers\u002Fmodules\u002Fadmin-and-site","4.developers\u002F3.modules\u002F4.admin-and-site",{"title":110,"path":471,"stem":472},"\u002Fdevelopers\u002Fmodules\u002Fcontent","4.developers\u002F3.modules\u002F5.content",{"title":474,"path":475,"stem":476},"Background work and services","\u002Fdevelopers\u002Fmodules\u002Fbackground-and-services","4.developers\u002F3.modules\u002F6.background-and-services",{"title":478,"path":479,"stem":480},"SDK reference","\u002Fdevelopers\u002Fmodules\u002Fsdk-reference","4.developers\u002F3.modules\u002F7.sdk-reference",{"title":482,"path":483,"stem":484},"The website module's SDK","\u002Fdevelopers\u002Fmodules\u002Fwebsite-sdk","4.developers\u002F3.modules\u002F8.website-sdk",{"title":486,"path":487,"stem":488},"Incoming webhooks","\u002Fdevelopers\u002Fmodules\u002Fincoming-webhooks","4.developers\u002F3.modules\u002F9.incoming-webhooks",{"title":490,"path":491,"stem":492},"Core and the website module","\u002Fdevelopers\u002Fcore-and-website-module","4.developers\u002F4.core-and-website-module",{"title":494,"path":495,"stem":496},"The API","\u002Fdevelopers\u002Fapi","4.developers\u002F6.api",{"title":498,"path":499,"stem":500},"API reference","\u002Fdevelopers\u002Fapi-reference","4.developers\u002F6.api-reference",{"title":502,"icon":503,"path":504,"stem":505,"children":506},"Sites in other frameworks","i-lucide-layout-template","\u002Fdevelopers\u002Fframeworks","4.developers\u002F7.frameworks\u002Findex",[507,508,512,516,520,524,528,532],{"title":502,"path":504,"stem":505},{"title":509,"path":510,"stem":511},"Accounts: sign-in and modules' routes","\u002Fdevelopers\u002Fframeworks\u002Faccounts","4.developers\u002F7.frameworks\u002F1.accounts",{"title":513,"path":514,"stem":515},"`@shadestack\u002Ftree`","\u002Fdevelopers\u002Fframeworks\u002Ftree","4.developers\u002F7.frameworks\u002F2.tree",{"title":517,"path":518,"stem":519},"Expressions and styles","\u002Fdevelopers\u002Fframeworks\u002Fexpressions-and-styles","4.developers\u002F7.frameworks\u002F3.expressions-and-styles",{"title":521,"path":522,"stem":523},"`@shadestack\u002Frender`","\u002Fdevelopers\u002Fframeworks\u002Frender","4.developers\u002F7.frameworks\u002F4.render",{"title":525,"path":526,"stem":527},"`@shadestack\u002Finteractions`","\u002Fdevelopers\u002Fframeworks\u002Finteractions","4.developers\u002F7.frameworks\u002F5.interactions",{"title":529,"path":530,"stem":531},"`@shadestack\u002Fa11y`","\u002Fdevelopers\u002Fframeworks\u002Fa11y","4.developers\u002F7.frameworks\u002F6.a11y",{"title":533,"path":534,"stem":535},"Your own page for SHADE's links","\u002Fdevelopers\u002Fframeworks\u002Flinks","4.developers\u002F7.frameworks\u002F7.links",{"title":537,"path":538,"stem":539},"Build a client module","\u002Fdevelopers\u002Fclient-module","4.developers\u002F9.client-module",{"title":541,"icon":542,"path":543,"stem":544,"children":545,"page":38},"Security","i-lucide-shield-check","\u002Fsecurity","5.security",[546,550,554,558],{"title":547,"path":548,"stem":549},"Reporting a vulnerability","\u002Fsecurity\u002Freporting","5.security\u002F0.reporting",{"title":551,"path":552,"stem":553},"Security testing","\u002Fsecurity\u002Ftesting","5.security\u002F1.testing",{"title":555,"path":556,"stem":557},"Hardening a production instance","\u002Fsecurity\u002Fhardening","5.security\u002F2.hardening",{"title":559,"path":560,"stem":561},"Manual testing with Kali Linux","\u002Fsecurity\u002Fmanual-testing","5.security\u002F3.manual-testing",{"title":563,"icon":564,"path":565,"stem":566,"children":567,"page":38},"Contributing","i-lucide-git-pull-request","\u002Fcontributing","6.contributing",[568,572,576,580],{"title":569,"path":570,"stem":571},"Reading the code","\u002Fcontributing\u002Freading-the-code","6.contributing\u002F1.reading-the-code",{"title":573,"path":574,"stem":575},"Docs site","\u002Fcontributing\u002Fdocs-site","6.contributing\u002F2.docs-site",{"title":577,"path":578,"stem":579},"Releases","\u002Fcontributing\u002Freleases","6.contributing\u002F3.releases",{"title":581,"path":582,"stem":583},"Load tests","\u002Fcontributing\u002Fload-tests","6.contributing\u002F4.load-tests",{"title":585,"icon":586,"path":587,"stem":588,"children":589,"page":38},"Project","i-lucide-map","\u002Fproject","7.project",[590,594,598,602],{"title":591,"path":592,"stem":593},"Roadmap","\u002Fproject\u002Froadmap","7.project\u002F1.roadmap",{"title":595,"path":596,"stem":597},"Known issues","\u002Fproject\u002Fknown-issues","7.project\u002F2.known-issues",{"title":599,"path":600,"stem":601},"Changelog","\u002Fproject\u002Fchangelog","7.project\u002F3.changelog",{"title":603,"path":604,"stem":605},"Decisions","\u002Fproject\u002Fdecisions","7.project\u002F4.decisions",{"title":607,"path":608,"stem":609,"children":610,"icon":612},"Community","\u002Fcommunity","8.community\u002Findex",[611],{"title":607,"path":608,"stem":609},"i-lucide-users",{"id":614,"title":397,"body":615,"description":2180,"extension":2194,"links":2195,"meta":2196,"navigation":2197,"path":398,"seo":2198,"stem":399,"__hash__":2199},"docs\u002F4.developers\u002F12.redis.md",{"type":616,"value":617,"toc":2179},"minimark",[618,622,640,651,656,924,944,977,981,986,1081,1088,1105,1170,1198,1223,1268,1299,1301,1322,1383,1387,1390,1465,1565,1592,1595,1601,1816,1821,1880,1884,1979,1983,2025,2029],[619,620,621],"p",{},"Every instance has a Redis beside Postgres. Postgres holds the records: anything that must survive, be\nbacked up, exported or erased. Redis holds only work in flight, which can be rebuilt: leases, the queue's jobs,\nmessages between containers, rate-limit counters and the cache. The API refuses to start without it.",[619,623,624,625,629,630,634,635,639],{},"\"Redis\" here is the role, not one product: any server that speaks the Redis protocol works. SHADE's compose files and\ndeployment template ship ",[626,627,628],"strong",{},"Valkey"," (",[631,632,633],"code",{},"valkey\u002Fvalkey:9.1-alpine","), which is BSD-licensed. Redis 8 is licensed AGPLv3,\nRSALv2 or SSPL, and SHADE promises clients no licence questions (",[636,637,638],"em",{},"Rejected alternatives",").",[619,641,642,643,646,647,650],{},"Code never talks to Redis itself. The kernel declares five ",[626,644,645],{},"ports",", the API's ",[626,648,649],{},"driver"," implements them on Redis, and\neverything else uses the ports on the service context. Tests use the same ports in memory.",[652,653,655],"h2",{"id":654},"where-it-is","Where it is",[657,658,659,672],"table",{},[660,661,662],"thead",{},[663,664,665,669],"tr",{},[666,667,668],"th",{},"Part",[666,670,671],{},"What",[673,674,675,721,750,767,783,796,818,835,861,878,888,904],"tbody",{},[663,676,677,683],{},[678,679,680],"td",{},[631,681,682],{},"shade\u002Fkernel\u002Fports.ts",[678,684,685,686,689,690,693,694,689,697,693,700,629,703,693,706,709,710,693,713,716,717,720],{},"The ports: ",[631,687,688],{},"Leases"," and ",[631,691,692],{},"Lease",", ",[631,695,696],{},"WorkQueue",[631,698,699],{},"QueuedJob",[631,701,702],{},"Messages",[631,704,705],{},"ShadeChannel",[631,707,708],{},"ShadeMessage","), ",[631,711,712],{},"Counters",[631,714,715],{},"Cache","; ",[631,718,719],{},"CoordinationPorts"," is all five.",[663,722,723,728],{},[678,724,725],{},[631,726,727],{},"shade\u002Fkernel\u002Fcontext.ts",[678,729,730,733,734,693,737,693,740,693,743,689,746,749],{},[631,731,732],{},"ServiceContext"," has them as optional ",[631,735,736],{},"leases",[631,738,739],{},"queue",[631,741,742],{},"messages",[631,744,745],{},"counters",[631,747,748],{},"cache",".",[663,751,752,757],{},[678,753,754],{},[631,755,756],{},"shade\u002Fkernel\u002Fcoordination\u002Fleases.ts",[678,758,759,760,763,764,639],{},"What a lease is, written once for both implementations: ",[631,761,762],{},"leasesOn(store, clock)"," on a store's atomic steps (take, extend, drop, and claim for ",[631,765,766],{},"once",[663,768,769,774],{},[678,770,771],{},[631,772,773],{},"shade\u002Fkernel\u002Fcoordination\u002Fmemory.ts",[678,775,776,779,780,639],{},[631,777,778],{},"memoryCoordination(clock?)",": the five ports in memory, the same rules as Redis, with a clock a test drives (",[631,781,782],{},"manualClock()",[663,784,785,790],{},[678,786,787],{},[631,788,789],{},"shade\u002Fkernel\u002Fcoordination\u002Fcontract.ts",[678,791,792,795],{},[631,793,794],{},"coordinationContract(name, make)",": the one test suite both implementations pass.",[663,797,798,803],{},[678,799,800],{},[631,801,802],{},"shade\u002Fkernel\u002Fcoordination\u002Ffollow.ts",[678,804,805,806,809,810,813,814,817],{},"Messages replacing polling: ",[631,807,808],{},"announce(ctx, channel, kind)"," after a change commits, ",[631,811,812],{},"follow({ messages, channels, reread })"," in each container, ",[631,815,816],{},"SAFETY_REREAD_MS"," (60 s).",[663,819,820,825],{},[678,821,822],{},[631,823,824],{},"apps\u002Fapi\u002Fsrc\u002Fredis\u002Fdriver.ts",[678,826,827,830,831,834],{},[631,828,829],{},"createRedisPorts(url)",": the five ports on ",[631,832,833],{},"ioredis",", one client plus one connection for subscriptions.",[663,836,837,842],{},[678,838,839],{},[631,840,841],{},"apps\u002Fapi\u002Fsrc\u002Fredis\u002Fscripts.ts",[678,843,844,845,693,848,693,851,854,855,689,858,749],{},"The Lua scripts, each atomic on Redis: ",[631,846,847],{},"RELEASE",[631,849,850],{},"RENEW",[631,852,853],{},"HIT",", and the queue's ",[631,856,857],{},"PROMOTE",[631,859,860],{},"SETTLE",[663,862,863,868],{},[678,864,865],{},[631,866,867],{},"apps\u002Fapi\u002Fsrc\u002Fbootstrap\u002Fruntime.ts",[678,869,870,873,874,877],{},[631,871,872],{},"runtime.redis",", made on first use; ",[631,875,876],{},"close()"," closes both connections.",[663,879,880,885],{},[678,881,882],{},[631,883,884],{},"apps\u002Fapi\u002Fsrc\u002Fhttp\u002Fcontext.ts",[678,886,887],{},"Every request's context gets the five ports (made on first use, like storage).",[663,889,890,895],{},[678,891,892],{},[631,893,894],{},"apps\u002Fapi\u002Fsrc\u002Fbootstrap\u002Fstart.ts",[678,896,897,900,901,749],{},[631,898,899],{},"checkRedis",": start-up pings Redis and stops with what to check when it does not answer; then ",[631,902,903],{},"runtime.follow()",[663,905,906,911],{},[678,907,908],{},[631,909,910],{},"apps\u002Fapi\u002Fsrc\u002Fbootstrap\u002Frestart.ts",[678,912,913,916,917,920,921,749],{},[631,914,915],{},"followRestartRequests",": the ",[631,918,919],{},"restart"," channel, used by ",[631,922,923],{},"server.ts",[619,925,926,928,929,932,933,936,937,940,941,639],{},[631,927,833],{}," is imported only in ",[631,930,931],{},"apps\u002Fapi\u002Fsrc\u002Fredis\u002F",". ",[631,934,935],{},"pnpm lint"," refuses it anywhere else, core, modules, sites, scripts\nand tests included (",[631,938,939],{},"eslint.config.mjs","; held by ",[631,942,943],{},"test\u002Fscripts\u002Fredis-imports.test.ts",[619,945,946,947,952,953,956,957,960,961,964,965,968,969,972,973,976],{},"The messages port is used: messages replace the polling for the module switch, roles, the sandbox, the Site URL and\nrestarts (",[948,949,951],"a",{"href":950},"#messages-replacing-polling","below","). The leases port is used by the worker container role's ",[631,954,955],{},"Scheduler","\n(each due time once, a lease per run) and by the rebuild, and the cache by the worker's heartbeat (",[948,958,959],{"href":402},"The worker container\nrole","). The counters hold every rate limit (",[948,962,951],{"href":963},"#counters","). The other users move onto the ports\nin their own pull requests; the queue port carries core's queued jobs on the worker (",[948,966,951],{"href":967},"#cores-queues","). kv uses none of them: modules' keys and counters are in Postgres (",[948,970,971],{"href":406},"kv","). Modules will reach them only through the providers' SDK wrappers,\nunder ",[631,974,975],{},"package:\u003Cname>:",", never raw.",[652,978,980],{"id":979},"the-ports","The ports",[619,982,983,985],{},[626,984,688],{}," (one holder at a time: schedules, singleton processes, the rebuild).",[987,988,989,1015,1025,1034,1044,1058,1064],"ul",{},[990,991,992,995,996,999,1000,1003,1004,1007,1008,1011,1012,1014],"li",{},[631,993,994],{},"acquire(name, ttlMs, holder)"," takes the lease when nobody holds it: ",[631,997,998],{},"SET shade:lease:\u003Cname> \u003Cholder>:\u003Ctoken> NX PX",".\nThe token comes from ",[631,1001,1002],{},"shade:lease:\u003Cname>:token",": one above the last, and never below Redis's clock in microseconds\n(the Lua script ",[631,1005,1006],{},"NEXT_TOKEN","), so it grows with every new holder, also after Redis restarted and kept nothing\n(fencing: a write that must not race a takeover compares it). It is a whole number of about 16 digits: store it as a\n",[631,1009,1010],{},"bigint",". Returns the ",[631,1013,692],{},", or null.",[990,1016,1017,1020,1021,1024],{},[631,1018,1019],{},"lease.renew(ttlMs?)"," extends it only while this holder still holds it (Lua compare-and-extend). False, and\n",[631,1022,1023],{},"lease.lost"," aborts, when it was lost, or when Redis does not answer: the holder stops rather than run on while\nanother may take over.",[990,1026,1027,1030,1031,749],{},[631,1028,1029],{},"lease.release()"," gives it up only while still held by this holder (Lua compare-and-delete), and aborts ",[631,1032,1033],{},"lost",[990,1035,1036,1039,1040,1043],{},[631,1037,1038],{},"hold(name, ttlMs, holder, signal)"," acquires and renews every third of the TTL until ",[631,1041,1042],{},"signal"," aborts (then it\nreleases) or a renewal fails.",[990,1045,1046,1049,1050,1053,1054,1057],{},[631,1047,1048],{},"resume(name, ttlMs, holder, token, signal)"," holds again, as ",[631,1051,1052],{},"hold"," does, a lease its holder lost to a renewal Redis\ndid not answer, while the key still holds ",[631,1055,1056],{},"\u003Cholder>:\u003Ctoken>"," (the same compare-and-extend). A key taken over or run\nout meanwhile is left alone: null. The rebuild lease uses it, so one blip doesn't hand the rebuild to another worker.",[990,1059,1060,1063],{},[631,1061,1062],{},"holderOf(name)"," says who holds it and until when.",[990,1065,1066,1069,1070,1073,1074,1076,1077,1080],{},[631,1067,1068],{},"once(name, ttlMs, holder)"," marks something done once: ",[631,1071,1072],{},"SET shade:once:\u003Cname> \u003Cholder> NX PX",", true for the first\nholder only until it expires, with no token and no renewal. The ",[631,1075,955],{}," takes each schedule's due time with it\n(",[631,1078,1079],{},"once:schedule:\u003Cschedule>:\u003Cdue time>","), so one worker runs each due time.",[619,1082,1083,1084,1087],{},"With two workers or more, each has a rebuild trigger of its own that debounces in its memory, while the entries' event\ndeliveries are shared out between them. Left alone, ten pages published in a minute could start a build on each worker.\nSo the worker that holds the lease ",[631,1085,1086],{},"rebuild:content-delivery"," is the only one that claims the deliveries asking for a\nrebuild (the rebuild's own and the path moves'), and its trigger builds the whole burst once. A worker gives the lease\nback as it shuts down, so on a restart or a rolling update the next one claims at its next poll. One that stops answering loses\nit up to 30 seconds after its last renewal, and another worker takes it then. Changes made in the admin (site\nsettings, media, a module switched on or off, a publish of many entries at once) still ask the admin container's\ntrigger.",[619,1089,1090,1093,1094,1097,1098,1101,1102,749],{},[626,1091,1092],{},"Queue"," (jobs in flight; the outbox, and what a job that ran out of tries leaves behind, are in Postgres: see\n",[948,1095,1096],{"href":967},"Core's queues","). A Redis stream per queue\n(",[631,1099,1100],{},"shade:queue:\u003Cqueue>",") with the consumer group ",[631,1103,1104],{},"shade",[987,1106,1107,1116,1142,1163],{},[990,1108,1109,1112,1113,749],{},[631,1110,1111],{},"add(queue, payload, { delayMs?, dedupeKey? })",": now on the stream, or later from a sorted set by due time. A dedupe\nkey gives one job per key until it is acked; it lasts a day after the job was added, retried or postponed, so it\nholds for as long as the job is in flight. A job starts at ",[631,1114,1115],{},"attempt: 1",[990,1117,1118,1121,1122,1125,1126,1129,1130,1133,1134,1137,1138,1141],{},[631,1119,1120],{},"claim(queue, consumer, { max, visibilityMs })"," moves due delayed jobs onto the stream, takes back jobs claimed\nlonger than ",[631,1123,1124],{},"visibilityMs"," ago and never acked (",[631,1127,1128],{},"XAUTOCLAIM","), then reads new ones (",[631,1131,1132],{},"XREADGROUP","). A job taken back\ncounts as a try: its ",[631,1135,1136],{},"attempt"," goes up by the times it was handed out (",[631,1139,1140],{},"XPENDING","'s delivery count).",[990,1143,1144,1147,1148,1151,1152,716,1155,1158,1159,1162],{},[631,1145,1146],{},"ack(queue, id)"," removes it; ",[631,1149,1150],{},"retry(queue, job, delayMs)"," puts it back later with ",[631,1153,1154],{},"attempt + 1",[631,1156,1157],{},"postpone"," puts it\nback with the same attempt (an open breaker); ",[631,1160,1161],{},"depth(queue)"," counts ready, delayed and claimed jobs.",[990,1164,1165,1166,1169],{},"After a Redis restart the stream and its group are gone: the driver makes the group again when Redis answers\n",[631,1167,1168],{},"NOGROUP",", so the worker goes on without a restart of its own.",[619,1171,1172,1174,1175,689,1178,1181,1182,1185,1186,1189,1190,1193,1194,1197],{},[626,1173,702],{}," (between containers). ",[631,1176,1177],{},"publish(channel, { kind, version? })",[631,1179,1180],{},"subscribe(channel, handler, onReconnect?)"," on Redis pub\u002Fsub (",[631,1183,1184],{},"shade:msg:\u003Cchannel>","). A message says \"re-read\", never the truth: anything but ",[631,1187,1188],{},"kind","\nand ",[631,1191,1192],{},"version"," is dropped, so a forged one can at most cause a re-read. After a lost connection the driver subscribes\nagain, then calls each ",[631,1195,1196],{},"onReconnect",", so its subscriber re-reads what it may have missed.",[619,1199,1200,1202,1203,1206,1207,1210,1211,1214,1215,1218,1219,1222],{},[626,1201,712],{}," (rate limits). ",[631,1204,1205],{},"hit(key, { limit, windowMs })"," counts one attempt atomically in a fixed window (Lua:\n",[631,1208,1209],{},"INCR",", then ",[631,1212,1213],{},"PEXPIRE"," on the first hit), so a burst at once never passes the limit. ",[631,1216,1217],{},"peek(key)"," reads a count\nwithout counting (0 once its window ended), ",[631,1220,1221],{},"reset(key)"," starts it again.",[619,1224,1225,932,1227,693,1230,1233,1234,1237,1238,1241,1242,1245,1246,629,1249,1252,1253,1256,1257,1260,1261,1264,1265,639],{},[626,1226,715],{},[631,1228,1229],{},"get",[631,1231,1232],{},"set(key, value, ttlMs, { group? })"," (the TTL is required: nothing in Redis lives forever),\n",[631,1235,1236],{},"delete(key, { group? })",", and ",[631,1239,1240],{},"take(key)",", which returns and deletes in one step (",[631,1243,1244],{},"GETDEL","), for single-use values such\nas approval tickets. A ",[631,1247,1248],{},"group",[631,1250,1251],{},"{ name, limit }",") keeps at most ",[631,1254,1255],{},"limit"," values together, dropping the oldest written\n(",[631,1258,1259],{},"shade:cache-group:\u003Cname>",", a sorted set by write time, one script ",[631,1262,1263],{},"CACHE_SET"," on Redis): the modules' cache keeps each\nmodule's values in one (",[948,1266,474],{"href":1267},"\u002Fdevelopers\u002Fmodules\u002Fbackground-and-services#cache",[619,1269,1270,1271,693,1274,693,1277,693,1280,693,1283,1286,1287,1290,1291,1294,1295,1298],{},"Keys: ",[631,1272,1273],{},"shade:lease:…",[631,1275,1276],{},"shade:once:…",[631,1278,1279],{},"shade:queue:…",[631,1281,1282],{},"shade:counter:…",[631,1284,1285],{},"shade:cache:…",", channels ",[631,1288,1289],{},"shade:msg:…","\n(",[631,1292,1293],{},"shade:"," is ",[631,1296,1297],{},"REDIS_PREFIX",": an instance keeps it; the browser tests' servers, which share one Redis, set one each). Values go through\nJSON, in memory too. Only a lease's fencing token and a queue's stream have no expiry (a token must only grow); after\nRedis loses its data a token starts again from Redis's clock, which is past every token given before.",[652,1300,712],{"id":745},[619,1302,1303,1304,1307,1308,693,1311,1314,1315,1318,1319,1321],{},"Every rate limit counts here, so the\ncontainers of an instance share each budget: sign-in and the team's auth steps, the account API's limits (",[631,1305,1306],{},"account.auth.*",",\n",[631,1309,1310],{},"account.*",[631,1312,1313],{},"account.data","), error reports, modules' webhooks, MCP, modules' route limits, the approval\nstep's re-authentication and the sandbox's call limit for untrusted modules. See\nRequest protection (",[631,1316,1317],{},"shade\u002Fkernel\u002Fprotection\u002FREADME.md"," in the ",[631,1320,1104],{}," repository) for each limit.",[987,1323,1324,1355,1364,1377],{},[990,1325,1326,1329,1330,629,1333,1336,1337,1340,1341,1344,1345,689,1348,1351,1352,639],{},[626,1327,1328],{},"Windows."," ",[631,1331,1332],{},"hitRateLimit",[631,1334,1335],{},"shade\u002Fkernel\u002Fprotection\u002Fprotection.ts",") keeps a sliding window: windows aligned to the clock,\neach its own counter (",[631,1338,1339],{},"shade:counter:\u003Climit>:\u003Cclient>:\u003Cwindow>",") that lives two windows; a request hits this window's and ",[631,1342,1343],{},"peek","s the\nprevious one's, weighted by how much of it still lies in the last window. ",[631,1346,1347],{},"Retry-After",[631,1349,1350],{},"RateLimit-Reset"," are\nthe seconds until this window ends. The sandbox's call limit is a plain fixed window from the module's first call\n(",[631,1353,1354],{},"shade:counter:sandbox.calls:\u003Cplugin>",[990,1356,1357,1360,1361,749],{},[626,1358,1359],{},"Keys without addresses."," The client in a key is an HMAC of the address (IPv4 as it is, IPv6 by its \u002F64), token,\naccount or user, with ",[631,1362,1363],{},"APP_SECRET",[990,1365,1366,1369,1370,1307,1373,1376],{},[626,1367,1368],{},"Fails closed."," While Redis does not answer, a limited request is refused with 503 (",[631,1371,1372],{},"UNAVAILABLE",[631,1374,1375],{},"Retry-After: 5","), never let through uncounted, and the first 503 of every five seconds is in the error log. Once\nthe connection is known to be down the driver fails a count at once instead of waiting for reconnection attempts.\nSign-in, the account API, modules' limited routes and the sandbox's calls stop until Redis is back; reading content\nand the admin's other routes go on.",[990,1378,1379,1382],{},[626,1380,1381],{},"A restart starts the counts again."," Counters are not records: Redis losing them resets every budget, and the\nper-account limits and the audit of refusals still hold for the next attempts.",[652,1384,1386],{"id":1385},"messages-replacing-polling","Messages replacing polling",[619,1388,1389],{},"Each container keeps some things from Postgres in memory: which modules are on, the custom roles, the untrusted\nmodules in its sandbox, the Site URL with the frontends' and framed origins. The container that changes one tells the\nothers, and they re-read it at once.",[987,1391,1392,1406,1415,1447],{},[990,1393,1394,1397,1398,1401,1402,1405],{},[626,1395,1396],{},"Postgres stays the truth."," A message only says \"re-read\" (",[631,1399,1400],{},"{ kind }","); the container reads the change from\nPostgres. A forged message can at most cause a re-read, and a restart only happens for a row in ",[631,1403,1404],{},"instance_restarts","\nnewer than the process.",[990,1407,1408,1411,1412,1414],{},[626,1409,1410],{},"Announced after commit, never waited for."," A service calls ",[631,1413,808],{}," once its transaction\ncommitted. It does not wait for Redis and never throws: the change is saved, so a message that cannot be sent (Redis\naway) never fails or slows the request. Without the messages port (scripts, most tests) it does nothing.",[990,1416,1417,1329,1420,1422,1423,1443,1446],{},[626,1418,1419],{},"Followed with a safety net.",[631,1421,812],{}," subscribes, and re-reads:",[987,1424,1425,1428,1434,1440],{},[990,1426,1427],{},"at once on a message on one of its channels;",[990,1429,1430,1431,1433],{},"at once when the connection to Redis comes back (",[631,1432,1196],{},"), for what it may have missed;",[990,1435,1436,1437,1439],{},"every 60 seconds (",[631,1438,816],{},"), in case a message was lost: a lost message delays a change by a minute at\nmost;",[990,1441,1442],{},"once just after subscribing, for what changed between start-up's read and the subscription.",[1444,1445],"br",{},"Re-reads never run twice at once: what comes in during one makes one more afterwards.",[990,1448,1449,1452,1453,1456,1457,1460,1461,1464],{},[626,1450,1451],{},"Untrusted modules within 5 seconds",". A sandbox stop or switch must not wait a minute for a lost\nmessage, so every container also compares the untrusted modules' switch and versions with Postgres every 5 seconds\n(",[631,1454,1455],{},"UNTRUSTED_SWITCH_REREAD_MS"," in ",[631,1458,1459],{},"runtime.ts","), in one small query (",[631,1462,1463],{},"untrustedSwitchState",": each untrusted module, its\nversion time and its switch), and reloads its sandbox only when that changed. Everything else keeps the 60 seconds. A failed re-read is logged\nonce and tried again at the next message or tick; a failed subscription is tried again at the next tick.",[657,1466,1467,1480],{},[660,1468,1469],{},[663,1470,1471,1474,1477],{},[666,1472,1473],{},"Channel",[666,1475,1476],{},"Announced by",[666,1478,1479],{},"Each container then",[673,1481,1482,1503,1516,1533,1546],{},[663,1483,1484,1489,1496],{},[678,1485,1486],{},[631,1487,1488],{},"plugins",[678,1490,1491,1492,1495],{},"a switch on or off (",[631,1493,1494],{},"switchInstalledModule",", so also the watchdog stopping an untrusted module), a removed server package, an optional capability switched",[678,1497,1498,1499,1502],{},"reloads the switch and its sandbox (",[631,1500,1501],{},"runtime.reloadUntrustedModules","), and forgets the framed origins",[663,1504,1505,1510,1513],{},[678,1506,1507],{},[631,1508,1509],{},"sandbox",[678,1511,1512],{},"an untrusted module installed, updated or removed",[678,1514,1515],{},"reloads the untrusted modules and its sandbox",[663,1517,1518,1523,1526],{},[678,1519,1520],{},[631,1521,1522],{},"roles",[678,1524,1525],{},"a custom role created, changed or deleted",[678,1527,1528,1529,1532],{},"reloads the custom roles (",[631,1530,1531],{},"loadCustomRoles",")",[663,1534,1535,1540,1543],{},[678,1536,1537],{},[631,1538,1539],{},"site",[678,1541,1542],{},"a changed Site URL or time zone, a frontend added, changed or removed, a module's settings saved (they may hold a framed address, such as the website module's Preview address)",[678,1544,1545],{},"forgets the Site URL, the time zone (which modules' cron schedules without their own run in), the frontends' origins and the framed origins; the next use reads them again",[663,1547,1548,1552,1558],{},[678,1549,1550],{},[631,1551,919],{},[678,1553,1554,1555,1532],{},"an admin's restart request (",[631,1556,1557],{},"requestRestart",[678,1559,1560,1561,1564],{},"checks ",[631,1562,1563],{},"latestRestartRequest",", and stops gracefully when it is newer than the process",[619,1566,1567,1568,1571,1572,1574,1575,1577,1578,629,1580,1582,1583,1585,1586,1589,1590,639],{},"The API's runtime follows the first four (",[631,1569,1570],{},"Runtime.follow()",", called by start-up once the modules are loaded and\nstopped by ",[631,1573,876],{},"); ",[631,1576,923],{}," follows ",[631,1579,919],{},[631,1581,915],{},"). The ",[631,1584,739],{}," channel wakes the worker's relay (below), and a\n",[631,1587,1588],{},"realtime:\u003Cplugin>:\u003Ctopic>"," channel carries a module's realtime updates to the streams open on that topic in every container\n(",[948,1591,417],{"href":418},[652,1593,1096],{"id":1594},"cores-queues",[619,1596,1597,1598,639],{},"Built for core's own work; outgoing webhooks are the first user.\nA job may wait until a time and carry a key, email's retries and planned\nnotifications are jobs, and trusted modules have jobs of their own (",[948,1599,951],{"href":1600},"#modules-jobs",[987,1602,1603,1662,1723,1776,1809],{},[990,1604,1605,1608,1609,1612,1613,1616,1617,1620,1621,1624,1625,1628,1629,1632,1633,1636,1637,1640,1641,1644,1645,1647,1648,1651,1652,629,1655,693,1658,1661],{},[631,1606,1607],{},"shade\u002Fkernel\u002Fqueue\u002Fqueue.ts"," (the kernel's, beside the consumer): ",[631,1610,1611],{},"defineQueue({ name, concurrency, retries, backoffMs, timeoutMs, handle, giveUp })",", at import by the part that owns the queue (",[631,1614,1615],{},"webhooks.deliver"," in\n",[631,1618,1619],{},"features\u002Fwebhooks\u002Fserver\u002Fwebhooks.ts","). ",[631,1622,1623],{},"enqueue(tx, queue, data, { runAt, key })"," writes a job into ",[631,1626,1627],{},"queue_outbox","\nin the transaction of the change that asks for it, so a job exists exactly when its change committed. With ",[631,1630,1631],{},"runAt"," it\nwaits there until then (Redis holds only what is due); with ",[631,1634,1635],{},"key"," it replaces the job waiting under that key in its\nqueue (a partial unique index), and ",[631,1638,1639],{},"cancelJob(tx, queue, key)"," takes it back. A job already sent that was replaced\nor taken back is skipped at its next try (each try first checks that its row still waits); a try running at that\nmoment still ends. ",[631,1642,1643],{},"announceJobs(ctx)","\nafter the commit wakes the worker (the ",[631,1646,739],{}," channel): by hand after the transaction, or as an\n",[631,1649,1650],{},"afterCommit"," step of an ",[631,1653,1654],{},"inTransaction",[631,1656,1657],{},"emitEvent",[631,1659,1660],{},"kernel\u002Fcontext.ts","). Announced before the commit, the\nrelay would not see the job yet and it would wait for the next poll.",[990,1663,1664,1667,1668,1671,1672,1675,1676,1679,1680,1683,1684,1307,1687,1329,1690,1693,1694,693,1697,1700,1701,1704,1705,1708,1709,1712,1713,693,1715,1718,1719,1722],{},[631,1665,1666],{},"relayOutbox(db, queue)"," marks the outbox's jobs that are due sent, reading their data in the same step (",[631,1669,1670],{},"FOR UPDATE SKIP LOCKED",", so two workers never take one job and a job replaced meanwhile gets a row of its own), then adds them\nto the queue under their outbox id (the dedupe key, so a job sent twice runs once while it is in flight). One sent but\nnot done after ",[631,1673,1674],{},"OUTBOX_RESEND_MS"," (an hour) is added again in case Redis lost it, and at once when the queue no\nlonger holds the dedupe key of its oldest job in flight (",[631,1677,1678],{},"WorkQueue.holds","): Redis restarted and kept nothing. One\nstill in flight holds its dedupe key, so neither adds a second copy. Only the jobs of queues defined on the worker are sent: a module's jobs that never\nfinished go when it is uninstalled. ",[631,1681,1682],{},"settleJob"," marks a job finished (",[631,1685,1686],{},"finished_at",[631,1688,1689],{},"outcome",[631,1691,1692],{},"done"," or ",[631,1695,1696],{},"gave-up",[631,1698,1699],{},"attempts",", the last ",[631,1702,1703],{},"error",") and clears its data; finished jobs are purged after the\nretention kind ",[631,1706,1707],{},"queue-jobs"," (7 days by default, registered by the operations module, ",[631,1710,1711],{},"features\u002Fqueue\u002Fserver\u002Fkept-data.ts","). Core's queues: ",[631,1714,1615],{},[631,1716,1717],{},"email.send"," (a failed email, five more tries) and ",[631,1720,1721],{},"notify.send"," (a planned notification, with\nits time and key).",[990,1724,1725,1728,1729,1732,1733,1736,1737,1740,1741,1744,1745,1748,1749,1752,1753,1756,1757,1760,1761,1764,1765,1768,1769,1771,1772,1775],{},[631,1726,1727],{},"shade\u002Fkernel\u002Fqueue\u002Fconsumer.ts",": the kernel's ",[631,1730,1731],{},"QueueConsumer"," claims each queue's jobs (",[631,1734,1735],{},"concurrency"," at once in a\nprocess, every ",[631,1738,1739],{},"QUEUE_POLL_MS"," (5 s), at once on ",[631,1742,1743],{},"wake",", and when a retry comes due), gives each try ",[631,1746,1747],{},"timeoutMs","\n(its signal aborts then), acks a job that went well, puts a failed one back after ",[631,1750,1751],{},"backoffMs × 2^(attempt − 1)",", at\nmost an hour, plus up to 20 % jitter (",[631,1754,1755],{},"retryDelay",", on the kernel's ",[631,1758,1759],{},"backoffDelay","), and\npast ",[631,1762,1763],{},"retries"," calls the queue's ",[631,1766,1767],{},"giveUp"," and acks it. A job is acked only after ",[631,1770,1682],{}," recorded how it ended;\none whose record failed (Postgres away) stays claimed and comes back as its next try. A claimed job never acked (its\nworker died) comes back after ",[631,1773,1774],{},"QUEUE_VISIBILITY_MS"," (a minute), counted as a try: handlers are idempotent, and a job\nclaimed again past its last try (it stopped the worker each time) is given up without running.",[990,1777,1778,1779,1456,1782,1785,1786,1788,1789,1792,1793,1796,1797,1800,1801,1804,1805,1808],{},"On the worker container role, ",[631,1780,1781],{},"startQueues",[631,1783,1784],{},"apps\u002Fapi\u002Fsrc\u002Fbootstrap\u002Fworker.ts"," runs the relay (on the ",[631,1787,739],{},"\nchannel, after Redis comes back, and every ",[631,1790,1791],{},"OUTBOX_RELAY_EVERY_MS",", 5 s) and the consumer, as the system; stopping\nwaits for the jobs under way until the stop deadline less five seconds (",[631,1794,1795],{},"SHADE_STOP_GRACE_MS","), then aborts their\nsignal and gives them back to their queue at once (the port's ",[631,1798,1799],{},"release","), the try not counted. ",[631,1802,1803],{},"QUEUE_RETRY_WAIT_MS"," replaces every queue's first wait; only the tests change it\n(",[631,1806,1807],{},"e2e\u002Fserver.ts",": 200 ms).",[990,1810,1811,1812,1815],{},"A job that runs out of tries shows where it belongs, never in a list of its own: a webhook\ndelivery as ",[636,1813,1814],{},"failed"," on the Webhooks screen, sent again from there, and counted on its module's\nhealth card.",[1817,1818,1820],"h3",{"id":1819},"modules-jobs","Modules' jobs",[619,1822,1823,1824,1827,1828,1831,1832,629,1835,1838,1839,1841,1842,693,1844,693,1847,1849,1850,1852,1853,1856,1857,1860,1861,1864,1865,1868,1869,1872,1873,1876,1877,639],{},"A trusted module declares its kinds of job (",[631,1825,1826],{},"kernel\u002Fqueue\u002Fmodule-jobs.ts","; the manifest part in ",[631,1829,1830],{},"features\u002Fqueue\u002Fserver\u002Fmanifest.ts",")\nin the manifest part ",[631,1833,1834],{},"jobs",[631,1836,1837],{},"{ name, run(ctx, data, job), giveUp? }","), each with its parameters in the ",[631,1840,739],{},"\ncapability (",[631,1843,1763],{},[631,1845,1846],{},"backoffMs",[631,1848,1735],{},", optional ",[631,1851,1747],{}," up to 55 s, default 30 s). ",[631,1854,1855],{},"enqueueJob(ctx, name, data, { runAt, key })"," from the module's own context writes one in its change's transaction (and wakes the relay\nafter the commit); ",[631,1858,1859],{},"cancelModuleJob(ctx, name, key)"," takes one back. Each kind is a queue named\n",[631,1862,1863],{},"package:\u003Cplugin>:\u003Cjob>",", registered when the catalog loads. A job runs as the module's own actor (",[631,1866,1867],{},"asModule","), waits\nits tries out while the module is off, and one that gave up is in the error log (",[631,1870,1871],{},"package:\u003Cname>",", scope\n",[631,1874,1875],{},"queue: \u003Cqueue>",") and counted on the module's health card for 7 days (",[631,1878,1879],{},"failedJobsOf",[652,1881,1883],{"id":1882},"configuration","Configuration",[987,1885,1886,1915,1942,1976],{},[990,1887,1888,1891,1892,1693,1895,1898,1899,1902,1903,1906,1907,1910,1911,1914],{},[631,1889,1890],{},"REDIS_URL"," (required): ",[631,1893,1894],{},"redis:\u002F\u002F",[631,1896,1897],{},"rediss:\u002F\u002F",", with the password Redis is started with\n(",[631,1900,1901],{},"redis:\u002F\u002F:\u003Cpassword>@redis:6379",", a database number after the last ",[631,1904,1905],{},"\u002F"," if wanted). Missing, without a password or\nof another kind, the API stops with ",[631,1908,1909],{},"[config] REDIS_URL: …","; when Redis does not answer within 10 seconds, with\n",[631,1912,1913],{},"Cannot reach Redis at redis:\u002F\u002F:***@…: … Check REDIS_URL and its password; in development … docker compose up -d redis",". The password never reaches the log.",[990,1916,1917,1920,1921,1924,1925,1693,1928,1931,1932,1934,1935,1937,1938,1941],{},[631,1918,1919],{},"\u002Fhealth"," reports ",[631,1922,1923],{},"checks.redis"," as ",[631,1926,1927],{},"up",[631,1929,1930],{},"down"," (a ping within a second; ",[631,1933,1930],{}," at once while the connection is\naway). ",[631,1936,1919],{}," is the readiness answer and is 503 then, so a proxy stops sending requests to the container; the\nprocess lives, and ",[631,1939,1940],{},"\u002Fhealth\u002Flive"," still answers 200, since restarting it would not bring Redis back.",[990,1943,1944,1945,689,1948,629,1951,716,1954,1957,1958,693,1961,1307,1964,1967,1968,1971,1972,1975],{},"The settings, the same in ",[631,1946,1947],{},"docker-compose.yml",[631,1949,1950],{},"deploy\u002Fcompose.yml",[631,1952,1953],{},"valkey-server",[631,1955,1956],{},"valkey-cli"," for the health\nchecks): ",[631,1959,1960],{},"--requirepass",[631,1962,1963],{},"--maxmemory 64mb",[631,1965,1966],{},"--maxmemory-policy noeviction"," (a full Redis refuses writes instead of evicting a lease, which would let a schedule\nrun twice), ",[631,1969,1970],{},"--appendonly no --save \"\""," (nothing it holds needs to survive). In the template it has no published\nport, runs as the image's ",[631,1973,1974],{},"valkey"," user with a read-only filesystem and every capability dropped, and the API containers start\nonce it is healthy.",[990,1977,1978],{},"The client opens its connection with the first command (start-up's ping), retries a command at most three times while\nreconnecting (so a renewal fails instead of hanging) and reconnects on its own; connection errors are logged, the same\none at most once a minute.",[652,1980,1982],{"id":1981},"development","Development",[619,1984,1985,1988,1989,1992,1993,1995,1996,1999,2000,2002,2003,1456,2006,629,2009,2012,2013,2016,2017,2021,2022,749],{},[631,1986,1987],{},"pnpm dev"," starts the ",[631,1990,1991],{},"redis"," service of ",[631,1994,1947],{}," with Postgres (",[631,1997,1998],{},"127.0.0.1:6379",", password ",[631,2001,1104],{},"). Put\n",[631,2004,2005],{},"REDIS_URL=redis:\u002F\u002F:shade@localhost:6379",[631,2007,2008],{},".env",[631,2010,2011],{},".env.example"," has it). That password is for development only:\nan instance gets its own (",[631,2014,2015],{},"REDIS_PASSWORD",", generated on the first start by the deployment template, see ",[948,2018,2020],{"href":2019},"\u002Frun\u002Fcoolify#the-template-as-one-docker-compose-resource","Setting up an instance","). On its own: ",[631,2023,2024],{},"docker compose up -d redis",[652,2026,2028],{"id":2027},"tests","Tests",[987,2030,2031,2062,2071,2101,2125,2144],{},[990,2032,2033,629,2036,2038,2039,2042,2043,2046,2047,2050,2051,2054,2055,2057,2058,2061],{},[626,2034,2035],{},"The contract",[631,2037,789],{},") runs on the memory ports\n(",[631,2040,2041],{},"shade\u002Ftest\u002Fkernel\u002Fcoordination\u002Fleases.test.ts",", unit, with the test clock) and on Redis\n(",[631,2044,2045],{},"apps\u002Fapi\u002Ftest\u002Fredis\u002Fdriver.test.ts",", in the ",[631,2048,2049],{},"db"," project). Leases: \"gives a lease to one holder at a time\", \"lets\nanother holder take over after the lease expires\", \"renews and releases only for the holder\", \"raises the fencing\ntoken on every new holder\", \"aborts lost when a renewal fails\", \"marks a due time once across holders, until it\nexpires\". The queue: one consumer per job, at most ",[631,2052,2053],{},"max","\noldest first, taken back after the visibility time, delayed and retried with the attempt raised, one job per dedupe\nkey. Messages: every subscriber of a channel and no one after unsubscribing, \"carries only kind and version: a\nmessage says re-read, never the truth\", ",[631,2056,1196],{}," after a lost connection (on Redis the test cuts the\nsubscription's connection with ",[631,2059,2060],{},"CLIENT KILL","). Counters: a burst of 20 counted once each, five allowed; reset.\nCache: the TTL, required; single use; a group's limit, the oldest written dropped.",[990,2063,2064,629,2067,2070],{},[626,2065,2066],{},"The driver",[631,2068,2069],{},"driver.test.ts","): its keys and messages stay under its prefix and expire; the health check and\nstart-up's check; a wrong password refused without showing it.",[990,2072,2073,2075,2076],{},[626,2074,1386],{},":\n",[987,2077,2078,2084,2090,2098],{},[990,2079,2080,2083],{},[631,2081,2082],{},"shade\u002Ftest\u002Fkernel\u002Fcoordination\u002Ffollow.test.ts"," (memory ports, test clock): \"re-reads at once when another container\nannounces a change\", \"catches a lost message with the safety re-read after 60 seconds\", \"re-reads at once after a\nreconnect, for the messages it may have missed\", \"never re-reads twice at once: what comes in meanwhile makes one\nmore run\", \"tries a failed subscription again at the safety re-read\"; announcing never fails or waits.",[990,2085,2086,2089],{},[631,2087,2088],{},"apps\u002Fapi\u002Ftest\u002Fbootstrap\u002Frestart.test.ts",": a request restarts at once and only once, a forged message changes\nnothing, a lost one is caught within 60 seconds, a reconnect checks at once.",[990,2091,2092,629,2095,2097],{},[631,2093,2094],{},"apps\u002Fapi\u002Ftest\u002Fbootstrap\u002Fruntime.messages.test.ts",[631,2096,2049],{}," project): two runtimes on one test database and the test Redis, as two\ncontainers. \"gives another container a new Site URL at once\", a new frontend's origin, \"gives another container a\nnew custom role at once\", \"switches a module in another container at once\", \"restarts another container at once\nwhen an admin asks\", \"re-reads at once when Redis comes back, for what it missed meanwhile\" (the test cuts the\nsubscription's connection); and on the memory ports with a test clock, \"catches a change whose message was lost,\nwithin 60 seconds\" and \"catches a lost message about an untrusted module's stop within 5 seconds, while the rest\nwaits for 60\".",[990,2099,2100],{},"The browser tests run every API on the test Redis, so switching modules, roles and settings there goes through\nthe messages too.",[990,2102,2103,2106,2107,2110,2111,2114,2115,629,2118,2120,2121,2124],{},[626,2104,2105],{},"Configuration and start-up",": ",[631,2108,2109],{},"apps\u002Fapi\u002Ftest\u002Fconfig.test.ts"," (\"refuses to start without REDIS_URL\", and an address\nwithout a password), ",[631,2112,2113],{},"apps\u002Fapi\u002Ftest\u002Fbootstrap\u002Fstart.test.ts"," (no Redis at the address), ",[631,2116,2117],{},"routes\u002Fweb.test.ts",[631,2119,1919],{},"\nwith Redis down) and ",[631,2122,2123],{},"e2e\u002Ftests\u002Fhealth.spec.ts"," (up, on the test Redis).",[990,2126,2127,2106,2130,2133,2134,2136,2137,2140,2141,749],{},[626,2128,2129],{},"Deployment",[631,2131,2132],{},"test\u002Fscripts\u002Fdeploy-template.test.ts"," holds the Redis service's settings and ",[631,2135,1890],{}," on the three\nAPI container roles; ",[631,2138,2139],{},"pnpm deploy:smoke"," checks in the running template that they reach Redis, that it asks for its\npassword and that its policy is ",[631,2142,2143],{},"noeviction",[990,2145,2146,916,2149,2152,2153,2155,2156,2159,2160,2163,2164,2167,2168,2171,2172,2174,2175,2178],{},[626,2147,2148],{},"The test Redis",[631,2150,2151],{},"redis-test"," container of ",[631,2154,1947],{}," (Valkey, ",[631,2157,2158],{},"127.0.0.1:6380",", nothing on disk), started\nby the tests themselves (",[631,2161,2162],{},"scripts\u002Ftest-redis.mjs","), or ",[631,2165,2166],{},"SHADE_TEST_REDIS_URL",". Test slot ",[636,2169,2170],{},"n"," uses its database ",[636,2173,2170],{},";\neach driver test case keeps its keys under a prefix of its own and removes them. The browser tests' APIs and the\nsite's run on it too (",[631,2176,2177],{},"E2E_REDIS_URL"," points them elsewhere).",{"title":2180,"searchDepth":2181,"depth":2181,"links":2182},"",2,[2183,2184,2185,2186,2187,2191,2192,2193],{"id":654,"depth":2181,"text":655},{"id":979,"depth":2181,"text":980},{"id":745,"depth":2181,"text":712},{"id":1385,"depth":2181,"text":1386},{"id":1594,"depth":2181,"text":1096,"children":2188},[2189],{"id":1819,"depth":2190,"text":1820},3,{"id":1882,"depth":2181,"text":1883},{"id":1981,"depth":2181,"text":1982},{"id":2027,"depth":2181,"text":2028},"md",null,{},true,{"title":397,"description":2180},"CF-lSq4gJkPVptgFr4YSZ9U-duVEiP__PEX5n2N0sy4",[2201,2202],{"title":393,"path":394,"stem":395,"description":2180,"children":-1},{"title":401,"path":402,"stem":403,"description":2180,"children":-1},1796500154538]