@clubedge/create-clubedge-app 0.2.1 → 0.3.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 (154) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +50 -35
  3. package/bin/create.mjs +2 -469
  4. package/dist/cli/args.js +49 -0
  5. package/dist/cli/ui.js +85 -0
  6. package/dist/core/customize.js +56 -0
  7. package/dist/core/execute.js +60 -0
  8. package/dist/core/manifest.js +81 -0
  9. package/dist/core/plan.js +67 -0
  10. package/dist/core/source.js +107 -0
  11. package/dist/index.js +125 -0
  12. package/dist/package-info.js +8 -0
  13. package/dist/steps/git.js +11 -0
  14. package/dist/steps/install.js +19 -0
  15. package/dist/utils/fs.js +97 -0
  16. package/dist/utils/names.js +14 -0
  17. package/dist/utils/process.js +49 -0
  18. package/package.json +18 -7
  19. package/template/.dockerignore +8 -0
  20. package/template/.env.example +25 -0
  21. package/template/.gitattributes +6 -0
  22. package/template/.github/ISSUE_TEMPLATE/bug_report.yml +35 -0
  23. package/template/.github/ISSUE_TEMPLATE/config.yml +8 -0
  24. package/template/.github/ISSUE_TEMPLATE/feature_request.yml +24 -0
  25. package/template/.github/pull_request_template.md +20 -0
  26. package/template/.github/workflows/ci.yml +49 -0
  27. package/template/.prettierignore +1 -0
  28. package/template/.prettierrc.json +1 -0
  29. package/template/AGENTS.md +31 -0
  30. package/template/CODE_OF_CONDUCT.md +22 -0
  31. package/template/CONTRIBUTING.md +53 -0
  32. package/template/Dockerfile +32 -0
  33. package/template/LICENSE +201 -0
  34. package/template/NOTICE +6 -0
  35. package/template/PUBLISHING.md +27 -0
  36. package/template/README.md +157 -0
  37. package/template/SECURITY.md +15 -0
  38. package/template/SETUP.md +174 -0
  39. package/template/SUPPORT.md +8 -0
  40. package/template/_gitignore +13 -0
  41. package/template/apps/web/AGENTS.md +9 -0
  42. package/template/apps/web/components.json +21 -0
  43. package/template/apps/web/e2e/auth.spec.ts +37 -0
  44. package/template/apps/web/e2e/home.spec.ts +15 -0
  45. package/template/apps/web/next-env.d.ts +7 -0
  46. package/template/apps/web/next.config.ts +32 -0
  47. package/template/apps/web/package.json +33 -0
  48. package/template/apps/web/postcss.config.mjs +3 -0
  49. package/template/apps/web/public/.gitkeep +0 -0
  50. package/template/apps/web/public/.well-known/logo.svg +1 -0
  51. package/template/apps/web/src/app/actions/auth.ts +85 -0
  52. package/template/apps/web/src/app/api/health/route.ts +11 -0
  53. package/template/apps/web/src/app/auth/callback/route.ts +21 -0
  54. package/template/apps/web/src/app/dashboard/_components/account-button.tsx +34 -0
  55. package/template/apps/web/src/app/dashboard/_components/app-sidebar.tsx +91 -0
  56. package/template/apps/web/src/app/dashboard/page.tsx +352 -0
  57. package/template/apps/web/src/app/favicon.ico +0 -0
  58. package/template/apps/web/src/app/layout.tsx +36 -0
  59. package/template/apps/web/src/app/login/_components/auth-form-controls.tsx +88 -0
  60. package/template/apps/web/src/app/login/page.tsx +149 -0
  61. package/template/apps/web/src/app/page.tsx +229 -0
  62. package/template/apps/web/src/app/theme-provider.tsx +43 -0
  63. package/template/apps/web/src/app/theme-toggle.tsx +23 -0
  64. package/template/apps/web/src/components/branding/clubedge-mark.tsx +25 -0
  65. package/template/apps/web/src/components/landing/copy-command.tsx +48 -0
  66. package/template/apps/web/src/config/site.json +11 -0
  67. package/template/apps/web/src/config/site.ts +20 -0
  68. package/template/apps/web/src/env/client.ts +22 -0
  69. package/template/apps/web/src/env/server.test.ts +35 -0
  70. package/template/apps/web/src/env/server.ts +45 -0
  71. package/template/apps/web/src/lib/login-url.test.ts +16 -0
  72. package/template/apps/web/src/lib/login-url.ts +16 -0
  73. package/template/apps/web/src/lib/utils.ts +1 -0
  74. package/template/apps/web/src/proxy.ts +31 -0
  75. package/template/apps/web/src/server/auth.ts +69 -0
  76. package/template/apps/web/src/server/cache.ts +38 -0
  77. package/template/apps/web/src/server/db.ts +16 -0
  78. package/template/apps/web/src/server/storage.ts +39 -0
  79. package/template/apps/web/src/server/users.ts +17 -0
  80. package/template/apps/web/tsconfig.json +36 -0
  81. package/template/clubedge.template.json +13 -0
  82. package/template/docker-compose.yml +8 -0
  83. package/template/eslint.config.mjs +63 -0
  84. package/template/package.json +47 -0
  85. package/template/packages/auth/package.json +23 -0
  86. package/template/packages/auth/src/index.ts +9 -0
  87. package/template/packages/auth/src/supabase.test.ts +126 -0
  88. package/template/packages/auth/src/supabase.ts +65 -0
  89. package/template/packages/auth/src/types.ts +59 -0
  90. package/template/packages/auth/tsconfig.json +4 -0
  91. package/template/packages/cache/package.json +20 -0
  92. package/template/packages/cache/src/index.test.ts +67 -0
  93. package/template/packages/cache/src/index.ts +19 -0
  94. package/template/packages/cache/src/rate-limit.test.ts +52 -0
  95. package/template/packages/cache/src/rate-limit.ts +74 -0
  96. package/template/packages/cache/src/redis.ts +106 -0
  97. package/template/packages/cache/tsconfig.json +4 -0
  98. package/template/packages/core/package.json +17 -0
  99. package/template/packages/core/src/client-ip.test.ts +19 -0
  100. package/template/packages/core/src/client-ip.ts +11 -0
  101. package/template/packages/core/src/errors.test.ts +20 -0
  102. package/template/packages/core/src/errors.ts +20 -0
  103. package/template/packages/core/src/index.ts +4 -0
  104. package/template/packages/core/src/redirect.test.ts +27 -0
  105. package/template/packages/core/src/redirect.ts +20 -0
  106. package/template/packages/core/src/result.ts +10 -0
  107. package/template/packages/core/tsconfig.json +4 -0
  108. package/template/packages/db/drizzle/0000_initial.sql +10 -0
  109. package/template/packages/db/drizzle/meta/_journal.json +13 -0
  110. package/template/packages/db/drizzle.config.ts +9 -0
  111. package/template/packages/db/package.json +30 -0
  112. package/template/packages/db/scripts/load-env.ts +14 -0
  113. package/template/packages/db/scripts/migrate.ts +11 -0
  114. package/template/packages/db/scripts/seed.ts +14 -0
  115. package/template/packages/db/src/client.ts +22 -0
  116. package/template/packages/db/src/index.ts +4 -0
  117. package/template/packages/db/src/schema/index.ts +1 -0
  118. package/template/packages/db/src/schema/users.ts +14 -0
  119. package/template/packages/db/src/users.ts +16 -0
  120. package/template/packages/db/tsconfig.json +4 -0
  121. package/template/packages/storage/package.json +24 -0
  122. package/template/packages/storage/src/index.ts +1 -0
  123. package/template/packages/storage/src/s3.test.ts +86 -0
  124. package/template/packages/storage/src/s3.ts +86 -0
  125. package/template/packages/storage/src/supabase.ts +69 -0
  126. package/template/packages/storage/src/types.ts +18 -0
  127. package/template/packages/storage/tsconfig.json +4 -0
  128. package/template/packages/ui/components.json +21 -0
  129. package/template/packages/ui/package.json +32 -0
  130. package/template/packages/ui/src/components/badge.tsx +48 -0
  131. package/template/packages/ui/src/components/breadcrumb.tsx +102 -0
  132. package/template/packages/ui/src/components/button.tsx +57 -0
  133. package/template/packages/ui/src/components/card.tsx +87 -0
  134. package/template/packages/ui/src/components/input.tsx +19 -0
  135. package/template/packages/ui/src/components/label.tsx +19 -0
  136. package/template/packages/ui/src/components/separator.tsx +20 -0
  137. package/template/packages/ui/src/components/sheet.tsx +125 -0
  138. package/template/packages/ui/src/components/sidebar.tsx +692 -0
  139. package/template/packages/ui/src/components/skeleton.tsx +13 -0
  140. package/template/packages/ui/src/components/switch.tsx +31 -0
  141. package/template/packages/ui/src/components/table.tsx +88 -0
  142. package/template/packages/ui/src/components/tooltip.tsx +53 -0
  143. package/template/packages/ui/src/hooks/use-mobile.ts +19 -0
  144. package/template/packages/ui/src/lib/utils.ts +1 -0
  145. package/template/packages/ui/src/styles/globals.css +126 -0
  146. package/template/packages/ui/tsconfig.json +19 -0
  147. package/template/playwright.config.ts +19 -0
  148. package/template/pnpm-lock.yaml +3624 -0
  149. package/template/pnpm-workspace.yaml +3 -0
  150. package/template/scripts/start-standalone.mjs +37 -0
  151. package/template/tsconfig.base.json +16 -0
  152. package/template/turbo.json +17 -0
  153. package/template/vitest.config.ts +8 -0
  154. package/template.lock.json +142 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,6 @@
