[{"data":1,"prerenderedAt":1351},["ShallowReactive",2],{"navigation_docs":3,"-modules-commerce-subscriptions-server":587,"-modules-commerce-subscriptions-server-surround":1346},[4,50,155,441,504],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":49},"Get Started","i-lucide-rocket","\u002Fget-started","1.get-started",[10,15,20,25,30,35,40,45],{"title":11,"path":12,"stem":13,"icon":14},"Introduction","\u002Fget-started\u002Fintroduction","1.get-started\u002F1.introduction","i-lucide-house",{"title":16,"path":17,"stem":18,"icon":19},"Installation","\u002Fget-started\u002Finstallation","1.get-started\u002F2.installation","i-lucide-download",{"title":21,"path":22,"stem":23,"icon":24},"Project structure","\u002Fget-started\u002Fproject-structure","1.get-started\u002F3.project-structure","i-lucide-folder-tree",{"title":26,"path":27,"stem":28,"icon":29},"Configuration","\u002Fget-started\u002Fconfiguration","1.get-started\u002F4.configuration","i-lucide-settings",{"title":31,"path":32,"stem":33,"icon":34},"Authentication","\u002Fget-started\u002Fauthentication","1.get-started\u002F5.authentication","i-lucide-lock",{"title":36,"path":37,"stem":38,"icon":39},"Adding modules","\u002Fget-started\u002Fadding-modules","1.get-started\u002F6.adding-modules","i-lucide-puzzle",{"title":41,"path":42,"stem":43,"icon":44},"Database","\u002Fget-started\u002Fdatabase","1.get-started\u002F7.database","i-lucide-database",{"title":46,"path":47,"stem":48,"icon":6},"Deployment","\u002Fget-started\u002Fdeployment","1.get-started\u002F8.deployment",false,{"title":51,"icon":52,"path":53,"stem":54,"children":55,"page":49},"Guide","i-lucide-book-open","\u002Fguide","2.guide",[56,90,115,125],{"title":57,"icon":49,"path":58,"stem":59,"children":60,"page":49},"Concepts","\u002Fguide\u002Fconcepts","2.guide\u002F1.concepts",[61,66,71,76,80,85],{"title":62,"path":63,"stem":64,"icon":65},"Architecture","\u002Fguide\u002Fconcepts\u002Farchitecture","2.guide\u002F1.concepts\u002F1.architecture","i-lucide-blocks",{"title":67,"path":68,"stem":69,"icon":70},"Access control","\u002Fguide\u002Fconcepts\u002Fauth-and-scopes","2.guide\u002F1.concepts\u002F2.auth-and-scopes","i-lucide-shield-check",{"title":72,"path":73,"stem":74,"icon":75},"Extension points","\u002Fguide\u002Fconcepts\u002Fextension-points","2.guide\u002F1.concepts\u002F3.extension-points","i-lucide-plug",{"title":77,"path":78,"stem":79,"icon":44},"Database extensions","\u002Fguide\u002Fconcepts\u002Fdatabase-extensions","2.guide\u002F1.concepts\u002F4.database-extensions",{"title":81,"path":82,"stem":83,"icon":84},"Identity","\u002Fguide\u002Fconcepts\u002Fidentity","2.guide\u002F1.concepts\u002F5.identity","i-lucide-fingerprint",{"title":86,"path":87,"stem":88,"icon":89},"Glossary","\u002Fguide\u002Fconcepts\u002Fglossary","2.guide\u002F1.concepts\u002F6.glossary","i-lucide-book-a",{"title":91,"icon":49,"path":92,"stem":93,"children":94,"page":49},"UX patterns","\u002Fguide\u002Fux-patterns","2.guide\u002F2.ux-patterns",[95,100,105,110],{"title":96,"path":97,"stem":98,"icon":99},"Layouts and navigation","\u002Fguide\u002Fux-patterns\u002Flayouts-and-navigation","2.guide\u002F2.ux-patterns\u002F1.layouts-and-navigation","i-lucide-layout-template",{"title":101,"path":102,"stem":103,"icon":104},"Pages","\u002Fguide\u002Fux-patterns\u002Fpages","2.guide\u002F2.ux-patterns\u002F2.pages","i-lucide-table",{"title":106,"path":107,"stem":108,"icon":109},"Forms and actions","\u002Fguide\u002Fux-patterns\u002Fforms-and-actions","2.guide\u002F2.ux-patterns\u002F3.forms-and-actions","i-lucide-square-pen",{"title":111,"path":112,"stem":113,"icon":114},"Text and formatting","\u002Fguide\u002Fux-patterns\u002Ftext-and-formatting","2.guide\u002F2.ux-patterns\u002F4.text-and-formatting","i-lucide-type",{"title":116,"icon":49,"path":117,"stem":118,"children":119,"page":49},"Best practices","\u002Fguide\u002Fbest-practices","2.guide\u002F3.best-practices",[120],{"title":121,"path":122,"stem":123,"icon":124},"HTTP routes","\u002Fguide\u002Fbest-practices\u002Fhttp-routes","2.guide\u002F3.best-practices\u002F1.http-routes","i-lucide-route",{"title":126,"icon":49,"path":127,"stem":128,"children":129,"page":49},"Going further","\u002Fguide\u002Fgoing-further","2.guide\u002F4.going-further",[130,135,140,145,150],{"title":131,"path":132,"stem":133,"icon":134},"Use your own OAuth server","\u002Fguide\u002Fgoing-further\u002Fown-oauth-server","2.guide\u002F4.going-further\u002F1.own-oauth-server","i-lucide-key-round",{"title":136,"path":137,"stem":138,"icon":139},"Create an OAuth application","\u002Fguide\u002Fgoing-further\u002Foauth-application","2.guide\u002F4.going-further\u002F2.oauth-application","i-lucide-app-window",{"title":141,"path":142,"stem":143,"icon":144},"Signing keys","\u002Fguide\u002Fgoing-further\u002Fsigning-keys","2.guide\u002F4.going-further\u002F3.signing-keys","i-lucide-key-square",{"title":146,"path":147,"stem":148,"icon":149},"Stripe setup","\u002Fguide\u002Fgoing-further\u002Fstripe-setup","2.guide\u002F4.going-further\u002F4.stripe-setup","i-lucide-credit-card",{"title":151,"path":152,"stem":153,"icon":154},"Migrate to the permission model","\u002Fguide\u002Fgoing-further\u002Fmigrate-access-control","2.guide\u002F4.going-further\u002F5.migrate-access-control","i-lucide-arrow-right-left",{"title":156,"icon":157,"path":158,"stem":159,"children":160},"Modules","i-lucide-boxes","\u002Fmodules","3.modules",[161,163,244,273,320,375],{"title":156,"path":158,"stem":162},"3.modules\u002Findex",{"title":81,"icon":49,"path":164,"stem":165,"children":166,"page":49},"\u002Fmodules\u002Fidentity","3.modules\u002F1.identity",[167,190,194,198,220,224,240],{"title":168,"path":169,"stem":170,"children":171},"Auth","\u002Fmodules\u002Fidentity\u002Fauth","3.modules\u002F1.identity\u002F1.auth\u002Findex",[172,174,178,182,186],{"title":173,"path":169,"stem":170},"Overview",{"title":175,"path":176,"stem":177},"Server API","\u002Fmodules\u002Fidentity\u002Fauth\u002Fserver","3.modules\u002F1.identity\u002F1.auth\u002F2.server",{"title":179,"path":180,"stem":181},"Reference","\u002Fmodules\u002Fidentity\u002Fauth\u002Freference","3.modules\u002F1.identity\u002F1.auth\u002F3.reference",{"title":183,"path":184,"stem":185},"Client mode","\u002Fmodules\u002Fidentity\u002Fauth\u002Fclient-mode","3.modules\u002F1.identity\u002F1.auth\u002F4.client-mode",{"title":187,"path":188,"stem":189},"OAuth providers","\u002Fmodules\u002Fidentity\u002Fauth\u002Foauth-providers","3.modules\u002F1.identity\u002F1.auth\u002F5.oauth-providers",{"title":191,"path":192,"stem":193},"Users","\u002Fmodules\u002Fidentity\u002Fusers","3.modules\u002F1.identity\u002F2.users",{"title":195,"path":196,"stem":197},"Account","\u002Fmodules\u002Fidentity\u002Faccount","3.modules\u002F1.identity\u002F3.account",{"title":199,"path":200,"stem":201,"children":202},"Authorization","\u002Fmodules\u002Fidentity\u002Fauthorization","3.modules\u002F1.identity\u002F4.authorization\u002Findex",[203,204,208,212,216],{"title":173,"path":200,"stem":201},{"title":205,"path":206,"stem":207},"Roles and requirements","\u002Fmodules\u002Fidentity\u002Fauthorization\u002Froles-and-requirements","3.modules\u002F1.identity\u002F4.authorization\u002F2.roles-and-requirements",{"title":209,"path":210,"stem":211},"Policies","\u002Fmodules\u002Fidentity\u002Fauthorization\u002Fpolicies","3.modules\u002F1.identity\u002F4.authorization\u002F3.policies",{"title":213,"path":214,"stem":215},"Client","\u002Fmodules\u002Fidentity\u002Fauthorization\u002Fclient","3.modules\u002F1.identity\u002F4.authorization\u002F4.client",{"title":217,"path":218,"stem":219},"Admin","\u002Fmodules\u002Fidentity\u002Fauthorization\u002Fadmin","3.modules\u002F1.identity\u002F4.authorization\u002F5.admin",{"title":221,"path":222,"stem":223},"Preferences","\u002Fmodules\u002Fidentity\u002Fpreferences","3.modules\u002F1.identity\u002F5.preferences",{"title":225,"path":226,"stem":227,"children":228},"OAuth Server","\u002Fmodules\u002Fidentity\u002Foauth-server","3.modules\u002F1.identity\u002F6.oauth-server\u002Findex",[229,230,233,237],{"title":173,"path":226,"stem":227},{"title":175,"path":231,"stem":232},"\u002Fmodules\u002Fidentity\u002Foauth-server\u002Fserver","3.modules\u002F1.identity\u002F6.oauth-server\u002F2.server",{"title":234,"path":235,"stem":236},"Hooks","\u002Fmodules\u002Fidentity\u002Foauth-server\u002Fhooks","3.modules\u002F1.identity\u002F6.oauth-server\u002F3.hooks",{"title":179,"path":238,"stem":239},"\u002Fmodules\u002Fidentity\u002Foauth-server\u002Froutes-and-clients","3.modules\u002F1.identity\u002F6.oauth-server\u002F4.routes-and-clients",{"title":241,"path":242,"stem":243},"OAuth Resource","\u002Fmodules\u002Fidentity\u002Foauth-resource","3.modules\u002F1.identity\u002F8.oauth-resource",{"title":245,"icon":49,"path":246,"stem":247,"children":248,"page":49},"Commerce","\u002Fmodules\u002Fcommerce","3.modules\u002F2.commerce",[249,253,257],{"title":250,"path":251,"stem":252},"Stripe","\u002Fmodules\u002Fcommerce\u002Fstripe","3.modules\u002F2.commerce\u002F1.stripe",{"title":254,"path":255,"stem":256},"Payments","\u002Fmodules\u002Fcommerce\u002Fpayments","3.modules\u002F2.commerce\u002F2.payments",{"title":258,"path":259,"stem":260,"children":261},"Subscriptions","\u002Fmodules\u002Fcommerce\u002Fsubscriptions","3.modules\u002F2.commerce\u002F3.subscriptions\u002Findex",[262,263,266,270],{"title":173,"path":259,"stem":260},{"title":175,"path":264,"stem":265},"\u002Fmodules\u002Fcommerce\u002Fsubscriptions\u002Fserver","3.modules\u002F2.commerce\u002F3.subscriptions\u002F2.server",{"title":267,"path":268,"stem":269},"App","\u002Fmodules\u002Fcommerce\u002Fsubscriptions\u002Fapp","3.modules\u002F2.commerce\u002F3.subscriptions\u002F3.app",{"title":179,"path":271,"stem":272},"\u002Fmodules\u002Fcommerce\u002Fsubscriptions\u002Freference","3.modules\u002F2.commerce\u002F3.subscriptions\u002F4.reference",{"title":274,"icon":49,"path":275,"stem":276,"children":277,"page":49},"Features","\u002Fmodules\u002Ffeatures","3.modules\u002F3.features",[278,293,312,316],{"title":279,"path":280,"stem":281,"children":282},"Events","\u002Fmodules\u002Ffeatures\u002Fevents","3.modules\u002F3.features\u002F1.events\u002Findex",[283,284,287,290],{"title":173,"path":280,"stem":281},{"title":175,"path":285,"stem":286},"\u002Fmodules\u002Ffeatures\u002Fevents\u002Fserver","3.modules\u002F3.features\u002F1.events\u002F2.server",{"title":267,"path":288,"stem":289},"\u002Fmodules\u002Ffeatures\u002Fevents\u002Fapp","3.modules\u002F3.features\u002F1.events\u002F3.app",{"title":179,"path":291,"stem":292},"\u002Fmodules\u002Ffeatures\u002Fevents\u002Freference","3.modules\u002F3.features\u002F1.events\u002F4.reference",{"title":294,"path":295,"stem":296,"children":297},"Forms","\u002Fmodules\u002Ffeatures\u002Fforms","3.modules\u002F3.features\u002F2.forms\u002Findex",[298,299,303,306,309],{"title":173,"path":295,"stem":296},{"title":300,"path":301,"stem":302},"Definition","\u002Fmodules\u002Ffeatures\u002Fforms\u002Fdefinition","3.modules\u002F3.features\u002F2.forms\u002F2.definition",{"title":175,"path":304,"stem":305},"\u002Fmodules\u002Ffeatures\u002Fforms\u002Fserver","3.modules\u002F3.features\u002F2.forms\u002F3.server",{"title":267,"path":307,"stem":308},"\u002Fmodules\u002Ffeatures\u002Fforms\u002Fapp","3.modules\u002F3.features\u002F2.forms\u002F4.app",{"title":179,"path":310,"stem":311},"\u002Fmodules\u002Ffeatures\u002Fforms\u002Freference","3.modules\u002F3.features\u002F2.forms\u002F5.reference",{"title":313,"path":314,"stem":315},"Cookie Consent","\u002Fmodules\u002Ffeatures\u002Fcookie-consent","3.modules\u002F3.features\u002F3.cookie-consent",{"title":317,"path":318,"stem":319},"MCP","\u002Fmodules\u002Ffeatures\u002Fmcp","3.modules\u002F3.features\u002F4.mcp",{"title":321,"icon":49,"path":322,"stem":323,"children":324,"page":49},"Interface","\u002Fmodules\u002Finterface","3.modules\u002F4.interface",[325,350,353,357,361],{"title":326,"path":327,"stem":328,"children":329},"UI","\u002Fmodules\u002Finterface\u002Fui","3.modules\u002F4.interface\u002F1.ui\u002Findex",[330,331,335,339,343,347],{"title":173,"path":327,"stem":328},{"title":332,"path":333,"stem":334},"Page components","\u002Fmodules\u002Finterface\u002Fui\u002Fpage-components","3.modules\u002F4.interface\u002F1.ui\u002F2.page-components",{"title":336,"path":337,"stem":338},"App shell","\u002Fmodules\u002Finterface\u002Fui\u002Fapp-shell","3.modules\u002F4.interface\u002F1.ui\u002F3.app-shell",{"title":340,"path":341,"stem":342},"Form inputs","\u002Fmodules\u002Finterface\u002Fui\u002Fform-inputs","3.modules\u002F4.interface\u002F1.ui\u002F4.form-inputs",{"title":344,"path":345,"stem":346},"Composables and helpers","\u002Fmodules\u002Finterface\u002Fui\u002Fcomposables","3.modules\u002F4.interface\u002F1.ui\u002F5.composables",{"title":179,"path":348,"stem":349},"\u002Fmodules\u002Finterface\u002Fui\u002Freference","3.modules\u002F4.interface\u002F1.ui\u002F6.reference",{"title":217,"path":351,"stem":352},"\u002Fmodules\u002Finterface\u002Fadmin","3.modules\u002F4.interface\u002F2.admin",{"title":354,"path":355,"stem":356},"Menu","\u002Fmodules\u002Finterface\u002Fmenu","3.modules\u002F4.interface\u002F3.menu",{"title":358,"path":359,"stem":360},"Widget","\u002Fmodules\u002Finterface\u002Fwidget","3.modules\u002F4.interface\u002F4.widget",{"title":362,"path":363,"stem":364,"children":365},"Mobile","\u002Fmodules\u002Finterface\u002Fmobile","3.modules\u002F4.interface\u002F5.mobile\u002Findex",[366,367,371],{"title":173,"path":363,"stem":364},{"title":368,"path":369,"stem":370},"CLI and devices","\u002Fmodules\u002Finterface\u002Fmobile\u002Fcli-and-devices","3.modules\u002F4.interface\u002F5.mobile\u002F2.cli-and-devices",{"title":372,"path":373,"stem":374},"Splash screen","\u002Fmodules\u002Finterface\u002Fmobile\u002Fsplash-screen","3.modules\u002F4.interface\u002F5.mobile\u002F3.splash-screen",{"title":376,"icon":49,"path":377,"stem":378,"children":379,"page":49},"Platform","\u002Fmodules\u002Fplatform","3.modules\u002F5.platform",[380,402,406,423],{"title":381,"path":382,"stem":383,"children":384},"Module Kit","\u002Fmodules\u002Fplatform\u002Fmodule-kit","3.modules\u002F5.platform\u002F1.module-kit\u002Findex",[385,386,390,394,398],{"title":173,"path":382,"stem":383},{"title":387,"path":388,"stem":389},"Server toolkit","\u002Fmodules\u002Fplatform\u002Fmodule-kit\u002Fserver-toolkit","3.modules\u002F5.platform\u002F1.module-kit\u002F2.server-toolkit",{"title":391,"path":392,"stem":393},"Registries and menus","\u002Fmodules\u002Fplatform\u002Fmodule-kit\u002Fregistries-and-menus","3.modules\u002F5.platform\u002F1.module-kit\u002F3.registries-and-menus",{"title":395,"path":396,"stem":397},"Translations","\u002Fmodules\u002Fplatform\u002Fmodule-kit\u002Fi18n","3.modules\u002F5.platform\u002F1.module-kit\u002F4.i18n",{"title":399,"path":400,"stem":401},"Database helpers","\u002Fmodules\u002Fplatform\u002Fmodule-kit\u002Fdatabase","3.modules\u002F5.platform\u002F1.module-kit\u002F5.database",{"title":403,"path":404,"stem":405},"Notify","\u002Fmodules\u002Fplatform\u002Fnotify","3.modules\u002F5.platform\u002F2.notify",{"title":407,"path":408,"stem":409,"children":410},"Email Templates","\u002Fmodules\u002Fplatform\u002Femail-templates","3.modules\u002F5.platform\u002F3.email-templates\u002Findex",[411,412,416,419],{"title":173,"path":408,"stem":409},{"title":413,"path":414,"stem":415},"Email components","\u002Fmodules\u002Fplatform\u002Femail-templates\u002Fcomponents","3.modules\u002F5.platform\u002F3.email-templates\u002F2.components",{"title":175,"path":417,"stem":418},"\u002Fmodules\u002Fplatform\u002Femail-templates\u002Fserver","3.modules\u002F5.platform\u002F3.email-templates\u002F3.server",{"title":420,"path":421,"stem":422},"Module emails","\u002Fmodules\u002Fplatform\u002Femail-templates\u002Fmodule-emails","3.modules\u002F5.platform\u002F3.email-templates\u002F4.module-emails",{"title":424,"path":425,"stem":426,"children":427},"Base Layer","\u002Fmodules\u002Fplatform\u002Fbase-layer","3.modules\u002F5.platform\u002F4.base-layer\u002Findex",[428,429,433,437],{"title":173,"path":425,"stem":426},{"title":430,"path":431,"stem":432},"Content collections","\u002Fmodules\u002Fplatform\u002Fbase-layer\u002Fcontent-collections","3.modules\u002F5.platform\u002F4.base-layer\u002F2.content-collections",{"title":434,"path":435,"stem":436},"Layouts and routing","\u002Fmodules\u002Fplatform\u002Fbase-layer\u002Flayouts-and-routing","3.modules\u002F5.platform\u002F4.base-layer\u002F3.layouts-and-routing",{"title":438,"path":439,"stem":440},"Composables and utils","\u002Fmodules\u002Fplatform\u002Fbase-layer\u002Fcomposables-and-utils","3.modules\u002F5.platform\u002F4.base-layer\u002F4.composables-and-utils",{"title":442,"icon":443,"path":444,"stem":445,"children":446,"page":49},"Examples","i-lucide-code-xml","\u002Fexamples","4.examples",[447,466,476],{"title":448,"icon":49,"path":449,"stem":450,"children":451,"page":49},"Starters","\u002Fexamples\u002Fstarters","4.examples\u002F1.starters",[452,456,461],{"title":453,"path":454,"stem":455,"icon":6},"Workspace starter","\u002Fexamples\u002Fstarters\u002Fworkspace","4.examples\u002F1.starters\u002F1.workspace",{"title":457,"path":458,"stem":459,"icon":460},"Mobile starter","\u002Fexamples\u002Fstarters\u002Fmobile","4.examples\u002F1.starters\u002F2.mobile","i-lucide-smartphone",{"title":462,"path":463,"stem":464,"icon":465},"Standalone mobile starter","\u002Fexamples\u002Fstarters\u002Fmobile-standalone","4.examples\u002F1.starters\u002F3.mobile-standalone","i-lucide-tablet-smartphone",{"title":467,"icon":49,"path":468,"stem":469,"children":470,"page":49},"Apps","\u002Fexamples\u002Fapps","4.examples\u002F2.apps",[471],{"title":472,"path":473,"stem":474,"icon":475},"Frigear website app","\u002Fexamples\u002Fapps\u002Ffrigear-nu-website","4.examples\u002F2.apps\u002F1.frigear-nu-website","i-lucide-layout-dashboard",{"title":477,"icon":49,"path":478,"stem":479,"children":480,"page":49},"Tasks","\u002Fexamples\u002Ftasks","4.examples\u002F3.tasks",[481,485,489,494,499],{"title":482,"path":483,"stem":484,"icon":70},"Protect a route","\u002Fexamples\u002Ftasks\u002Fprotect-a-route","4.examples\u002F3.tasks\u002F1.protect-a-route",{"title":486,"path":487,"stem":488,"icon":475},"Add an admin page","\u002Fexamples\u002Ftasks\u002Fadd-an-admin-page","4.examples\u002F3.tasks\u002F2.add-an-admin-page",{"title":490,"path":491,"stem":492,"icon":493},"Sell event tickets","\u002Fexamples\u002Ftasks\u002Fsell-event-tickets","4.examples\u002F3.tasks\u002F3.sell-event-tickets","i-lucide-ticket",{"title":495,"path":496,"stem":497,"icon":498},"Build a form","\u002Fexamples\u002Ftasks\u002Fbuild-a-form","4.examples\u002F3.tasks\u002F4.build-a-form","i-lucide-clipboard-list",{"title":500,"path":501,"stem":502,"icon":503},"Send an email","\u002Fexamples\u002Ftasks\u002Fsend-an-email","4.examples\u002F3.tasks\u002F5.send-an-email","i-lucide-mail",{"title":505,"icon":506,"path":507,"stem":508,"children":509,"page":49},"Contribute","i-lucide-git-pull-request","\u002Fcontribute","5.contribute",[510,513,518,544,549,552,556,571],{"title":173,"path":511,"stem":512,"icon":506},"\u002Fcontribute\u002Foverview","5.contribute\u002F1.overview",{"title":514,"path":515,"stem":516,"icon":517},"Local development","\u002Fcontribute\u002Flocal-development","5.contribute\u002F2.local-development","i-lucide-terminal",{"title":519,"icon":49,"path":520,"stem":521,"children":522,"page":49},"Writing a module","\u002Fcontribute\u002Fwriting-a-module","5.contribute\u002F3.writing-a-module",[523,527,532,536,541],{"title":524,"path":525,"stem":526,"icon":39},"Scaffold a module","\u002Fcontribute\u002Fwriting-a-module\u002Fscaffold","5.contribute\u002F3.writing-a-module\u002F1.scaffold",{"title":528,"path":529,"stem":530,"icon":531},"Setup checklist","\u002Fcontribute\u002Fwriting-a-module\u002Fsetup-checklist","5.contribute\u002F3.writing-a-module\u002F2.setup-checklist","i-lucide-list-checks",{"title":533,"path":534,"stem":535,"icon":44},"Database tables","\u002Fcontribute\u002Fwriting-a-module\u002Fdatabase-tables","5.contribute\u002F3.writing-a-module\u002F3.database-tables",{"title":537,"path":538,"stem":539,"icon":540},"Testing","\u002Fcontribute\u002Fwriting-a-module\u002Ftesting","5.contribute\u002F3.writing-a-module\u002F4.testing","i-lucide-flask-conical",{"title":67,"path":542,"stem":543,"icon":70},"\u002Fcontribute\u002Fwriting-a-module\u002Faccess-control","5.contribute\u002F3.writing-a-module\u002F5.access-control",{"title":545,"path":546,"stem":547,"icon":548},"Publishing","\u002Fcontribute\u002Fpublishing","5.contribute\u002F4.publishing","i-lucide-package-check",{"title":448,"path":550,"stem":551,"icon":6},"\u002Fcontribute\u002Fstarters","5.contribute\u002F5.starters",{"title":553,"path":554,"stem":555,"icon":52},"Documentation","\u002Fcontribute\u002Fdocumentation","5.contribute\u002F6.documentation",{"title":557,"icon":49,"path":558,"stem":559,"children":560,"page":49},"Tooling","\u002Fcontribute\u002Ftooling","5.contribute\u002F7.tooling",[561,566],{"title":562,"path":563,"stem":564,"icon":565},"CLI","\u002Fcontribute\u002Ftooling\u002Fcli","5.contribute\u002F7.tooling\u002F1.cli","i-lucide-square-terminal",{"title":567,"path":568,"stem":569,"icon":570},"ESLint config","\u002Fcontribute\u002Ftooling\u002Feslint-config","5.contribute\u002F7.tooling\u002F2.eslint-config","i-lucide-spell-check",{"title":572,"icon":49,"path":573,"stem":574,"children":575},"Decisions","\u002Fcontribute\u002Fdecisions","5.contribute\u002F8.decisions\u002Findex",[576,578,583],{"title":572,"path":573,"stem":574,"icon":577},"i-lucide-scale",{"title":579,"path":580,"stem":581,"icon":582},"Session lifetimes per OAuth client","\u002Fcontribute\u002Fdecisions\u002Foauth-token-lifetimes","5.contribute\u002F8.decisions\u002F1.oauth-token-lifetimes","i-lucide-timer",{"title":584,"path":585,"stem":586,"icon":70},"One permission model","\u002Fcontribute\u002Fdecisions\u002Fpermission-model","5.contribute\u002F8.decisions\u002F2.permission-model",{"id":588,"title":589,"body":590,"description":1339,"extension":1340,"links":1341,"meta":1342,"navigation":1343,"path":264,"seo":1344,"stem":265,"__hash__":1345},"docs\u002F3.modules\u002F2.commerce\u002F3.subscriptions\u002F2.server.md","Subscriptions server API",{"type":591,"value":592,"toc":1332},"minimark",[593,605,610,625,753,762,767,843,866,870,899,927,933,947,951,968,1136,1153,1242,1245,1249,1263,1278,1284,1310,1314,1328],[594,595,596,597,601,602,604],"p",{},"This page covers the server side: checking a user's plan, what the webhook stores, the checkout rules and how\n",[598,599,600],"a",{"href":87},"staff"," manage a membership. It is for app developers and module authors, in server mode.\nSet up the module first: ",[598,603,173],{"href":259},".",[606,607,609],"h2",{"id":608},"check-a-users-plan","Check a user's plan",[594,611,612,613,615,616,619,620,624],{},"Use these helpers to gate a route, a server middleware or another module, such as ",[598,614,279],{"href":280},".\nThey are auto-imported in ",[598,617,618],{"href":87},"Nitro",", and exported from ",[621,622,623],"code",{},"@frigear-nu\u002Fsubscriptions\u002Futils",":",[626,627,632],"pre",{"className":628,"code":629,"language":630,"meta":631,"style":631},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","getUserSubscription(userId: number, options?: { statuses?: string[] }): Promise\u003CSubscriptionRow | null>\nhasActiveSubscription(userId: number, options?: {\n  plans?: string[]      \u002F\u002F only these plan keys; omit for any plan\n  statuses?: string[]   \u002F\u002F default DEFAULT_ENTITLED_STATUSES = ['active', 'trialing']\n}): Promise\u003Cboolean>\n","ts","",[621,633,634,690,707,722,736],{"__ignoreMap":631},[635,636,639,643,647,651,654,657,660,663,665,668,671,674,678,681,684,687],"span",{"class":637,"line":638},"line",1,[635,640,642],{"class":641},"s2Zo4","getUserSubscription",[635,644,646],{"class":645},"sTEyZ","(userId: number",[635,648,650],{"class":649},"sMK4o",",",[635,652,653],{"class":645}," options",[635,655,656],{"class":649},"?:",[635,658,659],{"class":649}," {",[635,661,662],{"class":645}," statuses?",[635,664,624],{"class":649},[635,666,667],{"class":645}," string[] ",[635,669,670],{"class":649},"}",[635,672,673],{"class":645},"): ",[635,675,677],{"class":676},"sBMFI","Promise",[635,679,680],{"class":649},"\u003C",[635,682,683],{"class":645},"SubscriptionRow ",[635,685,686],{"class":649},"|",[635,688,689],{"class":649}," null>\n",[635,691,693,696,698,700,702,704],{"class":637,"line":692},2,[635,694,695],{"class":641},"hasActiveSubscription",[635,697,646],{"class":645},[635,699,650],{"class":649},[635,701,653],{"class":645},[635,703,656],{"class":649},[635,705,706],{"class":649}," {\n",[635,708,710,713,715,718],{"class":637,"line":709},3,[635,711,712],{"class":645},"  plans?",[635,714,624],{"class":649},[635,716,717],{"class":645}," string[]      ",[635,719,721],{"class":720},"sHwdD","\u002F\u002F only these plan keys; omit for any plan\n",[635,723,725,728,730,733],{"class":637,"line":724},4,[635,726,727],{"class":645},"  statuses",[635,729,656],{"class":649},[635,731,732],{"class":645}," string[]   ",[635,734,735],{"class":720},"\u002F\u002F default DEFAULT_ENTITLED_STATUSES = ['active', 'trialing']\n",[635,737,739,741,743,745,747,750],{"class":637,"line":738},5,[635,740,670],{"class":649},[635,742,673],{"class":645},[635,744,677],{"class":676},[635,746,680],{"class":649},[635,748,749],{"class":645},"boolean",[635,751,752],{"class":649},">\n",[594,754,755,757,758,761],{},[621,756,642],{}," returns the counting subscription with the latest ",[621,759,760],{},"currentPeriodEnd",". An ended row never counts,\nand neither does a free membership past its end date.",[594,763,764,766],{},[621,765,623],{}," also exports:",[768,769,770,783],"table",{},[771,772,773],"thead",{},[774,775,776,780],"tr",{},[777,778,779],"th",{},"Export",[777,781,782],{},"What it does",[784,785,786,804,817,831],"tbody",{},[774,787,788,794],{},[789,790,791],"td",{},[621,792,793],{},"decideChangeKind(currentRank, targetRank)",[789,795,796,799,800,803],{},[621,797,798],{},"'upgrade'"," or ",[621,801,802],{},"'downgrade'"," from plan ranks. An unconfigured current plan counts as lowest.",[774,805,806,811],{},[789,807,808],{},[621,809,810],{},"resolvePlanKey(plans, { id, lookupKey? })",[789,812,813,814,604],{},"The configured plan key of a Stripe price, or ",[621,815,816],{},"null",[774,818,819,824],{},[789,820,821],{},[621,822,823],{},"isWithinDisabledRanges(ranges, now?)",[789,825,826,827,830],{},"Whether a date falls in any ",[621,828,829],{},"disabledRanges"," window.",[774,832,833,838],{},[789,834,835],{},[621,836,837],{},"DEFAULT_ENTITLED_STATUSES",[789,839,840,604],{},[621,841,842],{},"['active', 'trialing']",[594,844,845,846,849,850,853,854,857,858,861,862,865],{},"Nitro also auto-imports ",[621,847,848],{},"listUserSubscriptions(userId)"," (the ",[621,851,852],{},"MeResponse","), ",[621,855,856],{},"getResolvedPlans()"," (every plan, cached)\nand ",[621,859,860],{},"getAvailablePlans(event?)"," (after availability windows and the ",[621,863,864],{},"subscriptions:plans:filter"," hook).",[606,867,869],{"id":868},"webhook-handling","Webhook handling",[594,871,872,873,879,880,883,884,887,888,883,891,894,895,898],{},"The module keeps each user's subscriptions in step with Stripe. It listens through\n",[598,874,876],{"href":875},"\u002Fmodules\u002Fcommerce\u002Fstripe#in-a-module",[621,877,878],{},"registerStripeEventHandler"," to ",[621,881,882],{},"customer.subscription.created",", ",[621,885,886],{},"updated",",\n",[621,889,890],{},"deleted",[621,892,893],{},"paused"," and ",[621,896,897],{},"resumed",". Each event updates or inserts one row, by the Stripe subscription id, so a repeat\ndoes no harm.",[900,901,902,906,914],"ul",{},[903,904,905],"li",{},"The user comes from the Stripe customer id. An event for an unknown customer is logged and ignored, and the webhook\nstill succeeds. Webhooks never create users.",[903,907,908,911,912,604],{},[621,909,910],{},"planKey"," comes from the price of the first subscription item, by price id or lookup key, else ",[621,913,816],{},[903,915,916,917,919,920,923,924,604],{},"The period start and end come from the items. ",[621,918,890],{}," stores the status ",[621,921,922],{},"canceled"," and sets ",[621,925,926],{},"endedAt",[594,928,929,930,604],{},"Retries follow ",[598,931,250],{"href":932},"\u002Fmodules\u002Fcommerce\u002Fstripe#delivery-and-retries",[594,934,935,936,938,939,942,943,604],{},"With ",[598,937,254],{"href":255}," installed, invoice events are announced in the ",[621,940,941],{},"subscriptions:invoice"," hook\nand stored as ",[598,944,946],{"href":945},"\u002Fmodules\u002Fcommerce\u002Fpayments#subscription-invoices","subscription invoices",[606,948,950],{"id":949},"checkout","Checkout",[594,952,953,956,957,960,961,964,965,624],{},[621,954,955],{},"POST \u002Fapi\u002Fsubscriptions\u002Fme\u002Fcheckout"," starts a subscription or changes the plan of an existing one. It needs a session,\nbecause it is billing: an ",[598,958,959],{"href":87},"API token"," or access token gets ",[621,962,963],{},"403 session_required",". It takes a\n",[621,966,967],{},"CheckoutBody",[626,969,971],{"className":628,"code":970,"language":630,"meta":631,"style":631},"type CheckoutBody = {\n  planKey?: string      \u002F\u002F planKey or priceId is required (400 otherwise)\n  priceId?: string      \u002F\u002F required when the plan has several prices, and when no plans are configured\n  successUrl?: string   \u002F\u002F relative path or same-origin URL, else 400; defaults to the success page, membership page or '\u002F'\n  cancelUrl?: string\n}\n\ntype CheckoutResponse =\n  | { url: string }                                           \u002F\u002F new Stripe Checkout Session: redirect to it\n  | { updated: true, kind: 'upgrade' | 'downgrade' | 'resume' } \u002F\u002F an existing subscription was changed in place\n",[621,972,973,987,1001,1013,1025,1035,1041,1048,1059,1080],{"__ignoreMap":631},[635,974,975,979,982,985],{"class":637,"line":638},[635,976,978],{"class":977},"spNyl","type",[635,980,981],{"class":676}," CheckoutBody",[635,983,984],{"class":649}," =",[635,986,706],{"class":649},[635,988,989,993,995,998],{"class":637,"line":692},[635,990,992],{"class":991},"swJcz","  planKey",[635,994,656],{"class":649},[635,996,997],{"class":676}," string",[635,999,1000],{"class":720},"      \u002F\u002F planKey or priceId is required (400 otherwise)\n",[635,1002,1003,1006,1008,1010],{"class":637,"line":709},[635,1004,1005],{"class":991},"  priceId",[635,1007,656],{"class":649},[635,1009,997],{"class":676},[635,1011,1012],{"class":720},"      \u002F\u002F required when the plan has several prices, and when no plans are configured\n",[635,1014,1015,1018,1020,1022],{"class":637,"line":724},[635,1016,1017],{"class":991},"  successUrl",[635,1019,656],{"class":649},[635,1021,997],{"class":676},[635,1023,1024],{"class":720},"   \u002F\u002F relative path or same-origin URL, else 400; defaults to the success page, membership page or '\u002F'\n",[635,1026,1027,1030,1032],{"class":637,"line":738},[635,1028,1029],{"class":991},"  cancelUrl",[635,1031,656],{"class":649},[635,1033,1034],{"class":676}," string\n",[635,1036,1038],{"class":637,"line":1037},6,[635,1039,1040],{"class":649},"}\n",[635,1042,1044],{"class":637,"line":1043},7,[635,1045,1047],{"emptyLinePlaceholder":1046},true,"\n",[635,1049,1051,1053,1056],{"class":637,"line":1050},8,[635,1052,978],{"class":977},[635,1054,1055],{"class":676}," CheckoutResponse",[635,1057,1058],{"class":649}," =\n",[635,1060,1062,1065,1067,1070,1072,1074,1077],{"class":637,"line":1061},9,[635,1063,1064],{"class":649},"  |",[635,1066,659],{"class":649},[635,1068,1069],{"class":991}," url",[635,1071,624],{"class":649},[635,1073,997],{"class":676},[635,1075,1076],{"class":649}," }",[635,1078,1079],{"class":720},"                                           \u002F\u002F new Stripe Checkout Session: redirect to it\n",[635,1081,1083,1085,1087,1090,1092,1095,1097,1100,1102,1105,1109,1112,1115,1117,1120,1122,1124,1126,1129,1131,1133],{"class":637,"line":1082},10,[635,1084,1064],{"class":649},[635,1086,659],{"class":649},[635,1088,1089],{"class":991}," updated",[635,1091,624],{"class":649},[635,1093,1094],{"class":676}," true",[635,1096,650],{"class":649},[635,1098,1099],{"class":991}," kind",[635,1101,624],{"class":649},[635,1103,1104],{"class":649}," '",[635,1106,1108],{"class":1107},"sfazB","upgrade",[635,1110,1111],{"class":649},"'",[635,1113,1114],{"class":649}," |",[635,1116,1104],{"class":649},[635,1118,1119],{"class":1107},"downgrade",[635,1121,1111],{"class":649},[635,1123,1114],{"class":649},[635,1125,1104],{"class":649},[635,1127,1128],{"class":1107},"resume",[635,1130,1111],{"class":649},[635,1132,1076],{"class":649},[635,1134,1135],{"class":720}," \u002F\u002F an existing subscription was changed in place\n",[594,1137,1138,1139,1142,1143,883,1146,799,1149,1152],{},"The plan must be in the filtered plan list, so a hidden plan answers ",[621,1140,1141],{},"400",". For checkout, a user has a subscription when\na Stripe row is ",[621,1144,1145],{},"active",[621,1147,1148],{},"trialing",[621,1150,1151],{},"past_due"," and not ended. Free grants are ignored here.",[768,1154,1155,1165],{},[771,1156,1157],{},[774,1158,1159,1162],{},[777,1160,1161],{},"Situation",[777,1163,1164],{},"Result",[784,1166,1167,1180,1190,1201,1215,1225,1233],{},[774,1168,1169,1172],{},[789,1170,1171],{},"No existing subscription",[789,1173,1174,1176,1177,604],{},[621,1175,949],{},": returns ",[621,1178,1179],{},"{ url }",[774,1181,1182,1185],{},[789,1183,1184],{},"Same price, set to cancel at period end",[789,1186,1187,1189],{},[621,1188,1128],{},": clears the cancellation and releases a pending schedule. Skips the hook.",[774,1191,1192,1195],{},[789,1193,1194],{},"Same price, not cancelling",[789,1196,1197,1200],{},[621,1198,1199],{},"409",", \"already subscribed to this price\".",[774,1202,1203,1206],{},[789,1204,1205],{},"Higher plan rank",[789,1207,1208,1210,1211,1214],{},[621,1209,1108],{},": immediate, with ",[621,1212,1213],{},"always_invoice"," proration. A pending schedule is released.",[774,1216,1217,1220],{},[789,1218,1219],{},"Lower or equal rank, including monthly to yearly",[789,1221,1222,1224],{},[621,1223,1119],{},": at the period end, through a subscription schedule.",[774,1226,1227,1230],{},[789,1228,1229],{},"Set to cancel at period end, any other change",[789,1231,1232],{},"Switched immediately, which also keeps it from ending.",[774,1234,1235,1238],{},[789,1236,1237],{},"No items, or a billing phase that cannot be read",[789,1239,1240,604],{},[621,1241,1199],{},[594,1243,1244],{},"A price outside the configured plans counts as an upgrade. That is possible only with no plans configured. The webhook\nupdates the local row afterwards. Users cancel in the billing portal.",[606,1246,1248],{"id":1247},"staff-membership","Staff membership",[594,1250,1251,1252,1255,1256,1258,1259,1262],{},"Staff manage a user's membership through the routes below. Reads need ",[621,1253,1254],{},"users:read"," from\n",[598,1257,191],{"href":192},". Changes need ",[621,1260,1261],{},"subscriptions:manage",", which is session only and held by nobody until\nyou grant it to a role. The caller must also hold every permission the target user holds, so a coordinator cannot grant\nan admin a membership.",[594,1264,1265,1266,1269,1270,1273,1274,1277],{},"A free membership is a manual row: ",[621,1267,1268],{},"source: 'manual'",", id ",[621,1271,1272],{},"manual_\u003Cuuid>"," and no Stripe subscription. It counts as\nactive until it is revoked or its optional ",[621,1275,1276],{},"endsAt"," passes.",[594,1279,1280,1281,604],{},"The routes, their bodies and answers are in ",[598,1282,179],{"href":1283},"\u002Fmodules\u002Fcommerce\u002Fsubscriptions\u002Freference#routes",[900,1285,1286,1289,1292,1307],{},[903,1287,1288],{},"Granting replaces an existing free membership.",[903,1290,1291],{},"A payment link is a Stripe Checkout session, valid for 24 hours.",[903,1293,935,1294,883,1297,1299,1300,1303,1304,1306],{},[621,1295,1296],{},"email: true",[598,1298,403],{"href":404}," also mails it. It uses the ",[621,1301,1302],{},"subscriptions-payment-link","\ntemplate when ",[598,1305,407],{"href":408}," is installed.",[903,1308,1309],{},"The plan filter hook does not apply to staff.",[606,1311,1313],{"id":1312},"next-steps","Next steps",[900,1315,1316,1322],{},[903,1317,1318,1321],{},[598,1319,1320],{"href":271},"Subscriptions reference"," – the hooks, routes and table behind these\nhelpers.",[903,1323,1324,1327],{},[598,1325,1326],{"href":268},"Subscriptions app"," – call checkout and the portal from the app.",[1329,1330,1331],"style",{},"html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}",{"title":631,"searchDepth":692,"depth":692,"links":1333},[1334,1335,1336,1337,1338],{"id":608,"depth":692,"text":609},{"id":868,"depth":692,"text":869},{"id":949,"depth":692,"text":950},{"id":1247,"depth":692,"text":1248},{"id":1312,"depth":692,"text":1313},"Check which plan a user holds, and how webhooks, checkout and staff grants change subscriptions.","md",null,{},{"title":175},{"title":589,"description":1339},"ZpqOO4Gejn-6cV2LImEtM2U7JJw1grswwQjDgcxR3Q8",[1347,1349],{"title":173,"path":259,"stem":260,"description":1348,"children":-1},"Sell recurring plans, such as a yearly membership, through Stripe, and check which plan a user holds.",{"title":267,"path":268,"stem":269,"description":1350,"children":-1},"Show plans, start a checkout, guard pages by plan and turn on the ready-made membership pages.",1794503157812]