[{"data":1,"prerenderedAt":577,"buildId":578},["ShallowReactive",2],{"\u002Fdocs\u002Fgetting-started\u002Fsetup":3,"\u002Fdocs\u002Fgetting-started\u002Fsetup-docs-surround":352,"contentNavigation":363,"docsNavigation":523},{"id":4,"title":5,"body":6,"description":340,"extension":341,"links":342,"meta":343,"navigation":344,"path":346,"seo":347,"sitemap":348,"stem":350,"__hash__":351},"docs\u002Fdocs\u002F01.getting-started\u002F3.setup.md","Set Up Environment Variables and the Database",{"type":7,"value":8,"toc":331},"minimark",[9,327],[10,11,13,18,22,45,56,60,71,87,118,121,169,172,214,233,237,240,252,263,267,270,282,287,291,304,307,318],"steps",{"level":12},"3",[14,15,17],"h3",{"id":16},"install-dependencies","Install dependencies",[19,20,21],"p",{},"Run all commands from the repository root:",[23,24,29],"pre",{"className":25,"code":26,"language":27,"meta":28,"style":28},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm install\n","bash","",[30,31,32],"code",{"__ignoreMap":28},[33,34,37,41],"span",{"class":35,"line":36},"line",1,[33,38,40],{"class":39},"sBMFI","pnpm",[33,42,44],{"class":43},"sfazB"," install\n",[19,46,47,48,51,52,55],{},"This also runs ",[30,49,50],{},"nuxt prepare"," in ",[30,53,54],{},"apps\u002Fweb",", which generates the types.",[14,57,59],{"id":58},"setup-environment-variables","Setup environment variables",[19,61,62,63,66,67,70],{},"Copy ",[30,64,65],{},"apps\u002Fweb\u002F.env.example"," to ",[30,68,69],{},"apps\u002Fweb\u002F.env"," and fill in the values. The Nuxt CLI reads this file in development and during the build.",[23,72,74],{"className":25,"code":73,"language":27,"meta":28,"style":28},"cp apps\u002Fweb\u002F.env.example apps\u002Fweb\u002F.env\n",[30,75,76],{"__ignoreMap":28},[33,77,78,81,84],{"class":35,"line":36},[33,79,80],{"class":39},"cp",[33,82,83],{"class":43}," apps\u002Fweb\u002F.env.example",[33,85,86],{"class":43}," apps\u002Fweb\u002F.env\n",[19,88,89,90,97,98,101,102,105,106,109,110,113,114,117],{},"Every layer declares its environment variables as ",[91,92,96],"a",{"href":93,"rel":94},"https:\u002F\u002Fzod.dev\u002F",[95],"nofollow","Zod"," schemas in the ",[30,99,100],{},"runtimeConfig"," of its ",[30,103,104],{},"nuxt.config.ts",". When a required value is missing, the server refuses to start and lists the missing values (error ",[30,107,108],{},"NUXT_E8014","). At runtime only the type, whether a value is required and enum values are checked, not refinements like ",[30,111,112],{},".min()"," or ",[30,115,116],{},".url()",".",[19,119,120],{},"Required environment variables:",[122,123,124,135,141,151,157,163],"ul",{},[125,126,127,130,131,134],"li",{},[30,128,129],{},"NUXT_BETTER_AUTH_SECRET"," - Secret for better-auth, at least 32 random characters (e.g. ",[30,132,133],{},"openssl rand -base64 32",")",[125,136,137,140],{},[30,138,139],{},"NUXT_PRIVATE_DATABASE_URL"," - PostgreSQL connection string",[125,142,143,146,147,150],{},[30,144,145],{},"NUXT_PUBLIC_BASE_URL"," - Your app URL (e.g., ",[30,148,149],{},"http:\u002F\u002Flocalhost:9009"," for local dev). better-auth uses it as its base URL.",[125,152,153,156],{},[30,154,155],{},"NUXT_PRIVATE_POLAR_ACCESS_TOKEN"," - Polar access token",[125,158,159,162],{},[30,160,161],{},"NUXT_PRIVATE_EMAIL_CONTACT"," - Address that receives contact form submissions",[125,164,165,168],{},[30,166,167],{},"NUXT_PRIVATE_FROM_EMAIL"," - Sender address of all emails",[19,170,171],{},"Optional:",[122,173,174,180,193,200,207],{},[125,175,176,179],{},[30,177,178],{},"NUXT_PRIVATE_POLAR_ORGANIZATION_ID"," - Your Polar organization ID",[125,181,182,185,186,189,190],{},[30,183,184],{},"NUXT_PRIVATE_POLAR_SERVER"," - ",[30,187,188],{},"sandbox"," (default) or ",[30,191,192],{},"production",[125,194,195,196],{},"OAuth credentials for social login (Google, GitHub), see ",[91,197,199],{"href":198},"\u002Fdocs\u002Fauthentication","Authentication",[125,201,202,203],{},"Email provider settings, see ",[91,204,206],{"href":205},"\u002Fdocs\u002Femails","Emails",[125,208,209,210],{},"Storage settings, see ",[91,211,213],{"href":212},"\u002Fdocs\u002Fimages","Images",[215,216,217],"note",{},[19,218,219,220,223,224,226,227,229,230,117],{},"Never read ",[30,221,222],{},"process.env"," in app code. Add new values as Zod schemas to the ",[30,225,104],{}," of the layer that owns them and to ",[30,228,65],{},", then read them with ",[30,231,232],{},"useRuntimeConfig()",[14,234,236],{"id":235},"create-database-schema","Create database schema",[19,238,239],{},"Apply the database migrations:",[23,241,243],{"className":25,"code":242,"language":27,"meta":28,"style":28},"pnpm db:migrate\n",[30,244,245],{"__ignoreMap":28},[33,246,247,249],{"class":35,"line":36},[33,248,40],{"class":39},[33,250,251],{"class":43}," db:migrate\n",[19,253,254,255,258,259,117],{},"The migrations are part of the repository. Run ",[30,256,257],{},"pnpm db:generate"," only after you change a schema file, see ",[91,260,262],{"href":261},"\u002Fdocs\u002Fdatabase","Database",[14,264,266],{"id":265},"start-the-development-server","Start the development server",[19,268,269],{},"Start the development server for the web app:",[23,271,273],{"className":25,"code":272,"language":27,"meta":28,"style":28},"pnpm dev\n",[30,274,275],{"__ignoreMap":28},[33,276,277,279],{"class":35,"line":36},[33,278,40],{"class":39},[33,280,281],{"class":43}," dev\n",[19,283,284,285,117],{},"You can now access your app at ",[30,286,149],{},[14,288,290],{"id":289},"polar","Polar",[19,292,293,294,298,299,303],{},"Nuxt Starter Kit uses ",[91,295,290],{"href":296,"rel":297},"https:\u002F\u002Fpolar.sh\u002F",[95]," to accept payments, see ",[91,300,302],{"href":301},"\u002Fdocs\u002Fpayments","Payments"," for more information.",[19,305,306],{},"This starter kit is designed to support subscriptions (free & Pro) and lifetime deals. You should configure three products in Polar:",[122,308,309,312,315],{},[125,310,311],{},"Pro Plan (yearly subscription)",[125,313,314],{},"Pro Plan (monthly subscription)",[125,316,317],{},"Lifetime Deal (one-time payment)",[215,319,320],{},[19,321,322,323,326],{},"Any other product constellation needs adjustments in the ",[30,324,325],{},"apps\u002Fweb\u002Flayers\u002Fpayment"," layer and other parts of the codebase.",[328,329,330],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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);}",{"title":28,"searchDepth":332,"depth":332,"links":333},2,[334,336,337,338,339],{"id":16,"depth":335,"text":17},3,{"id":58,"depth":335,"text":59},{"id":235,"depth":335,"text":236},{"id":265,"depth":335,"text":266},{"id":289,"depth":335,"text":290},"Install dependencies with pnpm, fill in the Zod-validated environment variables in apps\u002Fweb\u002F.env and create the PostgreSQL schema for your Nuxt app.","md",null,{},{"title":345},"Setup","\u002Fdocs\u002Fgetting-started\u002Fsetup",{"title":5,"description":340},{"loc":346,"lastmod":349},"2026-12-02","docs\u002F01.getting-started\u002F3.setup","1LYOfAS6YA3-QitokIi2ILRBXQTR9PFXO96Zwz9zcLA",[353,358],{"title":354,"path":355,"stem":356,"description":357,"children":-1},"Installation","\u002Fdocs\u002Fgetting-started\u002Finstallation","docs\u002F01.getting-started\u002F2.installation","Clone the Nuxt Starter Kit repository after your purchase, or create your own repository from the GitHub template, and check the prerequisites first.",{"title":359,"path":360,"stem":361,"description":362,"children":-1},"Pull Updates","\u002Fdocs\u002Fgetting-started\u002Fpull-updates","docs\u002F01.getting-started\u002F4.pull-updates","Add the kit repository as a Git remote, fetch the latest changes and merge them into your project on a separate branch, so you can test them first.",[364,394],{"title":365,"path":366,"stem":367,"children":368,"page":393},"Blog","\u002Fblog","blog",[369,373,377,381,385,389],{"title":370,"path":371,"stem":372},"How to Build a SaaS with Nuxt 4, better-auth, and Polar","\u002Fblog\u002Fbuild-saas-with-nuxt-4-better-auth-polar","blog\u002Fbuild-saas-with-nuxt-4-better-auth-polar",{"title":374,"path":375,"stem":376},"DIY vs Nuxt Starter Kit - The Real Cost of Auth and Payments","\u002Fblog\u002Fdiy-vs-nuxt-starter-kit-cost","blog\u002Fdiy-vs-nuxt-starter-kit-cost",{"title":378,"path":379,"stem":380},"Nuxt Boilerplate for Solo Founders - Ship Without Rebuilding Foundations","\u002Fblog\u002Fnuxt-boilerplate-for-solo-founders","blog\u002Fnuxt-boilerplate-for-solo-founders",{"title":382,"path":383,"stem":384},"Best Nuxt SaaS Boilerplate in 2026 - What Actually Matters","\u002Fblog\u002Fnuxt-saas-boilerplate-comparison","blog\u002Fnuxt-saas-boilerplate-comparison",{"title":386,"path":387,"stem":388},"Nuxt Starter Kit v3: Delete the Features You Don't Need","\u002Fblog\u002Fnuxt-starter-kit-v3-layer-architecture","blog\u002Fnuxt-starter-kit-v3-layer-architecture",{"title":390,"path":391,"stem":392},"Polar Checkout and Customer Portal in Nuxt with the better-auth Plugin","\u002Fblog\u002Fpolar-checkout-customer-portal-better-auth-nuxt","blog\u002Fpolar-checkout-customer-portal-better-auth-nuxt",false,{"title":395,"path":396,"stem":397,"children":398,"page":393},"Documentation","\u002Fdocs","docs",[399,422,434,440,446,451,456,464,469,476,483,491,498,505,517],{"title":400,"path":401,"stem":402,"children":403,"icon":421},"Getting Started","\u002Fdocs\u002Fgetting-started","docs\u002F01.getting-started\u002F1.index",[404,406,407,408,409,413,417],{"title":405,"path":401,"stem":402},"Introduction",{"title":354,"path":355,"stem":356},{"title":345,"path":346,"stem":350},{"title":359,"path":360,"stem":361},{"title":410,"path":411,"stem":412},"Upgrade to the Layer Architecture","\u002Fdocs\u002Fgetting-started\u002Fupgrade-to-layer-architecture","docs\u002F01.getting-started\u002F5.upgrade-to-layer-architecture",{"title":414,"path":415,"stem":416},"Deployment","\u002Fdocs\u002Fgetting-started\u002Fdeployment","docs\u002F01.getting-started\u002F6.deployment",{"title":418,"path":419,"stem":420},"Going to production","\u002Fdocs\u002Fgetting-started\u002Fgoing-to-production","docs\u002F01.getting-started\u002F7.going-to-production","i-lucide-square-play",{"title":423,"path":424,"stem":425,"children":426,"icon":433},"Architecture","\u002Fdocs\u002Farchitecture","docs\u002F02.architecture\u002F1.index",[427,429],{"title":428,"path":424,"stem":425},"Tech Stack",{"title":430,"path":431,"stem":432},"Layers","\u002Fdocs\u002Farchitecture\u002Flayers","docs\u002F02.architecture\u002F2.layers","i-lucide-layers",{"title":262,"path":261,"stem":435,"children":436,"icon":439},"docs\u002F03.database\u002F1.index",[437],{"title":438,"path":261,"stem":435},"PostgreSQL","i-lucide-database",{"title":206,"path":205,"stem":441,"children":442,"icon":445},"docs\u002F04.emails\u002F1.index",[443],{"title":444,"path":205,"stem":441},"Overview","i-lucide-mail",{"title":199,"path":198,"stem":447,"children":448,"icon":450},"docs\u002F05.authentication\u002F1.index",[449],{"title":444,"path":198,"stem":447},"i-lucide-lock-keyhole",{"title":302,"path":301,"stem":452,"children":453,"icon":455},"docs\u002F06.payments\u002F1.index",[454],{"title":290,"path":301,"stem":452},"i-lucide-circle-dollar-sign",{"title":457,"path":458,"stem":459,"children":460,"icon":463},"Admin","\u002Fdocs\u002Fadmin","docs\u002F07.admin\u002F1.index",[461],{"title":462,"path":458,"stem":459},"Features","i-lucide-user-cog",{"title":213,"path":212,"stem":465,"children":466,"icon":468},"docs\u002F08.images\u002F1.index",[467],{"title":444,"path":212,"stem":465},"i-lucide-image",{"title":470,"path":471,"stem":472,"children":473,"icon":475},"i18n","\u002Fdocs\u002Fi18n","docs\u002F09.i18n\u002F1.index",[474],{"title":444,"path":471,"stem":472},"i-lucide-languages",{"title":477,"path":478,"stem":479,"children":480,"icon":482},"SEO","\u002Fdocs\u002Fseo","docs\u002F10.seo\u002F1.index",[481],{"title":444,"path":478,"stem":479},"i-lucide-globe",{"title":484,"path":485,"stem":486,"children":487,"icon":490},"Analytics","\u002Fdocs\u002Fanalytics","docs\u002F11.analytics\u002F1.index",[488],{"title":489,"path":485,"stem":486},"Umami","i-lucide-chart-line",{"title":492,"path":493,"stem":494,"children":495,"icon":497},"Security","\u002Fdocs\u002Fsecurity","docs\u002F12.security\u002F1.index",[496],{"title":444,"path":493,"stem":494},"i-lucide-file-lock",{"title":499,"path":500,"stem":501,"children":502,"icon":504},"Testing","\u002Fdocs\u002Ftesting","docs\u002F13.testing\u002F1.index",[503],{"title":499,"path":500,"stem":501},"i-lucide-test-tube",{"title":506,"path":507,"stem":508,"children":509,"icon":516},"Support","\u002Fdocs\u002Fsupport","docs\u002F14.support\u002F1.index",[510,512],{"title":511,"path":507,"stem":508},"Help",{"title":513,"path":514,"stem":515},"Troubleshooting","\u002Fdocs\u002Fsupport\u002Ftroubleshooting","docs\u002F14.support\u002F2.troubleshooting","i-lucide-message-circle-question",{"title":518,"path":519,"stem":520,"children":521},"LLMs","\u002Fdocs\u002Fllms","docs\u002F15.llms\u002F1.index",[522],{"title":518,"path":519,"stem":520},[524,533,537,540,543,546,549,552,555,558,561,564,567,570,574],{"title":400,"path":401,"stem":402,"children":525,"icon":421},[526,527,528,529,530,531,532],{"title":405,"path":401,"stem":402},{"title":354,"path":355,"stem":356},{"title":345,"path":346,"stem":350},{"title":359,"path":360,"stem":361},{"title":410,"path":411,"stem":412},{"title":414,"path":415,"stem":416},{"title":418,"path":419,"stem":420},{"title":423,"path":424,"stem":425,"children":534,"icon":433},[535,536],{"title":428,"path":424,"stem":425},{"title":430,"path":431,"stem":432},{"title":262,"path":261,"stem":435,"children":538,"icon":439},[539],{"title":438,"path":261,"stem":435},{"title":206,"path":205,"stem":441,"children":541,"icon":445},[542],{"title":444,"path":205,"stem":441},{"title":199,"path":198,"stem":447,"children":544,"icon":450},[545],{"title":444,"path":198,"stem":447},{"title":302,"path":301,"stem":452,"children":547,"icon":455},[548],{"title":290,"path":301,"stem":452},{"title":457,"path":458,"stem":459,"children":550,"icon":463},[551],{"title":462,"path":458,"stem":459},{"title":213,"path":212,"stem":465,"children":553,"icon":468},[554],{"title":444,"path":212,"stem":465},{"title":470,"path":471,"stem":472,"children":556,"icon":475},[557],{"title":444,"path":471,"stem":472},{"title":477,"path":478,"stem":479,"children":559,"icon":482},[560],{"title":444,"path":478,"stem":479},{"title":484,"path":485,"stem":486,"children":562,"icon":490},[563],{"title":489,"path":485,"stem":486},{"title":492,"path":493,"stem":494,"children":565,"icon":497},[566],{"title":444,"path":493,"stem":494},{"title":499,"path":500,"stem":501,"children":568,"icon":504},[569],{"title":499,"path":500,"stem":501},{"title":506,"path":507,"stem":508,"children":571,"icon":516},[572,573],{"title":511,"path":507,"stem":508},{"title":513,"path":514,"stem":515},{"title":518,"path":519,"stem":520,"children":575},[576],{"title":518,"path":519,"stem":520},1796282654038,"e90768e1-1006-4f68-a0b7-e7c6553b660f"]