1
+ Clubedge Starter
2
+ Copyright 2026 Clubedge Digital Systems
3
+
4
+ This project is licensed under the Apache License, Version 2.0.
5
+ The license text is available in the LICENSE file and at
6
+ https://www.apache.org/licenses/LICENSE-2.0.
@@ -0,0 +1,27 @@
1
+ # GitHub launch checklist
2
+
3
+ This checklist is for repository maintainers preparing `clubedge-starter` for public use. The code changes alone cannot change GitHub repository visibility or security settings.
4
+
5
+ ## Before changing visibility
6
+
7
+ - [ ] Review the [README](README.md), [setup guide](SETUP.md), [Apache-2.0 license](LICENSE), and [NOTICE](NOTICE).
8
+ - [ ] Confirm `.env.local`, provider credentials, database dumps, and generated build output are not tracked. Only placeholder values belong in `.env.example`.
9
+ - [ ] Search the full Git history for credentials before making the repository public. Rotating a leaked credential does not remove it from history.
10
+ - [ ] Confirm the existing CI workflow passes on GitHub Actions for `main` and a pull request.
11
+ - [ ] Set a concise repository description and useful topics such as `nextjs`, `shadcn-ui`, `pnpm`, `drizzle-orm`, `supabase`, and `starter-kit`.
12
+
13
+ ## Recommended GitHub settings
14
+
15
+ - [ ] Change repository visibility to **Public** when the owner is ready to publish it.
16
+ - [ ] Enable private vulnerability reporting under **Settings → Security** so the SECURITY.md reporting link works.
17
+ - [ ] Protect `main` with pull requests and require the CI workflow to pass before merging.
18
+ - [ ] Keep repository permissions least-privileged and grant write access only to trusted maintainers.
19
+ - [ ] Decide whether to enable Discussions for support and design proposals; current support instructions use issues and pull requests.
20
+ - [ ] Add maintainers to `CODEOWNERS` only if review requests should be assigned automatically.
21
+
22
+ ## After publication
23
+
24
+ - [ ] Open the public README and setup links while signed out to confirm they are accessible.
25
+ - [ ] Verify the Actions badge and issue forms render correctly.
26
+ - [ ] Confirm the private vulnerability reporting path is available and points to the right repository.
27
+ - [ ] Announce the project with a clear note that it is a community starter and that adopters must review deployment security and provider policies.
@@ -0,0 +1,157 @@
1
+ # Clubedge Starter
2
+
3
+ [![CI](https://github.com/Clubedge/clubedge-starter/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Clubedge/clubedge-starter/actions/workflows/ci.yml)
4
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](LICENSE)
5
+
6
+ Clubedge Starter is a production-oriented, modular Next.js application foundation. It brings together a pnpm monorepo, shared shadcn/ui components, PostgreSQL access through Drizzle, Supabase Auth, optional Redis and storage adapters, and a working example dashboard. It provides engineering conventions and a reference implementation; review its security and deployment choices for your application before production use.
7
+
8
+ This is a starter, not a hosted service or a one-command app generator. Fork it or use it as a reference, then adapt the app and provider configuration to your project. Contributions and bug reports are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md). Repository maintainers can use [PUBLISHING.md](PUBLISHING.md) for the GitHub launch checklist.
9
+
10
+ ## Features
11
+
12
+ - Next.js App Router, React, TypeScript, Tailwind CSS 4, and shadcn/ui using Base UI primitives.
13
+ - pnpm workspaces and Turborepo, with the web app in `apps/web` and reusable UI source in `packages/ui`.
14
+ - Drizzle ORM and PostgreSQL schema, migrations, and seed commands.
15
+ - Supabase Auth using cookie based server clients from `@supabase/ssr`.
16
+ - S3 compatible storage (including Cloudflare R2) and Supabase Storage adapters.
17
+ - Optional Redis cache and fixed-window rate limiter using a standard Redis URL.
18
+ - Zod environment validation, security headers, structured errors, and `/api/health`.
19
+ - Docker support, GitHub Actions CI, Vitest, Playwright, ESLint, and Prettier.
20
+
21
+ ## Stack and provider choices
22
+
23
+ | Capability | Included choice | Other supported options |
24
+ | ----------------------- | ---------------------------------------------------- | --------------------------------------------------------------------- |
25
+ | Web app | Next.js App Router, React, TypeScript | — |
26
+ | UI | Tailwind CSS 4, shadcn/ui, and Base UI | Add or replace components in your app or shared UI package. |
27
+ | Database | PostgreSQL through Drizzle ORM | Any reachable PostgreSQL provider; Supabase PostgreSQL is documented. |
28
+ | Authentication | Supabase Auth with `@supabase/ssr` | No alternate auth adapter is currently included. |
29
+ | Cache and rate limiting | Optional Redis protocol client | Upstash, self-hosted Redis, or a compatible Redis service. |
30
+ | Object storage | S3-compatible adapter or Supabase Storage | AWS S3, Cloudflare R2, and other S3-compatible services. |
31
+ | Local runtime | Docker and Next.js standalone output | Run directly with Node.js during development. |
32
+ | Verification | Vitest, Playwright, ESLint, Prettier, GitHub Actions | — |
33
+
34
+ ## Architecture
35
+
36
+ ```mermaid
37
+ flowchart TB
38
+ Browser --> Next[Next.js application]
39
+ Next -->|auth interface and server sessions| Auth[Supabase Auth]
40
+ Next -->|Drizzle ORM| DB[(PostgreSQL)]
41
+ Next -->|optional cache and rate limits| Redis[(Redis)]
42
+ Next -->|storage interface| Storage{Storage provider}
43
+ Storage --> S3[S3-compatible storage: AWS S3, R2, MinIO]
44
+ Storage --> SupabaseStorage[Supabase Storage]
45
+ ```
46
+
47
+ Drizzle manages application data in PostgreSQL. Supabase Auth manages identity and sessions separately; it is not accessed through Drizzle. The PostgreSQL database may be Supabase PostgreSQL or another PostgreSQL provider.
48
+
49
+ ### Architecture principles
50
+
51
+ - **PostgreSQL is the source of truth for application data.** Drizzle centralizes application schema, queries, and migrations.
52
+ - **Authentication stays separate from application data.** Supabase Auth owns credentials and sessions; application tables are managed by Drizzle.
53
+ - **Infrastructure dependencies stay optional where practical.** Redis is only needed for distributed cache and rate limiting. Without Redis, the rate limiter falls back to a per-process memory window, which is suitable for a single server instance only.
54
+ - **Storage has a provider boundary.** Application code can use the storage interface with S3-compatible services or Supabase Storage; authorization and upload validation remain the caller's responsibility.
55
+ - **Shared packages are framework-agnostic.** Packages under `packages/` receive configuration and request cookies as arguments and never import Next.js, so another app (for example a TanStack Start app) can reuse them unchanged. ESLint enforces these boundaries.
56
+ - **One composition root per app.** `apps/web/src/server/` is the only place that reads environment variables and chooses providers. Routes, actions, and components call it rather than a provider SDK.
57
+ - **Keep the baseline focused.** Additional providers, queues, and generator tooling should be added when a real use case calls for them.
58
+
59
+ ## Quick start
60
+
61
+ ### Requirements
62
+
63
+ - Node.js 22.12 or newer (Node.js 22 LTS recommended).
64
+ - pnpm 10.9.0. The repository pins its package manager version using Corepack.
65
+ - PostgreSQL when using database features. A Supabase project can provide both PostgreSQL and Auth.
66
+
67
+ ### Install and run
68
+
69
+ ```sh
70
+ corepack enable
71
+ pnpm install
72
+ ```
73
+
74
+ Copy the example environment file to the web app's local environment file.
75
+
76
+ PowerShell:
77
+
78
+ ```powershell
79
+ Copy-Item .env.example apps/web/.env.local
80
+ ```
81
+
82
+ macOS/Linux:
83
+
84
+ ```sh
85
+ cp .env.example apps/web/.env.local
86
+ ```
87
+
88
+ Set `DATABASE_URL` in `apps/web/.env.local`. Supabase Auth is optional for exploring the UI; set `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` to enable it. See [SETUP.md](SETUP.md) for provider setup and optional integrations. Then start the app:
89
+
90
+ ```sh
91
+ pnpm dev
92
+ ```
93
+
94
+ Open <http://localhost:3000> for the landing page, <http://localhost:3000/dashboard> for the starter dashboard, or <http://localhost:3000/api/health> for the liveness endpoint. The pages render without connecting to providers. Database, authentication, storage, and Redis operations require their respective configuration.
95
+
96
+ ## Common commands
97
+
98
+ Run these from the repository root:
99
+
100
+ | Command | Purpose |
101
+ | ------------------- | ---------------------------------------------- |
102
+ | `pnpm dev` | Start the web app in development mode. |
103
+ | `pnpm build` | Create a production build. |
104
+ | `pnpm start` | Start the standalone production build. |
105
+ | `pnpm lint` | Run ESLint. |
106
+ | `pnpm typecheck` | Typecheck the workspaces. |
107
+ | `pnpm test` | Run Vitest. |
108
+ | `pnpm test:e2e` | Run Playwright browser checks. |
109
+ | `pnpm format` | Format supported repository files. |
110
+ | `pnpm format:check` | Check formatting without writing files. |
111
+ | `pnpm db:generate` | Generate Drizzle migrations from the schema. |
112
+ | `pnpm db:migrate` | Apply checked-in Drizzle migrations. |
113
+ | `pnpm db:push` | Push schema directly (local development only). |
114
+ | `pnpm db:studio` | Open Drizzle Studio. |
115
+ | `pnpm db:check` | Check migration consistency. |
116
+ | `pnpm db:seed` | Seed the configured database. |
117
+
118
+ Playwright's first run may require installing Chromium with `pnpm exec playwright install chromium`. CI runs the browser checks automatically.
119
+
120
+ ## Repository structure
121
+
122
+ ```text
123
+ apps/web/ Next.js app: routes, actions, UI, and the composition root
124
+ src/server/ Wires environment, cookies, and providers into the packages
125
+ packages/core/ Errors, Result type, and HTTP helpers (no dependencies)
126
+ packages/auth/ AuthProvider and CookieStore interfaces, Supabase adapter
127
+ packages/db/ Drizzle schema, client factory, migrations, and seed script
128
+ packages/storage/ StorageProvider interface, S3 and Supabase Storage adapters
129
+ packages/cache/ Rate limiters (memory and Redis) and Redis cache
130
+ packages/ui/ Shared shadcn/ui components, utilities, and global theme styles
131
+ .github/ CI workflow, issue forms, and pull request template
132
+ SETUP.md Detailed local and provider setup
133
+ CONTRIBUTING.md Contribution workflow and review expectations
134
+ SECURITY.md Vulnerability reporting guidance
135
+ ```
136
+
137
+ The project name, description, service identifier, and documentation links live in `apps/web/src/config/site.json`. Edit that file to rename the app; `create-clubedge-app` writes it for generated projects.
138
+
139
+ ## Shared UI components
140
+
141
+ The shared component package is `@clubedge/ui`. It uses the shadcn `base-nova` style, which generates components backed by `@base-ui/react` rather than Radix UI. The landing page and dashboard demonstrate the shared sidebar, breadcrumbs, theme switch, buttons, cards, badges, separators, inputs, labels, and tables. The light/dark theme preference is stored in the browser; dark mode uses a `#151515` page background and blue `#2563eb` primary color.
142
+
143
+ Add a component from the repository root using the web app's config:
144
+
145
+ ```sh
146
+ pnpm dlx shadcn@latest add badge -c apps/web
147
+ ```
148
+
149
+ Shared components are generated under `packages/ui/src/components` and can be imported from `@clubedge/ui/components/<component>`. The two `components.json` files intentionally share the `base-nova` style, neutral color base, Lucide icons, Tailwind v4 stylesheet, and RTL-aware generation setting. The app currently renders English in LTR; set the root document's `lang` and `dir` for the locale used by your application. Put app-only components in `apps/web/src/components`.
150
+
151
+ ## Contributing
152
+
153
+ Please read [CONTRIBUTING.md](CONTRIBUTING.md) before opening an issue or pull request. For local changes, run the relevant checks before submitting. You can report vulnerabilities privately using the process in [SECURITY.md](SECURITY.md).
154
+
155
+ ## License
156
+
157
+ Copyright © 2026 Clubedge Digital Systems. This project is licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,15 @@
1
+ # Security policy
2
+
3
+ ## Supported versions
4
+
5
+ Security fixes are made against the latest code on the `main` branch. This starter does not currently publish versioned releases or promise a support window for forks.
6
+
7
+ ## Report a vulnerability
8
+
9
+ Please do not report exploitable vulnerabilities in a public issue or pull request. Use GitHub's **Report a vulnerability** option in the repository's Security tab to send a private report. If private vulnerability reporting is unavailable, contact the repository owner through [their GitHub profile](https://github.com/Clubedge) and include enough detail to reproduce the issue safely.
10
+
11
+ Include the affected component or file, impact, reproduction steps or proof of concept, and any suggested mitigation. Please allow reasonable time for investigation and a fix before sharing details publicly. We will acknowledge reports and coordinate next steps through GitHub.
12
+
13
+ ## Secret exposure
14
+
15
+ If a credential was committed or exposed, revoke or rotate it with its provider immediately. Removing it from the latest commit does not invalidate it or remove it from Git history. Report the incident privately as described above.
@@ -0,0 +1,174 @@
1
+ # Setup guide
2
+
3
+ This guide covers local development and provider setup for Clubedge Starter. Start with the [README](README.md) for the architecture overview, then follow only the provider sections your project needs.
4
+
5
+ ## 1. Install the toolchain
6
+
7
+ Install Node.js 22.12 or newer, then enable Corepack and install pnpm dependencies from the repository root:
8
+
9
+ ```sh
10
+ corepack enable
11
+ pnpm install
12
+ ```
13
+
14
+ The root `package.json` pins pnpm 10.9.0 through its `packageManager` field. Use a compatible pnpm 10 release if Corepack is not available.
15
+
16
+ If pnpm reports that it ignored a package build script needed by your environment, review the package name and approve only the required dependency with `pnpm approve-builds`.
17
+
18
+ ## 2. Configure local environment
19
+
20
+ Copy `.env.example` to `apps/web/.env.local`.
21
+
22
+ PowerShell:
23
+
24
+ ```powershell
25
+ Copy-Item .env.example apps/web/.env.local
26
+ ```
27
+
28
+ macOS/Linux:
29
+
30
+ ```sh
31
+ cp .env.example apps/web/.env.local
32
+ ```
33
+
34
+ The example file leaves optional provider URLs and keys blank so the app can build and start without connecting to real services. At minimum, set `DATABASE_URL`; set the Supabase values when you want to use authentication.
35
+
36
+ Edit these values as needed:
37
+
38
+ | Variable | Required | Description |
39
+ | -------------------------------------- | ----------------- | -------------------------------------------------------------------------------------------------- |
40
+ | `DATABASE_URL` | Yes | PostgreSQL connection URL. Use a Supabase transaction pooler URL or another PostgreSQL connection. |
41
+ | `NEXT_PUBLIC_SUPABASE_URL` | For Supabase Auth | Project URL, such as `https://<project-ref>.supabase.co`. |
42
+ | `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` | For Supabase Auth | Supabase publishable key. This key is intended for the browser; never use a service role key here. |
43
+ | `NEXT_PUBLIC_APP_URL` | Recommended | The app's origin, defaulting to `http://localhost:3000`. |
44
+
45
+ `DATABASE_URL` must be a non-empty string for server environment validation. If you are only exploring the UI, you can use a local placeholder URL, but database operations will fail until it points to a real PostgreSQL database.
46
+
47
+ Start the development server:
48
+
49
+ ```sh
50
+ pnpm dev
51
+ ```
52
+
53
+ The app is available at <http://localhost:3000> and the liveness endpoint at <http://localhost:3000/api/health>.
54
+
55
+ ## 3. Configure Supabase Auth
56
+
57
+ Create or select a Supabase project. Set `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` from the project's API settings. For the database, use the transaction pooler URL when appropriate; the Postgres.js client is configured with `prepare: false` for compatibility with Supabase transaction pooling.
58
+
59
+ In Supabase Auth URL configuration, add this redirect URL for local email confirmation:
60
+
61
+ ```text
62
+ http://localhost:3000/auth/callback
63
+ ```
64
+
65
+ For deployed environments, add the corresponding `${NEXT_PUBLIC_APP_URL}/auth/callback` URL. The app uses the publishable key and validates users through its server auth adapter. Never expose a Supabase service role key to the client.
66
+
67
+ ## 4. Set up the database
68
+
69
+ Application tables are managed with Drizzle. Supabase Auth manages its own auth tables. Keep one migration source of truth for application tables: do not also create an independent Supabase migration history for those same tables.
70
+
71
+ From the repository root:
72
+
73
+ ```sh
74
+ pnpm db:check
75
+ pnpm db:generate
76
+ pnpm db:migrate
77
+ ```
78
+
79
+ `db:generate` creates migration files from `packages/db/src/schema` into `packages/db/drizzle`; review and commit those files. `db:migrate` applies committed migrations. `db:push` is available for local development, but do not use it as a production migration workflow. Use `pnpm db:seed` only against a database where seed data is appropriate. The database commands run in `packages/db` and read `DATABASE_URL` from `apps/web/.env.local`, so the project keeps one environment file.
80
+
81
+ ## 5. Configure optional services
82
+
83
+ ### Redis
84
+
85
+ Redis is optional. Set `REDIS_URL` to a TCP connection URL:
86
+
87
+ ```dotenv
88
+ REDIS_URL=rediss://default:<password>@<host>:6379
89
+ ```
90
+
91
+ Use `rediss://` for TLS connections such as Upstash and `redis://` for an unencrypted connection on a trusted network. Self-hosted Redis can use either scheme according to its TLS configuration. The app uses the standard Redis protocol and requires a Node.js runtime with outbound TCP access; this adapter is not for Edge runtimes that cannot open TCP connections.
92
+
93
+ When Redis is not configured, cache reads return a miss and `createRateLimiter()` falls back to an in-memory fixed window. Memory limits apply per server process, so configure Redis when you run several instances or serverless functions. Sign-in and sign-up attempts are limited to ten per minute per client address. Never commit a real Redis URL or password.
94
+
95
+ ### Object storage
96
+
97
+ Set `STORAGE_PROVIDER=s3` for AWS S3 or an S3-compatible provider such as Cloudflare R2. Configure `STORAGE_BUCKET`, `STORAGE_REGION`, `STORAGE_ENDPOINT` when required, and the access key, secret, and optional public URL. For R2, use the account's S3 API endpoint and region `auto`.
98
+
99
+ Set `STORAGE_PROVIDER=supabase` to select the Supabase Storage adapter and configure `SUPABASE_STORAGE_BUCKET`. This adapter uses the configured Supabase server client. Choose a bucket policy that matches your application's access model.
100
+
101
+ The storage adapter does not authorize users or validate uploads. Before calling it, the route or action must check ownership and authorization, file size, content type, and the object key. Keep credentials server side.
102
+
103
+ ## 6. Shared UI development
104
+
105
+ The repo uses matching `apps/web/components.json` and `packages/ui/components.json` files to direct the shadcn CLI into the shared `packages/ui` package. The selected `base-nova` style uses `@base-ui/react` primitives, not Radix UI. Tailwind CSS 4 and semantic theme tokens are defined in `packages/ui/src/styles/globals.css` and imported by the web app's root layout.
106
+
107
+ Generate a shared component from the repository root:
108
+
109
+ ```sh
110
+ pnpm dlx shadcn@latest add badge -c apps/web
111
+ ```
112
+
113
+ Shared components live in `packages/ui/src/components` and are imported from `@clubedge/ui/components/<component>`. Keep both `components.json` files aligned when changing the shadcn style, Tailwind CSS entry, base color, icon library, or RTL setting. The `rtl` setting makes newly generated components RTL-aware; set `lang` and `dir` on the root `<html>` element to match your application's actual locale. App-specific components belong in `apps/web/src/components`.
114
+
115
+ The root route is a public landing page; the reference dashboard is available at `/dashboard`. The dashboard uses the shared shadcn sidebar and breadcrumb. A light/dark switch is available in the landing page and dashboard navigation; its choice is saved in local storage and the initial theme follows the system preference until the user selects one. Theme colors are centralized in `packages/ui/src/styles/globals.css` (blue `#2563eb`, dark background `#151515`).
116
+
117
+ ## 7. Docker
118
+
119
+ Create `apps/web/.env.local` first. Start the development image with:
120
+
121
+ ```sh
122
+ pnpm docker:dev
123
+ ```
124
+
125
+ Build a production image and run it with:
126
+
127
+ ```sh
128
+ pnpm docker:build
129
+ pnpm docker:start
130
+ ```
131
+
132
+ The Docker image uses Next.js standalone output and runs as an unprivileged user. Ensure the configured database and provider hosts are reachable from the container.
133
+
134
+ ## 8. Checks
135
+
136
+ Run the checks relevant to your change before opening a pull request:
137
+
138
+ ```sh
139
+ pnpm lint
140
+ pnpm typecheck
141
+ pnpm test
142
+ pnpm format:check
143
+ pnpm build
144
+ ```
145
+
146
+ Browser checks use Playwright. Install Chromium once, then run `pnpm test:e2e`:
147
+
148
+ ```sh
149
+ pnpm exec playwright install chromium
150
+ pnpm test:e2e
151
+ ```
152
+
153
+ The Playwright configuration starts the local app with a placeholder database URL; browser scenarios should not require real provider credentials.
154
+
155
+ ## Before deploying
156
+
157
+ This repository is a starting point; review the security and operational choices for your application before production use:
158
+
159
+ - Set production environment variables through your hosting provider's secret manager. Use unique, rotated credentials and TLS for external connections.
160
+ - Set `NEXT_PUBLIC_APP_URL` to the deployed origin and add its `/auth/callback` URL to Supabase's allowed redirect URLs.
161
+ - Make authenticated server routes call `getCurrentUser()` or `requireUser()` from `@/server/auth` (the latter throws a 401 `AppError`), and protect pages with `getPageUser(pathname)`, which redirects signed-out visitors to `/login`. Do not treat cookie contents alone as proof of identity.
162
+ - Authorize storage access and validate upload size, content type, and object ownership in the route or action before using the storage adapter.
163
+ - Configure Redis for rate limiting when you deploy more than one instance; the in-memory fallback does not share counts between instances. Client addresses come from `x-forwarded-for`, so deploy behind a proxy that sets it.
164
+ - Configure and verify a restrictive Content Security Policy for the scripts and asset origins used by your deployment. A generic policy is not included because it can break framework tooling and project-specific assets.
165
+ - Review database migration and backup procedures, provider access policies, and application-specific error handling.
166
+
167
+ ## Troubleshooting
168
+
169
+ - **Environment validation fails:** confirm you copied the example to `apps/web/.env.local` and set `DATABASE_URL`.
170
+ - **Auth redirects fail:** add the exact local or deployed `/auth/callback` URL to Supabase Auth's allowed redirect URLs.
171
+ - **Database connection fails:** check the URL, network access, and whether your provider expects a transaction pooler. Keep `prepare: false` for the current Supabase pooler setup.
172
+ - **Redis cannot connect:** check that the URL uses `redis://` or `rediss://`, credentials are current, and outbound TCP access is allowed.
173
+ - **Playwright cannot find Chromium:** run `pnpm exec playwright install chromium`.
174
+ - **A package file appears missing after an offline install:** retry with a normal registry-backed `pnpm install`; an incomplete local package cache can satisfy offline resolution while leaving package contents incomplete.
@@ -0,0 +1,8 @@
1
+ # Getting help
2
+
3
+ - For installation and provider configuration, start with [SETUP.md](SETUP.md).
4
+ - For defects, search existing issues and then open a bug report using the repository issue form.
5
+ - For improvements, open a feature request or a discussion issue describing the use case before starting a large change.
6
+ - For security vulnerabilities, use the private process in [SECURITY.md](SECURITY.md); do not post exploit details publicly.
7
+
8
+ This is a community-maintained starter project. It does not currently offer paid support or response-time guarantees.
@@ -0,0 +1,13 @@
1
+ node_modules/
2
+ .pnpm-store/
3
+ .turbo/
4
+ .next/
5
+ out/
6
+ build/
7
+ coverage/
8
+ playwright-report/
9
+ test-results/
10
+ .env*
11
+ !.env.example
12
+ !.env.test.example
13
+ *.tsbuildinfo
@@ -0,0 +1,9 @@
1
+ <!-- BEGIN:nextjs-agent-rules -->
2
+
3
+ ## This is NOT the Next.js you know
4
+
5
+ This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.
6
+
7
+ This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.
8
+
9
+ <!-- END:nextjs-agent-rules -->
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "base-nova",
4
+ "rsc": true,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "",
8
+ "css": "../../packages/ui/src/styles/globals.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true
11
+ },
12
+ "aliases": {
13
+ "components": "@/components",
14
+ "utils": "@clubedge/ui/lib/utils",
15
+ "ui": "@clubedge/ui/components",
16
+ "lib": "@/lib",
17
+ "hooks": "@/hooks"
18
+ },
19
+ "iconLibrary": "lucide",
20
+ "rtl": true
21
+ }