create-lx2-app 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +151 -0
  2. package/dist/index.js +68 -0
  3. package/package.json +92 -0
  4. package/template/base/README.md +57 -0
  5. package/template/base/_gitignore +41 -0
  6. package/template/base/next-env.d.ts +5 -0
  7. package/template/base/next.config.mjs +12 -0
  8. package/template/base/package.json +20 -0
  9. package/template/base/postcss.config.mjs +5 -0
  10. package/template/base/public/favicon.ico +0 -0
  11. package/template/base/src/env.js +40 -0
  12. package/template/packages/config/eslint.config.mjs +16 -0
  13. package/template/packages/config/payload/with-postgres.ts +39 -0
  14. package/template/packages/config/payload/with-sqlite.ts +42 -0
  15. package/template/packages/config/prettier.config.mjs +23 -0
  16. package/template/packages/config/tsconfig/base.json +42 -0
  17. package/template/packages/config/tsconfig/with-payload.json +43 -0
  18. package/template/packages/prisma/schema/base.prisma +21 -0
  19. package/template/packages/prisma/schema/with-authjs.prisma +86 -0
  20. package/template/packages/prisma/schema/with-better-auth.prisma +85 -0
  21. package/template/packages/src/app/(payload)/admin/[[...segments]]/not-found.tsx +27 -0
  22. package/template/packages/src/app/(payload)/admin/[[...segments]]/page.tsx +27 -0
  23. package/template/packages/src/app/(payload)/admin/importMap.js +1 -0
  24. package/template/packages/src/app/(payload)/api/[...slug]/route.ts +20 -0
  25. package/template/packages/src/app/(payload)/api/graphql/route.ts +8 -0
  26. package/template/packages/src/app/(payload)/api/graphql-playground/route.ts +8 -0
  27. package/template/packages/src/app/(payload)/custom.scss +0 -0
  28. package/template/packages/src/app/(payload)/layout.tsx +35 -0
  29. package/template/packages/src/app/api/auth/[...betterauth]/route.ts +5 -0
  30. package/template/packages/src/app/api/auth/[...nextauth]/route.ts +3 -0
  31. package/template/packages/src/app/globals/base.css +27 -0
  32. package/template/packages/src/app/layout/base.tsx +35 -0
  33. package/template/packages/src/app/page/base.tsx +98 -0
  34. package/template/packages/src/app/page/with-authjs-prisma.tsx +221 -0
  35. package/template/packages/src/app/page/with-authjs.tsx +126 -0
  36. package/template/packages/src/app/page/with-better-auth-prisma.tsx +245 -0
  37. package/template/packages/src/app/page/with-better-auth.tsx +151 -0
  38. package/template/packages/src/app/page/with-payload.tsx +136 -0
  39. package/template/packages/src/app/page/with-prisma.tsx +177 -0
  40. package/template/packages/src/env/with-authjs-db.js +52 -0
  41. package/template/packages/src/env/with-authjs.js +51 -0
  42. package/template/packages/src/env/with-better-auth-db.js +51 -0
  43. package/template/packages/src/env/with-better-auth.js +48 -0
  44. package/template/packages/src/env/with-db.js +44 -0
  45. package/template/packages/src/env/with-payload.js +46 -0
  46. package/template/packages/src/lib/auth/better-auth-client.ts +9 -0
  47. package/template/packages/src/payload/collections/Media.ts +16 -0
  48. package/template/packages/src/payload/collections/Users.ts +13 -0
  49. package/template/packages/src/server/auth/authjs.ts +5 -0
  50. package/template/packages/src/server/auth/config/authjs-with-prisma.ts +30 -0
  51. package/template/packages/src/server/auth/config/authjs.ts +27 -0
  52. package/template/packages/src/server/auth/config/better-auth-with-prisma.ts +21 -0
  53. package/template/packages/src/server/auth/config/better-auth.ts +16 -0
  54. package/template/packages/src/server/db/db-prisma.ts +23 -0
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ <div align="center">
2
+ <picture>
3
+ <source
4
+ media="(prefers-color-scheme: dark)"
5
+ srcset="https://github.com/SlickYeet/create-lx2-app/blob/1d4a2538aeddf0dc9184c984e5384ed089392b9e/docs/v2/public/android-chrome-512x512.png"
6
+ />
7
+ <img
8
+ src="https://github.com/SlickYeet/create-lx2-app/blob/1d4a2538aeddf0dc9184c984e5384ed089392b9e/docs/v2/public/android-chrome-512x512.png"
9
+ width="130"
10
+ alt="Lx2 logo"
11
+ />
12
+ </picture>
13
+
14
+ # 🚀 Create Lx2 App
15
+
16
+ **The easiest way to scaffold a modern web app using the Lx2 stack.**
17
+
18
+ Simply run `npm create lx2-app@latest` to get started!
19
+
20
+ [![PRs-Welcome][contribute-image]][contribute-url]
21
+ [![NPM version][npm-image]][npm-url]
22
+ [![NPM beta version][npm-beta-image]][npm-beta-url]
23
+ [![Downloads][downloads-image]][npm-url]<br />
24
+ [![Release][release-image]][release-url]
25
+ [![Prepelease][prerelease-image]][prerelease-url]
26
+ [![License][license-image]][license-url]
27
+
28
+ </div>
29
+
30
+ ## 📚 Table of Contents
31
+
32
+ - <a href="#whats-included">What's Included</a>
33
+ - <a href="#getting-started">Getting Started</a>
34
+ - <a href="#features">Features</a>
35
+ - <a href="#documentation">Documentation</a>
36
+ - <a href="#credits">Credits</a>
37
+ - <a href="#contributing">Contributing</a>
38
+
39
+ <h2 id="whats-included">📦 What's Included</h2>
40
+
41
+ Create Lx2 App installs **TypeScript, Next.js, Tailwind CSS**, along with:
42
+
43
+ - ✅ **Payload CMS** - A powerful headless CMS
44
+ - ✅ **Auth.js** - Authentication made easy
45
+ - ✅ **Better Auth** - The most comprehensive authentication framework for
46
+ TypeScript.
47
+ - ✅ **Prisma ORM** - Database management with full type safety
48
+ - ✅ **And many more coming soon...**
49
+
50
+ <h2 id="getting-started">🚀 Getting Started</h2>
51
+
52
+ To create a new project, run the following command:
53
+
54
+ ### npm
55
+
56
+ ```bash
57
+ npm create lx2-app@latest
58
+ ```
59
+
60
+ ### yarn
61
+
62
+ ```bash
63
+ yarn create lx2-app
64
+ ```
65
+
66
+ ### pnpm
67
+
68
+ ```bash
69
+ pnpm create lx2-app@latest
70
+ ```
71
+
72
+ ### bun
73
+
74
+ ```bash
75
+ bun create lx2-app@latest
76
+ ```
77
+
78
+ For more information, visit the
79
+ [docs](https://create.lx2.dev/docs/getting-started).
80
+
81
+ <h2 id="features">🛠 Features</h2>
82
+
83
+ - 🎯 **Easy to Use** - Interactive CLI for selecting tools
84
+ - 📦 **Preconfigured Setup** - Comes ready with modern web dev tools
85
+ - 🚀 **Extendable** - More packages coming soon!
86
+
87
+ <h2 id="documentation">📖 Documentation</h2>
88
+
89
+ Full documentation is available at
90
+ [create.lx2.dev](https://create.lx2.dev/docs).
91
+
92
+ <h2 id="credits">❤️ Credits</h2>
93
+
94
+ Huge thanks to [Theo](https://t3.gg) and the [T3 Stack](https://create.t3.gg)
95
+ for their amazing work. The Lx2 stack builds on the principles of create-t3-app,
96
+ bringing even more flexibility.
97
+
98
+ If you like this project, giving it a ⭐ on GitHub!
99
+
100
+ <h2 id="contributing">Contributing</h2>
101
+
102
+ We 💖 contributors! Feel free to contribute to this project but **please read
103
+ the [Contributing Guidelines](CONTRIBUTING.md) before opening an issue or PR**
104
+ so you understand the branching strategy and local development environment.
105
+
106
+ <a href="https://github.com/slickyeet/create-lx2-app/graphs/contributors">
107
+ <p align="center">
108
+ <img src="https://contrib.rocks/image?repo=slickyeet/create-lx2-app" />
109
+ </p>
110
+ </a>
111
+
112
+ <p align="center">
113
+ Made with <a href="https://contrib.rocks" target="_blank" rel="noopener noreferrer">contrib.rocks</a>
114
+ </p>
115
+
116
+ <div align="center">
117
+ <a
118
+ href="https://vercel.com/?utm_source=famlam&utm_campaign=oss"
119
+ target="_blank"
120
+ rel="noopener noreferrer"
121
+ >
122
+ <img
123
+ height="34px"
124
+ src="https://www.datocms-assets.com/31049/1618983297-powered-by-vercel.svg"
125
+ alt="Powered by vercel"
126
+ />
127
+ </a>
128
+ </div>
129
+
130
+ [contribute-image]: https://img.shields.io/badge/PRs-welcome-blue.svg
131
+ [contribute-url]:
132
+ https://github.com/SlickYeet/create-lx2-app/blob/main/CONTRIBUTING.md
133
+ [npm-image]:
134
+ https://img.shields.io/npm/v/create-lx2-app?color=0b7285&logoColor=0b7285
135
+ [npm-url]: https://www.npmjs.com/package/create-lx2-app
136
+ [npm-beta-image]:
137
+ https://img.shields.io/npm/v/create-lx2-app/beta?color=orange&logoColor=orange
138
+ [npm-beta-url]: https://www.npmjs.com/package/create-lx2-app
139
+ [license-image]:
140
+ https://img.shields.io/github/license/SlickYeet/create-lx2-app?color=red
141
+ [license-url]: https://github.com/SlickYeet/create-lx2-app/blob/main/LICENSE
142
+ [downloads-image]:
143
+ https://img.shields.io/npm/dm/create-lx2-app?color=364fc7&logoColor=364fc7
144
+ [release-image]:
145
+ https://github.com/SlickYeet/create-lx2-app/actions/workflows/release.yml/badge.svg
146
+ [release-url]:
147
+ https://github.com/SlickYeet/create-lx2-app/actions/workflows/release.yml
148
+ [prerelease-image]:
149
+ https://github.com/SlickYeet/create-lx2-app/actions/workflows/prerelease.yml/badge.svg
150
+ [prerelease-url]:
151
+ https://github.com/SlickYeet/create-lx2-app/actions/workflows/prerelease.yml
package/dist/index.js ADDED
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ import Be from"path";import{execa as _t}from"execa";import Je from"fs-extra";import{confirm as V,input as ke,select as A}from"@inquirer/prompts";import{Command as rt}from"commander";import ee from"path";import{fileURLToPath as Ye}from"url";var Qe=Ye(import.meta.url),Xe=ee.dirname(Qe),p=ee.join(Xe,"../"),te=` ___ ___ ___ _ _____ ___ _ ___ _ ___ ___
3
+ / __| _ \\ __| /_\\_ _| __| | | __ __|_ ) /_\\ | _ \\ _ \\
4
+ | (__| / _| / _ \\| | | _| | |__\\ \\ / / / / _ \\| _/ _/
5
+ \\___|_|_\\___/_/ \\_\\_| |___| |____/_\\_\\/___| /_/ \\_\\_| |_|
6
+ `,C="my-lx2-app",F="create-lx2-app";import w from"path";import T from"fs-extra";import se from"path";import ne from"fs-extra";import Ze from"sort-package-json";var ae={"next-auth":"^5.0.0-beta.25","@auth/prisma-adapter":"^2.8.0","better-auth":"^1.2.7","better-sqlite3":"^11.9.1","@types/better-sqlite3":"^7.6.13",prisma:"^6.5.0","@prisma/client":"^6.5.0","@t3-oss/env-nextjs":"^0.12.0",zod:"^3.24.2",prettier:"^3.5.3","prettier-plugin-tailwindcss":"^0.6.11","@ianvs/prettier-plugin-sort-imports":"^4.4.1",eslint:"^9","eslint-config-next":"^15.2.4","@eslint/eslintrc":"^3.3.1",typescript:"^5.8.2","@types/node":"^22","@types/react":"^19","@types/react-dom":"^19",payload:"^3.33.0","@payloadcms/next":"^3.33.0","@payloadcms/payload-cloud":"^3.33.0","@payloadcms/richtext-lexical":"^3.33.0","@payloadcms/db-vercel-postgres":"^3.33.0","@payloadcms/db-sqlite":"^3.33.0",graphql:"^16.10.0",sharp:"^0.34.1"};var g=e=>{let{dependencies:a,devMode:s,projectDir:o}=e,t=ne.readJsonSync(se.join(o,"package.json"));a.forEach(i=>{let r=ae[i];s&&t.devDependencies?t.devDependencies[i]=r:t.dependencies&&(t.dependencies[i]=r)});let n=Ze(t);ne.writeJsonSync(se.join(o,"package.json"),n,{spaces:2})};var oe=({projectDir:e,packages:a,databaseProvider:s})=>{let o=a?.prisma.inUse,t=["better-auth"],n=[];o||t.push("better-sqlite3"),o||n.push("@types/better-sqlite3"),g({projectDir:e,dependencies:t,devMode:!1}),g({projectDir:e,dependencies:n,devMode:!0});let i=w.join(p,"template/packages"),r=w.join(i,"src/app/api/auth/[...betterauth]/route.ts"),m=w.join(e,"src/app/api/auth/[...all]/route.ts"),u=w.join(i,"src/server/auth/config",o?"better-auth-with-prisma.ts":"better-auth.ts"),h=T.readFileSync(u,"utf-8");o&&s!=="sqlite"&&(h=h.replace('provider: "sqlite",',`provider: "${{mysql:"mysql",postgresql:"postgresql"}[s]}",`));let d=w.join(e,"src/server/auth/index.ts");T.mkdirSync(w.dirname(d),{recursive:!0}),T.writeFileSync(d,h);let c=w.join(i,"src/lib/auth/better-auth-client.ts"),v=w.join(e,"src/lib/auth/client.ts");T.copySync(r,m),T.copySync(c,v)};import y from"path";import P from"fs-extra";var ie=({projectDir:e,packages:a,databaseProvider:s})=>{let o=[],t=[];if(a?.payload.inUse)switch(o.push("payload"),o.push("@payloadcms/next"),o.push("@payloadcms/payload-cloud"),o.push("@payloadcms/richtext-lexical"),o.push("graphql"),s){case"sqlite":t.push("@payloadcms/db-sqlite");break;case"postgresql":t.push("@payloadcms/db-vercel-postgres");break}g({projectDir:e,dependencies:o,devMode:!1}),g({projectDir:e,dependencies:t,devMode:!1});let n=y.join(p,"template/packages"),i=y.join(n,"config/payload",`${s==="postgresql"?"with-postgres":"with-sqlite"}.ts`),r=y.join(e,"payload.config.ts");P.copyFileSync(i,r);let m=y.join(n,"src/payload/collections"),u=y.join(e,"src/collections");P.mkdirSync(u,{recursive:!0}),P.copyFileSync(y.join(m,"Media.ts"),y.join(u,"Media.ts")),P.copyFileSync(y.join(m,"Users.ts"),y.join(u,"Users.ts"));let h=y.join(n,"src/app/(payload)"),d=y.join(e,"src/app/(payload)");P.mkdirSync(d,{recursive:!0}),P.copySync(h,d);let c=y.join(e,"package.json"),v=P.readJSONSync(c);v.scripts={...v.scripts,payload:"payload","generate:importmap":"payload generate:importmap","generate:types":"payload generate:types"},P.writeJSONSync(c,v,{spaces:2})};import re from"path";import et from"fs-extra";var le=({projectDir:e,packages:a})=>{let s=a?.typescript.inUse,o=a?.payload.inUse,t=[];s&&(t.push("typescript"),t.push("@types/node"),t.push("@types/react"),t.push("@types/react-dom")),g({projectDir:e,dependencies:t,devMode:!0});let n=re.join(p,"template/packages/config/tsconfig",`${o?"with-payload":"base"}.json`),i=re.join(e,"tsconfig.json");et.copyFileSync(n,i)};import _ from"path";import N from"fs-extra";var pe=({projectDir:e,packages:a})=>{let s=a?.prisma.inUse,o=["next-auth"];s&&o.push("@auth/prisma-adapter"),g({projectDir:e,dependencies:o,devMode:!1});let t=_.join(p,"template/packages"),n="src/app/api/auth/[...nextauth]/route.ts",i=_.join(t,n),r=_.join(e,n),m=_.join(t,"src/server/auth/config",s?"authjs-with-prisma.ts":"authjs.ts"),u=_.join(e,"src/server/auth/config.ts"),h=_.join(t,"src/server/auth/authjs.ts"),d=_.join(e,"src/server/auth/index.ts");N.copySync(i,r),N.copySync(m,u),N.copySync(h,d)};import M from"path";import B from"fs-extra";var ce=({projectDir:e,scopedAppName:a,packages:s,databaseProvider:o})=>{let t=s?.envVariables.inUse,n=s?.authjs.inUse,i=s?.betterAuth.inUse,r=s?.prisma.inUse,m=s?.payload.inUse,u=[];t&&(u.push("@t3-oss/env-nextjs"),u.push("zod")),g({projectDir:e,dependencies:u,devMode:!1});let h=r||m,d=tt(!!n,!!i,!!r,!!m,a,o),c="";if(h?n?c="with-authjs-db.js":i?c="with-better-auth-db.js":m?c="with-payload.js":c="with-db.js":n?c="with-authjs.js":i&&(c="with-better-auth.js"),c!==""){let He=M.join(p,"template/packages/src/env",c),Ke=M.join(e,"src/env.js");B.copyFileSync(He,Ke)}let v=M.join(e,".env"),We=M.join(e,".env.example"),Ve=at+d,q=Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("base64"),ze=d.replace('AUTH_SECRET=""',`AUTH_SECRET="${q}" # Generated by create-lx2-app`).replace('BETTER_AUTH_SECRET=""',`BETTER_AUTH_SECRET="${q}" # Generated by create-lx2-app`).replace('PAYLOAD_SECRET=""',`PAYLOAD_SECRET="${q}" # Generated by create-lx2-app`);B.writeFileSync(v,ze,"utf-8"),B.writeFileSync(We,Ve,"utf-8")};function tt(e,a,s,o,t,n){let i=`
7
+ # When adding additional environment variables, the schema in "/src/env.js"
8
+ # should be updated accordingly.
9
+ `.trim().concat(`
10
+ `);return s&&(i+=`
11
+ # Prisma
12
+ # https://www.prisma.io/docs/reference/database-reference/connection-urls#env
13
+ `),s&&(n==="mysql"?i+=`DATABASE_URL="mysql://root:password@localhost:3306/${t}"`:n==="postgresql"?i+=`DATABASE_URL="postgresql://postgres:password@localhost:5432/${t}"`:n==="sqlite"&&(i+='DATABASE_URL="file:./db.sqlite"'),i+=`
14
+ `),o&&(i+=`
15
+ # Payload CMS
16
+ # https://payloadcms.com/docs/database/overview
17
+ `,i+=`PAYLOAD_SECRET=""
18
+ `,n==="postgresql"?i+=`DATABASE_URL="postgresql://postgres:password@localhost:5432/${t}"`:n==="sqlite"&&(i+='DATABASE_URL="file:./db.sqlite"'),i+=`
19
+ `),e&&(i+=`
20
+ # Next Auth
21
+ # You can generate a new secret on the command line with:
22
+ # npx auth secret
23
+ # https://authjs.dev/getting-started/installation#setup-environment
24
+ AUTH_SECRET=""
25
+
26
+ # Next Auth Discord Provider
27
+ DISCORD_CLIENT_ID=""
28
+ DISCORD_CLIENT_SECRET=""
29
+ `),a&&(i+=`
30
+ # Better Auth
31
+ # You can generate a new secret by going to the Better Auth docs:
32
+ # https://www.better-auth.com/docs/installation#set-environment-variables
33
+ BETTER_AUTH_SECRET=""
34
+ NEXT_PUBLIC_BETTER_AUTH_URL="http://localhost:3000" # Base URL of your app
35
+
36
+ # Better Auth Discord Provider
37
+ DISCORD_CLIENT_ID=""
38
+ DISCORD_CLIENT_SECRET=""
39
+ `),!e&&!s&&!o&&(i+=`
40
+ # Example:
41
+ # SERVERVAR="foo"
42
+ # NEXT_PUBLIC_CLIENTVAR="bar"
43
+ `),i}var at=`
44
+ # Since the ".env" file is gitignored, you can use the ".env.example" file to
45
+ # build a new ".env" file when you clone the repo. Keep this file up-to-date
46
+ # when you add new variables to \`.env\`.
47
+
48
+ # This file will be committed to version control, so make sure not to have any
49
+ # secrets in it. If you are cloning this repo, create a copy of this file named
50
+ # ".env" and populate it with your secrets.
51
+ `.trim().concat(`
52
+
53
+ `);import J from"path";import W from"fs-extra";var me=({projectDir:e,packages:a})=>{let s=a?.eslint.inUse,o=[];s&&(o.push("eslint"),o.push("eslint-config-next"),o.push("@eslint/eslintrc")),g({projectDir:e,dependencies:o,devMode:!0});let t=J.join(p,"template/packages/config","eslint.config.mjs"),n=J.join(e,"eslint.config.mjs"),i=J.join(e,"package.json"),r=W.readJSONSync(i);r.scripts={...r.scripts,lint:"next lint"},W.copyFileSync(t,n),W.writeJSONSync(i,r,{spaces:2})};import de from"path";import st from"fs-extra";var fe=({projectDir:e,packages:a})=>{let s=a?.prettier.inUse,o=[];s&&(o.push("prettier"),o.push("prettier-plugin-tailwindcss"),o.push("@ianvs/prettier-plugin-sort-imports")),g({projectDir:e,dependencies:o,devMode:!0});let t=de.join(p,"template/packages/config","prettier.config.mjs"),n=de.join(e,"prettier.config.mjs");st.copyFileSync(t,n)};import x from"path";import S from"fs-extra";var ue=({projectDir:e,packages:a,databaseProvider:s})=>{let o=a?.authjs.inUse,t=a?.betterAuth.inUse;g({projectDir:e,dependencies:["prisma"],devMode:!0}),g({projectDir:e,dependencies:["@prisma/client"],devMode:!1});let n=x.join(p,"template/packages"),i=x.join(n,"prisma/schema",`${o?"with-authjs":t?"with-better-auth":"base"}.prisma`),r=S.readFileSync(i,"utf-8");s!=="sqlite"&&(r=r.replace('provider = "sqlite"',`provider = "${{mysql:"mysql",postgresql:"postgresql"}[s]}"`),["mysql"].includes(s)&&(r=r.replace("// @db.Text","@db.Text")));let m=x.join(e,"prisma/schema.prisma");S.mkdirSync(x.dirname(m),{recursive:!0}),S.writeFileSync(m,r);let u=x.join(n,"src/server/db/db-prisma.ts"),h=x.join(e,"src/server/db/index.ts");S.mkdirSync(x.dirname(h),{recursive:!0}),S.writeFileSync(h,S.readFileSync(u,"utf-8"));let d=x.join(e,"package.json"),c=S.readJSONSync(d);c.scripts={...c.scripts,postinstall:"prisma generate","db:push":"prisma db push","db:studio":"prisma studio","db:generate":"prisma migrate dev","db:migrate":"prisma migrate deploy"},S.writeJSONSync(d,c,{spaces:2})};var ge=["none","authjs","betterAuth"],he=["none","prisma"],U=["sqlite","mysql","postgresql"];var ye=e=>({authjs:{inUse:e.includes("authjs"),installer:pe},betterAuth:{inUse:e.includes("betterAuth"),installer:oe},prisma:{inUse:e.includes("prisma"),installer:ue},envVariables:{inUse:!0,installer:ce},prettier:{inUse:e.includes("prettier"),installer:fe},eslint:{inUse:e.includes("eslint"),installer:me},typescript:{inUse:!0,installer:le},payload:{inUse:e.includes("payload"),installer:ie}});import nt from"path";import ot from"fs-extra";function j(){let e=nt.join(p,"package.json");return ot.readJSONSync(e).version??"1.0.0"}var b=()=>{let e=process.env.npm_config_user_agent;return e?e.startsWith("yarn")?"yarn":e.startsWith("pnpm")?"pnpm":e.startsWith("bun")?"bun":"npm":"npm"};var O=class extends Error{constructor(a){super(a)}};import $ from"chalk";var l={error(...e){console.log($.red(...e))},warn(...e){console.log($.yellow(...e))},info(...e){console.log($.cyan(...e))},success(...e){console.log($.green(...e))}};var G=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e);var it=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;function be(e){let a=G(e),s=a.split("/"),o=s.findIndex(n=>n.startsWith("@")),t=s[s.length-1];return s.findIndex(n=>n.startsWith("@"))!==-1&&(t=s.slice(o).join("/")),a=="."||it.test(t??"")?!0:"App name must consist of only lowercase alphanumeric characters, '-', and '_'"}var ve=e=>e.startsWith(".")||e.startsWith("/")?"Import alias can't start with '.' or '/'":!0;var f={appName:C,packages:[],flags:{noGit:!1,noInstall:!1,default:!1,CI:!1,authentication:"none",orm:"none",formatter:"prettier",linter:"eslint",importAlias:"@/",dbProvider:"sqlite",backend:"nextjs"},databaseProvider:"sqlite"};async function we(){let e=f,a=new rt().name(F).description("CLI for scaffolding new web apps with the Lx2 stack").version(j(),"-v, --version","Output the current version of Create Lx2 App").argument("[dir]","The name of the application, as well as the name of the directory to create").option("--noGit","Explicitly tell the CLI to not initialize a new git repo in the project",!1).option("--noInstall","Explicitly tell the CLI to not run the package manager's install command",!1).option("-y, --default","Bypass the CLI and use all default options to bootstrap a new lx2-app",!1).option("--CI","Boolean value if we're running in CI",!1).option("--backend [framework]",`Choose a backend framework to use. Possible values: ${f.flags.backend}`,f.flags.backend).option("--authProvider [provider]",`Choose an authentication provider to use. Possible values: ${ge.join(", ")}`,f.flags.authentication).option("--databaseORM [orm]",`Choose a database ORM to use. Possible values: ${he.join(", ")}`,f.flags.orm).option("--formatter [formatter]",`Choose a formatter to use. Possible values: ${f.flags.formatter}`,f.flags.formatter).option("--linter [linter]",`Choose a linter to use. Possible values: ${f.flags.linter}`,f.flags.linter).option("-i, --import-alias [alias]","Explicitly tell the CLI to use a custom import alias",f.flags.importAlias).option("--dbProvider [provider]",`Choose a database provider to use. Possible values: ${U.join(", ")}`,f.flags.dbProvider).parse(process.argv);process.env.npm_config_user_agent?.startsWith("yarn/3")&&l.warn(` WARNING: It looks like you are using Yarn 3. This is currently not supported,
54
+ and likely to result in a crash. Please run create-lx2-app with another
55
+ package manager such as pnpm, npm, or Yarn Classic.
56
+ See: https://github.com/t3-oss/create-t3-app/issues/57`);let s=a.args[0];if(s&&(e.appName=s),e.flags=a.opts(),e.flags.CI){switch(e.packages=[],e.flags.backend){case"payload":e.packages.push("payload");break;default:break}switch(e.flags.authentication){case"authjs":e.packages.push("authjs");break;case"betterAuth":e.packages.push("betterAuth");break;default:break}switch(e.flags.orm){case"prisma":e.packages.push("prisma");break;default:break}switch(e.flags.formatter){case"prettier":e.packages.push("prettier");break;default:break}switch(e.flags.linter){case"eslint":e.packages.push("eslint");break;default:break}return U.includes(e.flags.dbProvider)===!1&&(l.warn(`Incompatible database provided. Use: ${U.join(", ")}. Exiting.`),process.exit(0)),e.flags.backend==="payload"&&e.flags.dbProvider==="mysql"&&(l.warn("Payload CMS does not support MySQL. Exiting."),process.exit(0)),e}if(e.flags.default)return e;try{if(process.env.TERM_PROGRAM?.toLowerCase().includes("mintty"))throw l.warn(` WARNING: It looks like you are using MinTTY, which is non-interactive. This is most likely because you are
57
+ using Git Bash. If that's that case, please use Git Bash from another terminal, such as Windows Terminal. Alternatively, you
58
+ can provide the arguments from the CLI directly: https://create.lx2.dev/docs/getting-started#experimental-ci-flags to skip the prompts.`),new O("Non-interactive environment");let o=b(),t={};s||(t.name=await ke({message:"What will your project be called?",default:C,validate:i=>be(i)})),t.backend=await A({message:"What backend framework would you like to use?",choices:[{value:"nextjs",name:"Next.js"},{value:"payload",name:"Payload CMS"}],default:!f.flags.backend}),t.backend==="payload"&&(t.databaseProvider=await A({message:"What database provider would you like to use?",choices:[{value:"sqlite",name:"SQLite"},{value:"postgresql",name:"PostgreSQL"}],default:!f.flags.dbProvider})),t.backend==="nextjs"&&(t.authentication=await A({message:"What authentication provider would you like to use?",choices:[{value:"none",name:"None"},{value:"authjs",name:"Auth.js"},{value:"betterAuth",name:"Better Auth"}],default:!f.flags.authentication}),t.orm=await A({message:"What database ORM would you like to use?",choices:[{value:"none",name:"None"},{value:"prisma",name:"Prisma"}],default:!f.flags.orm}),t.orm!=="none"&&(t.databaseProvider=await A({message:"What database provider would you like to use?",choices:[{value:"sqlite",name:"SQLite"},{value:"mysql",name:"MySQL"},{value:"postgresql",name:"PostgreSQL"}],default:!f.flags.dbProvider}))),t.formatter=await A({message:"What formatter would you like to use?",choices:[{value:"prettier",name:"Prettier"}],default:!f.flags.formatter}),t.linter=await A({message:"What linter would you like to use?",choices:[{value:"eslint",name:"ESLint"}],default:!f.flags.linter}),e.flags.noGit||(t.noGit=await V({message:"Should we initialize a Git repository and stage the changes?",default:!f.flags.noGit})),e.flags.noInstall||(t.noInstall=await V({message:`Should we run '${o}`+(o==="yarn"?"'?":" install' for you?"),default:!f.flags.noInstall})),t.importAlias=await ke({message:"What import alias would you like to use?",default:f.flags.importAlias,validate:ve});let n=[];switch(t.backend){case"payload":n.push("payload");break;default:break}switch(t.authentication){case"authjs":n.push("authjs");break;case"betterAuth":n.push("betterAuth");break;default:break}switch(t.orm){case"prisma":n.push("prisma");break;default:break}switch(t.formatter){case"prettier":n.push("prettier");break;default:break}switch(t.linter){case"eslint":n.push("eslint");break;default:break}return{appName:t.name??e.appName,packages:n,flags:{...e.flags,noGit:!t.noGit||e.flags.noGit,noInstall:!t.noInstall||e.flags.noInstall,importAlias:t.importAlias??e.flags.importAlias},databaseProvider:t.databaseProvider||"sqlite"}}catch(o){if(o instanceof O)l.warn(`${F} needs an interactive terminal to run.`),await V({message:"Continue scaffolding with default options?",default:!0})||(l.info("Exiting..."),process.exit(0)),l.info(`Scaffolding default lx2 app in ./${e.appName}`);else throw o}return e}import dt from"path";import Pe from"chalk";import lt from"ora";function xe(e){let{packages:a}=e;l.info("Adding boilerplate...");for(let[s,o]of Object.entries(a))if(o.inUse){let t=lt(`Boilerplating ${s}...`).start();o.installer(e),t.succeed(Pe.green(`${Pe.green.bold(s)}`))}l.info("")}import z from"path";import{confirm as pt,select as ct}from"@inquirer/prompts";import I from"chalk";import D from"fs-extra";import mt from"ora";async function Se({projectName:e,projectDir:a,pkgManager:s,noInstall:o}){let t=z.join(p,"template/base");o?l.info(""):l.info(`
59
+ Using: ${I.cyan.bold(s)}
60
+ `);let n=mt(`Scaffolding in: ${a}...
61
+ `).start();if(D.existsSync(a))if(D.readdirSync(a).length===0)e!=="."&&n.info(`${I.cyan.bold(e)} exists but is empty, continuing...
62
+ `);else{n.stopAndPersist();let r=await ct({message:`${I.redBright.bold("Warning:")} ${I.cyan.bold(e)} already exists and isn't empty. How would you like to proceed?`,choices:[{value:"abort",name:"Abort installation (recommended)"},{value:"clear",name:"Clear the directory and continue installation"},{value:"overwrite",name:"Continue installation and overwrite conflicting files"}],default:"abort"});r==="abort"&&(n.fail("Aborting installation..."),process.exit(1)),await pt({message:`Are you sure you want to ${r==="clear"?"clear the directory":"overwrite conflicting files"}`,default:!1})||(n.fail("Aborting installation..."),process.exit(1)),r==="clear"&&(n.info(`Emptying ${I.cyan.bold(e)} and creating lx2 app...
63
+ `),D.emptyDirSync(a))}n.start(),D.copySync(t,a),D.renameSync(z.join(a,"_gitignore"),z.join(a,".gitignore"));let i=e==="."?"App":I.cyan.bold(e);n.succeed(`${i} ${I.green.bold("scaffolded successfully!")}
64
+ `)}import k from"path";import H from"fs-extra";function _e({packages:e,projectDir:a}){let s=k.join(p,"template/packages/src/app/layout"),o=e.payload.inUse,n=k.join(s,"base.tsx"),i=k.join(a,`src/app/${o?"(frontend)":""}/layout.tsx`);H.copySync(n,i)}function Ae({packages:e,projectDir:a}){let s=k.join(p,"template/packages/src/app/page"),o=e.payload.inUse,t=e.authjs.inUse,n=e.betterAuth.inUse,i=e.prisma.inUse,r="base.tsx";o&&(r="with-payload.tsx"),t&&(r="with-authjs.tsx"),n&&(r="with-better-auth.tsx"),i&&(r="with-prisma.tsx"),t&&i&&(r="with-authjs-prisma.tsx"),n&&i&&(r="with-better-auth-prisma.tsx");let m=k.join(s,r),u=k.join(a,`src/app/${o?"(frontend)":""}/page.tsx`);H.copySync(m,u)}function Ie({packages:e,projectDir:a}){let s=k.join(p,"template/packages/src/app/globals"),o=e.payload.inUse,n=k.join(s,"base.css"),i=k.join(a,`src/app/${o?"(frontend)":""}/globals.css`);H.copySync(n,i)}async function je({projectName:e,scopedAppName:a,packages:s,noInstall:o,databaseProvider:t}){let n=b(),i=dt.resolve(process.cwd(),e);return await Se({projectName:e,projectDir:i,pkgManager:n,scopedAppName:a,noInstall:o,databaseProvider:t}),xe({projectName:e,scopedAppName:a,projectDir:i,pkgManager:n,packages:s,noInstall:o,databaseProvider:t}),_e({packages:s,projectDir:i}),Ae({packages:s,projectDir:i}),Ie({packages:s,projectDir:i}),i}import{execSync as Y}from"child_process";import K from"path";import{confirm as Ce}from"@inquirer/prompts";import E from"chalk";import{execa as R}from"execa";import Te from"fs-extra";import ft from"ora";function ut(e){try{return Y("git --version",{cwd:e}),!0}catch{return!1}}function Q(e){return Te.existsSync(K.join(e,".git"))}async function X(e){try{return await R("git",["rev-parse","--is-inside-work-tree"],{cwd:e,stdout:"ignore"}),!0}catch{return!1}}function gt(){let a=Y("git --version").toString().trim().split(" ")[2],s=a?.split(".")[0],o=a?.split(".")[1];return{major:Number(s),minor:Number(o)}}function ht(){return Y("git config --global init.defaultBranch || echo main").toString().trim()}async function Oe(e){if(l.info("Initializing Git..."),!ut(e)){l.warn("Git is not installed. Skipping Git initialization.");return}let a=ft(`Creating a new git repo...
65
+ `).start(),s=Q(e),o=await X(e),t=K.parse(e).name;if(o&&s){if(a.stop(),!await Ce({message:`${E.redBright.bold("Warning:")} Git is already initialized in "${t}". Initializing a new git repository would delete the previous history. Would you like to continue anyways?`,default:!1})){a.info("Skipping Git initialization.");return}Te.removeSync(K.join(e,".git"))}else if(o&&!s&&(a.stop(),!await Ce({message:`${E.redBright.bold("Warning:")} "${t}" is already in a git worktree. Would you still like to initialize a new git repository in this directory?`,default:!1}))){a.info("Skipping Git initialization.");return}try{let n=ht(),{major:i,minor:r}=gt();i<2||i==2&&r<28?(await R("git",["init"],{cwd:e}),await R("git",["symbolic-ref","HEAD",`refs/heads/${n}`],{cwd:e})):await R("git",["init",`--initial-branch=${n}`],{cwd:e}),await R("git",["add","."],{cwd:e}),a.succeed(`${E.green("Successfully initialized and staged")} ${E.green.bold("git")}
66
+ `)}catch{a.fail(`${E.bold.red("Failed:")} could not initialize git. Update git to the latest version!
67
+ `)}}import yt from"chalk";import{execa as De}from"execa";import Ee from"ora";var Z=async(e,a,s)=>{let{onDataHandle:o,args:t=["install"],stdout:n="pipe"}=s,i=Ee(`Running ${a} install...`).start(),r=De(a,t,{cwd:e,stdout:n});return await new Promise((m,u)=>{o&&r.stdout?.on("data",o(i)),r.on("error",h=>u(h)),r.on("close",()=>m())}),i},bt=async(e,a)=>{switch(e){case"npm":return await De(e,["install"],{cwd:a,stderr:"inherit"}),null;case"pnpm":return Z(a,e,{onDataHandle:s=>o=>{let t=o.toString();t.includes("Progress")&&(s.text=t.includes("|")?t.split(" | ")[1]??"":t)}});case"yarn":return Z(a,e,{onDataHandle:s=>o=>{s.text=o.toString()}});case"bun":return Z(a,e,{stdout:"ignore"})}},Re=async({projectDir:e})=>{l.info("Installing dependencies...");let a=b();(await bt(a,e)??Ee()).succeed(yt.green(`Successfully installed dependencies!
68
+ `))};var Me=async({projectName:e=C,packages:a,noInstall:s,projectDir:o,databaseProvider:t})=>{let n=b();l.info("Next steps:"),e!=="."&&l.info(` cd ${e}`),s&&(n==="yarn"?l.info(` ${n}`):l.info(` ${n} install`)),["postgresql","mysql"].includes(t)&&l.info(" Add your database connection string to .env"),a?.authjs.inUse&&l.info(" Fill in your .env with necessary values. See https://create.lx2.dev/docs/first-steps for more info."),a?.betterAuth.inUse&&l.info(" Fill in your .env with necessary values. See https://create.lx2.dev/docs/first-steps for more info."),a?.prisma.inUse&&l.info(` Run "${n} db:push" to create you database tables.`),["npm"].includes(n)?l.info(` ${n} run dev`):l.info(` ${n} dev`),!await X(o)&&!Q(o)&&l.info(" git init"),l.info(' git commit -m "initial commit"')};import L from"fs";import vt from"path";function Ue(e,a,s){L.readdirSync(e).forEach(t=>{let n=vt.join(e,t);if(L.statSync(n).isDirectory())Ue(n,a,s);else{let r=L.readFileSync(n,"utf8").replace(new RegExp(a,"g"),s);L.writeFileSync(n,r,"utf8")}})}function $e(e,a){let s=a.replace(/\*/g,"").replace(/[^\/]$/,"$&/");Ue(e,"@/",s)}import Ge from"path";function Le(e){let s=G(e).split("/"),o=s[s.length-1];if(o==="."){let i=Ge.resolve(process.cwd());o=Ge.basename(i)}let t=s.findIndex(i=>i.startsWith("@"));s.findIndex(i=>i.startsWith("@"))!==-1&&(o=s.slice(t).join("/"));let n=s.filter(i=>!i.startsWith("@")).join("/");return[o,n]}import kt from"gradient-string";var wt={primary:"#bf95f9",accent:"#6071a4",secondary:"#ff7ac5"};function qe(){let e=kt(Object.values(wt)),a=b();(a==="yarn"||a==="pnpm")&&console.log(""),console.log(e.multiline(te))}import{execSync as Pt}from"child_process";import xt from"https";function Fe(e){let a=j();a.includes("beta")?(l.warn(" You are using a beta version of create-lx2-app."),l.warn(" Please report any bugs you encounter.")):a!==e&&(l.warn(" You are using an outdated version of create-lx2-app."),l.warn(" Your version:",a+".","Latest version in the npm registry:",e),l.warn(" Please run the CLI with @latest to get the latest updates.")),console.log("")}function St(){return new Promise((e,a)=>{xt.get("https://registry.npmjs.org/-/package/create-lx2-app/dist-tags",s=>{if(s.statusCode===200){let o="";s.on("data",t=>o+=t),s.on("end",()=>{e(JSON.parse(o).latest)})}else a()}).on("error",()=>{a()})})}var Ne=()=>St().catch(()=>{try{return Pt("npm view create-lx2-app version").toString().trim()}catch{return null}});async function At(){let e=await Ne(),a=b();qe(),e&&Fe(e);let{appName:s,packages:o,flags:{noGit:t,noInstall:n,importAlias:i},databaseProvider:r}=await we(),m=ye(o),[u,h]=Le(s),d=await je({projectName:h,scopedAppName:u,packages:m,noInstall:n,databaseProvider:r}),c=Je.readJsonSync(Be.join(d,"package.json"));c.name=u,c.clx2aMetadata={initVersion:j()};let{stdout:v}=await _t(a,["-v"],{cwd:d});c.packageManager=`${a}@${v.trim()}`,Je.writeJSONSync(Be.join(d,"package.json"),c,{spaces:2}),i!=="@/"&&$e(d,i),n||await Re({projectDir:d}),t||await Oe(d),await Me({projectDir:d,projectName:h,packages:m,noInstall:n,databaseProvider:r}),process.exit(0)}At().catch(e=>{l.error("Aborting installation..."),e instanceof Error?l.error(e.message):(l.error("An unknown error occurred. Please open an issue on GitHub with the below:"),console.error(e)),process.exit(1)});
package/package.json ADDED
@@ -0,0 +1,92 @@
1
+ {
2
+ "name": "create-lx2-app",
3
+ "version": "0.7.0",
4
+ "description": "Create powerful full-stack web applications with the Lx2 stack",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/slickyeet/create-lx2-app",
9
+ "directory": "cli"
10
+ },
11
+ "keywords": [
12
+ "create-lx2-app",
13
+ "lx2-app",
14
+ "typescript",
15
+ "next.js",
16
+ "tailwind"
17
+ ],
18
+ "type": "module",
19
+ "exports": "./dist/index.js",
20
+ "bin": {
21
+ "create-lx2-app": "./dist/index.js"
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "template",
26
+ "README.md",
27
+ "LICENSE",
28
+ "package.json"
29
+ ],
30
+ "engines": {
31
+ "node": ">=18"
32
+ },
33
+ "scripts": {
34
+ "dev": "tsup --watch",
35
+ "build": "tsup",
36
+ "start": "node dist/index.js",
37
+ "format": "prettier '**/*.{cjs,mjs,ts,tsx,md,json}' --ignore-path ../.gitignore --ignore-unknown --no-error-on-unmatched-pattern --write",
38
+ "format:check": "prettier '**/*.{cjs,mjs,ts,tsx,md,json}' --ignore-path ../.gitignore --ignore-unknown --no-error-on-unmatched-pattern --check",
39
+ "typecheck": "tsc",
40
+ "clean": "rm -rf dist .turbo node_modules",
41
+ "link": "pnpm run build && npm link",
42
+ "release": "changeset version",
43
+ "pub:beta": "pnpm run build && npm publish --tag beta",
44
+ "pub:release": "pnpm run build && npm publish"
45
+ },
46
+ "dependencies": {
47
+ "@inquirer/prompts": "^7.4.0",
48
+ "better-auth": "^1.2.7",
49
+ "better-sqlite3": "^11.9.1",
50
+ "chalk": "^5.4.1",
51
+ "commander": "^13.1.0",
52
+ "execa": "^9.5.2",
53
+ "fs-extra": "^11.3.0",
54
+ "gradient-string": "^3.0.0",
55
+ "ora": "^8.2.0",
56
+ "sort-package-json": "^3.0.0"
57
+ },
58
+ "devDependencies": {
59
+ "@auth/prisma-adapter": "^2.8.0",
60
+ "@eslint/eslintrc": "^3.3.1",
61
+ "@ianvs/prettier-plugin-sort-imports": "^4.4.1",
62
+ "@payloadcms/db-sqlite": "^3.33.0",
63
+ "@payloadcms/db-vercel-postgres": "^3.33.0",
64
+ "@payloadcms/next": "^3.33.0",
65
+ "@payloadcms/payload-cloud": "^3.33.0",
66
+ "@payloadcms/richtext-lexical": "^3.33.0",
67
+ "@prisma/client": "^6.5.0",
68
+ "@t3-oss/env-nextjs": "^0.12.0",
69
+ "@types/better-sqlite3": "^7.6.13",
70
+ "@types/fs-extra": "^11.0.4",
71
+ "@types/node": "^22",
72
+ "@types/react": "^19",
73
+ "@types/react-dom": "^19",
74
+ "eslint": "^9.22.0",
75
+ "eslint-config-next": "^15.2.4",
76
+ "graphql": "^16.10.0",
77
+ "next": "^15.2.4",
78
+ "next-auth": "^5.0.0-beta.25",
79
+ "payload": "^3.33.0",
80
+ "prettier": "^3.5.3",
81
+ "prettier-plugin-tailwindcss": "^0.6.11",
82
+ "prisma": "^6.5.0",
83
+ "react": "^19.0.0",
84
+ "react-dom": "^19.0.0",
85
+ "sharp": "^0.34.1",
86
+ "tailwindcss": "^4.0.17",
87
+ "tsup": "^8.4.0",
88
+ "type-fest": "^4.37.0",
89
+ "typescript": "^5.8.2",
90
+ "zod": "^3.24.2"
91
+ }
92
+ }
@@ -0,0 +1,57 @@
1
+ # Create Lx2 App
2
+
3
+ This is a [Lx2 Stack](https://create.lx2.dev) project bootstrapped with
4
+ `create-lx2-app`.
5
+
6
+ ## Where do I go from here?
7
+
8
+ You can treat this project just as you would a regular `create-next-app`
9
+ project, but without needing to implement additional packages yourself. This
10
+ means you can start scaffolding from our base template.
11
+
12
+ To start developing simply run the following commands:
13
+
14
+ ```bash
15
+ cd your-project-name
16
+
17
+ npm run dev
18
+ # or
19
+ pnpm dev
20
+ # or
21
+ yarn dev
22
+ # or
23
+ bun dev
24
+ ```
25
+
26
+ ## Learn More
27
+
28
+ To learn more about the [Lx2 Stack](https://create.lx2.dev), take a look at our
29
+ [documentation](https://create.lx2.dev).
30
+
31
+ If you are not familiar with the different technologies used in this project,
32
+ please refer to the respective docs.
33
+
34
+ - [Next.js](https://nextjs.org)
35
+ - [Payload CMS](https://payloadcms.com)
36
+ - [Auth.js](https://authjs.dev)
37
+ - [Better Auth](https://better-auth.com)
38
+ - [Prisma](https://prisma.io)
39
+ - [Drizzle](https://orm.drizzle.team)
40
+ - [Tailwind CSS](https://tailwindcss.com)
41
+
42
+ You can check out the
43
+ [create-lx2-app GitHub repository](https://github.com/SlickYeet/create-lx2-app)
44
+ — your feedback and contributions are welcome!
45
+
46
+ ## How do I deploy this?
47
+
48
+ > [!NOTE] Currently, we have a guide for deploying to
49
+ > [Vercel](https://create.lx2.dev/docs/vercel), with more deployment options
50
+ > coming soon.
51
+
52
+ Follow our deployment guides for more information
53
+
54
+ - [Vercel](https://create.lx2.dev/docs/vercel)
55
+ <!-- - [Netlify](https://create.lx2.dev/docs/netlify) — Coming soon -->
56
+ <!-- - [Docker](https://create.lx2.dev/docs/docker) — Coming soon -->
57
+ <!-- - [Cloudflare](https://create.lx2.dev/docs/cloudflare) — Coming soon -->
@@ -0,0 +1,41 @@
1
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
+
3
+ # dependencies
4
+ /node_modules
5
+ /.pnp
6
+ .pnp.*
7
+ .yarn/*
8
+ !.yarn/patches
9
+ !.yarn/plugins
10
+ !.yarn/releases
11
+ !.yarn/versions
12
+
13
+ # testing
14
+ /coverage
15
+
16
+ # next.js
17
+ /.next/
18
+ /out/
19
+
20
+ # production
21
+ /build
22
+
23
+ # misc
24
+ .DS_Store
25
+ *.pem
26
+
27
+ # debug
28
+ npm-debug.log*
29
+ yarn-debug.log*
30
+ yarn-error.log*
31
+ .pnpm-debug.log*
32
+
33
+ # env files (can opt-in for committing if needed)
34
+ .env
35
+
36
+ # vercel
37
+ .vercel
38
+
39
+ # typescript
40
+ *.tsbuildinfo
41
+ next-env.d.ts
@@ -0,0 +1,5 @@
1
+ /// <reference types="next" />
2
+ /// <reference types="next/image-types/global" />
3
+
4
+ // NOTE: This file should not be edited
5
+ // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
3
+ * for Docker builds.
4
+ */
5
+ import "./src/env.js"
6
+
7
+ /** @type {import("next").NextConfig} */
8
+ const nextConfig = {
9
+ /* config options here */
10
+ }
11
+
12
+ export default nextConfig
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "template",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "next dev --turbopack",
8
+ "build": "next build",
9
+ "start": "next start"
10
+ },
11
+ "dependencies": {
12
+ "react": "^19.0.0",
13
+ "react-dom": "^19.0.0",
14
+ "next": "^15.2.4"
15
+ },
16
+ "devDependencies": {
17
+ "@tailwindcss/postcss": "^4",
18
+ "tailwindcss": "^4.0.17"
19
+ }
20
+ }
@@ -0,0 +1,5 @@
1
+ const config = {
2
+ plugins: ["@tailwindcss/postcss"],
3
+ }
4
+
5
+ export default config
Binary file
@@ -0,0 +1,40 @@
1
+ import { createEnv } from "@t3-oss/env-nextjs"
2
+ import { z } from "zod"
3
+
4
+ export const env = createEnv({
5
+ /**
6
+ * Specify your server-side environment variables schema here. This way you can ensure the app
7
+ * isn't built with invalid env vars.
8
+ */
9
+ server: {
10
+ NODE_ENV: z.enum(["development", "test", "production"]),
11
+ },
12
+
13
+ /**
14
+ * Specify your client-side environment variables schema here. This way you can ensure the app
15
+ * isn't built with invalid env vars. To expose them to the client, prefix them with
16
+ * `NEXT_PUBLIC_`.
17
+ */
18
+ client: {
19
+ // NEXT_PUBLIC_CLIENTVAR: z.string(),
20
+ },
21
+
22
+ /**
23
+ * You can't destruct `process.env` as a regular object in the Next.js edge runtimes (e.g.
24
+ * middlewares) or client-side so we need to destruct manually.
25
+ */
26
+ runtimeEnv: {
27
+ NODE_ENV: process.env.NODE_ENV,
28
+ // NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
29
+ },
30
+ /**
31
+ * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
32
+ * useful for Docker builds.
33
+ */
34
+ skipValidation: !!process.env.SKIP_ENV_VALIDATION,
35
+ /**
36
+ * Makes it so that empty strings are treated as undefined. `SOME_VAR: z.string()` and
37
+ * `SOME_VAR=''` will throw an error.
38
+ */
39
+ emptyStringAsUndefined: true,
40
+ })
@@ -0,0 +1,16 @@
1
+ import { dirname } from "path"
2
+ import { fileURLToPath } from "url"
3
+ import { FlatCompat } from "@eslint/eslintrc"
4
+
5
+ const __filename = fileURLToPath(import.meta.url)
6
+ const __dirname = dirname(__filename)
7
+
8
+ const compat = new FlatCompat({
9
+ baseDirectory: __dirname,
10
+ })
11
+
12
+ const eslintConfig = [
13
+ ...compat.extends("next/core-web-vitals", "next/typescript"),
14
+ ]
15
+
16
+ export default eslintConfig
@@ -0,0 +1,39 @@
1
+ // storage-adapter-import-placeholder
2
+ import path from "path"
3
+ import { fileURLToPath } from "url"
4
+ import { vercelPostgresAdapter } from "@payloadcms/db-vercel-postgres"
5
+ import { payloadCloudPlugin } from "@payloadcms/payload-cloud"
6
+ import { lexicalEditor } from "@payloadcms/richtext-lexical"
7
+ import { buildConfig } from "payload"
8
+ import sharp from "sharp"
9
+
10
+ import { Media } from "@/collections/Media"
11
+ import { Users } from "@/collections/Users"
12
+
13
+ const filename = fileURLToPath(import.meta.url)
14
+ const dirname = path.dirname(filename)
15
+
16
+ export default buildConfig({
17
+ admin: {
18
+ user: Users.slug,
19
+ importMap: {
20
+ baseDir: path.resolve(dirname),
21
+ },
22
+ },
23
+ collections: [Users, Media],
24
+ editor: lexicalEditor(),
25
+ secret: process.env.PAYLOAD_SECRET || "",
26
+ typescript: {
27
+ outputFile: path.resolve(dirname, "payload-types.ts"),
28
+ },
29
+ db: vercelPostgresAdapter({
30
+ pool: {
31
+ connectionString: process.env.DATABASE_URL || "",
32
+ },
33
+ }),
34
+ sharp,
35
+ plugins: [
36
+ payloadCloudPlugin(),
37
+ // storage-adapter-placeholder
38
+ ],
39
+ })
@@ -0,0 +1,42 @@
1
+ // storage-adapter-import-placeholder
2
+ import path from "path"
3
+ import { fileURLToPath } from "url"
4
+ import { sqliteAdapter } from "@payloadcms/db-sqlite"
5
+ import { payloadCloudPlugin } from "@payloadcms/payload-cloud"
6
+ import { lexicalEditor } from "@payloadcms/richtext-lexical"
7
+ import { buildConfig } from "payload"
8
+ import sharp from "sharp"
9
+
10
+ import { Media } from "@/collections/Media"
11
+ import { Users } from "@/collections/Users"
12
+
13
+ const filename = fileURLToPath(import.meta.url)
14
+ const dirname = path.dirname(filename)
15
+
16
+ export default buildConfig({
17
+ admin: {
18
+ user: Users.slug,
19
+ importMap: {
20
+ baseDir: path.resolve(dirname),
21
+ },
22
+ },
23
+ collections: [Users, Media],
24
+ editor: lexicalEditor(),
25
+ secret: process.env.PAYLOAD_SECRET || "",
26
+ typescript: {
27
+ outputFile: path.resolve(dirname, "payload-types.ts"),
28
+ },
29
+ db: sqliteAdapter({
30
+ // SQLite-specific arguments go here.
31
+ // `client.url` is required.
32
+ client: {
33
+ url: process.env.DATABASE_URL || "",
34
+ authToken: process.env.DATABASE_AUTH_TOKEN,
35
+ },
36
+ }),
37
+ sharp,
38
+ plugins: [
39
+ payloadCloudPlugin(),
40
+ // storage-adapter-placeholder
41
+ ],
42
+ })