bsmnt 0.2.9 → 0.2.10

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 (153) hide show
  1. package/README.md +84 -146
  2. package/package.json +2 -2
  3. package/src/templates/next-default/README.md +28 -199
  4. package/src/templates/next-default/app/layout.tsx +2 -3
  5. package/src/templates/next-default/biome.json +1 -14
  6. package/src/templates/next-default/components/layout/theme/index.tsx +2 -5
  7. package/src/templates/next-default/components/layout/wrapper/index.tsx +1 -2
  8. package/src/templates/next-default/components/ui/README.md +2 -3
  9. package/src/templates/next-default/components/ui/image/index.tsx +3 -3
  10. package/src/templates/next-default/lib/README.md +3 -3
  11. package/src/templates/next-default/lib/hooks/use-device-detection.ts +3 -2
  12. package/src/templates/next-default/lib/hooks/use-media-breakpoint.ts +10 -3
  13. package/src/templates/next-default/lib/scripts/dev.ts +9 -29
  14. package/src/templates/next-default/lib/styles/README.md +7 -58
  15. package/src/templates/next-default/lib/styles/fonts.ts +7 -15
  16. package/src/templates/next-default/lib/styles/global.css +198 -0
  17. package/src/templates/next-default/lib/styles/index.css +3 -0
  18. package/src/templates/next-default/lib/styles/tokens.css +179 -0
  19. package/src/templates/next-default/lib/utils/global-css.d.ts +1 -0
  20. package/src/templates/next-default/lib/utils/viewport.ts +11 -5
  21. package/src/templates/next-default/next.config.ts +0 -1
  22. package/src/templates/next-default/package.json +10 -17
  23. package/src/templates/next-default/postcss.config.mjs +0 -14
  24. package/src/templates/next-default/tsconfig.tsbuildinfo +1 -0
  25. package/src/templates/next-experiments/README.md +29 -200
  26. package/src/templates/next-experiments/app/layout.tsx +2 -3
  27. package/src/templates/next-experiments/app/page.tsx +46 -39
  28. package/src/templates/next-experiments/biome.json +1 -14
  29. package/src/templates/next-experiments/components/layout/theme/index.tsx +2 -5
  30. package/src/templates/next-experiments/components/layout/wrapper/index.tsx +1 -2
  31. package/src/templates/next-experiments/components/ui/README.md +2 -3
  32. package/src/templates/next-experiments/components/ui/image/index.tsx +3 -2
  33. package/src/templates/next-experiments/lib/README.md +3 -3
  34. package/src/templates/next-experiments/lib/hooks/use-device-detection.ts +3 -2
  35. package/src/templates/next-experiments/lib/hooks/use-media-breakpoint.ts +10 -3
  36. package/src/templates/next-experiments/lib/scripts/dev.ts +9 -29
  37. package/src/templates/next-experiments/lib/styles/README.md +7 -58
  38. package/src/templates/next-experiments/lib/styles/fonts.ts +7 -15
  39. package/src/templates/next-experiments/lib/styles/global.css +198 -0
  40. package/src/templates/next-experiments/lib/styles/index.css +3 -0
  41. package/src/templates/next-experiments/lib/styles/tokens.css +179 -0
  42. package/src/templates/next-experiments/lib/utils/global-css.d.ts +1 -0
  43. package/src/templates/next-experiments/lib/utils/viewport.ts +11 -5
  44. package/src/templates/next-experiments/next.config.ts +0 -1
  45. package/src/templates/next-experiments/package.json +10 -21
  46. package/src/templates/next-experiments/postcss.config.mjs +0 -14
  47. package/src/templates/next-experiments/tsconfig.tsbuildinfo +1 -0
  48. package/src/templates/next-webgl/README.md +30 -200
  49. package/src/templates/next-webgl/app/layout.tsx +2 -3
  50. package/src/templates/next-webgl/biome.json +1 -14
  51. package/src/templates/next-webgl/components/layout/theme/index.tsx +2 -5
  52. package/src/templates/next-webgl/components/layout/wrapper/index.tsx +1 -2
  53. package/src/templates/next-webgl/components/ui/README.md +2 -3
  54. package/src/templates/next-webgl/components/ui/image/index.tsx +3 -3
  55. package/src/templates/next-webgl/lib/README.md +3 -3
  56. package/src/templates/next-webgl/lib/hooks/use-device-detection.ts +3 -2
  57. package/src/templates/next-webgl/lib/hooks/use-media-breakpoint.ts +10 -3
  58. package/src/templates/next-webgl/lib/scripts/dev.ts +9 -29
  59. package/src/templates/next-webgl/lib/styles/README.md +7 -58
  60. package/src/templates/next-webgl/lib/styles/fonts.ts +7 -15
  61. package/src/templates/next-webgl/lib/styles/global.css +198 -0
  62. package/src/templates/next-webgl/lib/styles/index.css +3 -0
  63. package/src/templates/next-webgl/lib/styles/tokens.css +179 -0
  64. package/src/templates/next-webgl/lib/utils/global-css.d.ts +1 -0
  65. package/src/templates/next-webgl/lib/utils/viewport.ts +11 -5
  66. package/src/templates/next-webgl/next.config.ts +0 -1
  67. package/src/templates/next-webgl/package.json +10 -19
  68. package/src/templates/next-webgl/postcss.config.mjs +0 -14
  69. package/src/templates/next-webgl/tsconfig.tsbuildinfo +1 -0
  70. package/src/templates/next-default/components/ui/image/image.module.css +0 -5
  71. package/src/templates/next-default/lib/scripts/generate-component.ts +0 -322
  72. package/src/templates/next-default/lib/scripts/generate-page.ts +0 -193
  73. package/src/templates/next-default/lib/scripts/generate.ts +0 -79
  74. package/src/templates/next-default/lib/store/app.ts +0 -11
  75. package/src/templates/next-default/lib/store/index.ts +0 -11
  76. package/src/templates/next-default/lib/styles/colors.ts +0 -63
  77. package/src/templates/next-default/lib/styles/config.ts +0 -34
  78. package/src/templates/next-default/lib/styles/css/global.css +0 -85
  79. package/src/templates/next-default/lib/styles/css/index.css +0 -6
  80. package/src/templates/next-default/lib/styles/css/reset.css +0 -166
  81. package/src/templates/next-default/lib/styles/css/root.css +0 -68
  82. package/src/templates/next-default/lib/styles/css/tailwind.css +0 -132
  83. package/src/templates/next-default/lib/styles/easings.ts +0 -21
  84. package/src/templates/next-default/lib/styles/index.ts +0 -12
  85. package/src/templates/next-default/lib/styles/layout.mjs +0 -27
  86. package/src/templates/next-default/lib/styles/scripts/README.md +0 -29
  87. package/src/templates/next-default/lib/styles/scripts/generate-root.ts +0 -57
  88. package/src/templates/next-default/lib/styles/scripts/generate-tailwind.ts +0 -162
  89. package/src/templates/next-default/lib/styles/scripts/postcss-functions.mjs +0 -168
  90. package/src/templates/next-default/lib/styles/scripts/setup-styles.ts +0 -24
  91. package/src/templates/next-default/lib/styles/scripts/utils.ts +0 -20
  92. package/src/templates/next-default/lib/styles/typography.ts +0 -36
  93. package/src/templates/next-default/lib/utils/css.d.ts +0 -21
  94. package/src/templates/next-default/lib/utils/math.test.ts +0 -221
  95. package/src/templates/next-default/lib/utils/strings.test.ts +0 -166
  96. package/src/templates/next-default/lib/utils/viewport.test.ts +0 -256
  97. package/src/templates/next-default/public/fonts/geist/Geist-Mono.woff2 +0 -0
  98. package/src/templates/next-experiments/components/ui/image/image.module.css +0 -5
  99. package/src/templates/next-experiments/lib/scripts/generate-component.ts +0 -322
  100. package/src/templates/next-experiments/lib/scripts/generate-page.ts +0 -193
  101. package/src/templates/next-experiments/lib/scripts/generate.ts +0 -79
  102. package/src/templates/next-experiments/lib/store/app.ts +0 -11
  103. package/src/templates/next-experiments/lib/store/index.ts +0 -11
  104. package/src/templates/next-experiments/lib/styles/colors.ts +0 -63
  105. package/src/templates/next-experiments/lib/styles/config.ts +0 -34
  106. package/src/templates/next-experiments/lib/styles/css/global.css +0 -85
  107. package/src/templates/next-experiments/lib/styles/css/index.css +0 -6
  108. package/src/templates/next-experiments/lib/styles/css/reset.css +0 -166
  109. package/src/templates/next-experiments/lib/styles/css/root.css +0 -68
  110. package/src/templates/next-experiments/lib/styles/css/tailwind.css +0 -132
  111. package/src/templates/next-experiments/lib/styles/easings.ts +0 -21
  112. package/src/templates/next-experiments/lib/styles/index.ts +0 -12
  113. package/src/templates/next-experiments/lib/styles/layout.mjs +0 -27
  114. package/src/templates/next-experiments/lib/styles/scripts/README.md +0 -29
  115. package/src/templates/next-experiments/lib/styles/scripts/generate-root.ts +0 -57
  116. package/src/templates/next-experiments/lib/styles/scripts/generate-tailwind.ts +0 -162
  117. package/src/templates/next-experiments/lib/styles/scripts/postcss-functions.mjs +0 -168
  118. package/src/templates/next-experiments/lib/styles/scripts/setup-styles.ts +0 -24
  119. package/src/templates/next-experiments/lib/styles/scripts/utils.ts +0 -20
  120. package/src/templates/next-experiments/lib/styles/typography.ts +0 -36
  121. package/src/templates/next-experiments/lib/utils/css.d.ts +0 -21
  122. package/src/templates/next-experiments/lib/utils/math.test.ts +0 -221
  123. package/src/templates/next-experiments/lib/utils/strings.test.ts +0 -166
  124. package/src/templates/next-experiments/lib/utils/viewport.test.ts +0 -256
  125. package/src/templates/next-experiments/public/fonts/geist/Geist-Mono.woff2 +0 -0
  126. package/src/templates/next-webgl/components/ui/image/image.module.css +0 -5
  127. package/src/templates/next-webgl/lib/scripts/generate-component.ts +0 -322
  128. package/src/templates/next-webgl/lib/scripts/generate-page.ts +0 -193
  129. package/src/templates/next-webgl/lib/scripts/generate.ts +0 -79
  130. package/src/templates/next-webgl/lib/store/app.ts +0 -11
  131. package/src/templates/next-webgl/lib/store/index.ts +0 -11
  132. package/src/templates/next-webgl/lib/styles/colors.ts +0 -63
  133. package/src/templates/next-webgl/lib/styles/config.ts +0 -34
  134. package/src/templates/next-webgl/lib/styles/css/global.css +0 -85
  135. package/src/templates/next-webgl/lib/styles/css/index.css +0 -6
  136. package/src/templates/next-webgl/lib/styles/css/reset.css +0 -166
  137. package/src/templates/next-webgl/lib/styles/css/root.css +0 -68
  138. package/src/templates/next-webgl/lib/styles/css/tailwind.css +0 -132
  139. package/src/templates/next-webgl/lib/styles/easings.ts +0 -21
  140. package/src/templates/next-webgl/lib/styles/index.ts +0 -12
  141. package/src/templates/next-webgl/lib/styles/layout.mjs +0 -27
  142. package/src/templates/next-webgl/lib/styles/scripts/README.md +0 -29
  143. package/src/templates/next-webgl/lib/styles/scripts/generate-root.ts +0 -57
  144. package/src/templates/next-webgl/lib/styles/scripts/generate-tailwind.ts +0 -162
  145. package/src/templates/next-webgl/lib/styles/scripts/postcss-functions.mjs +0 -168
  146. package/src/templates/next-webgl/lib/styles/scripts/setup-styles.ts +0 -24
  147. package/src/templates/next-webgl/lib/styles/scripts/utils.ts +0 -20
  148. package/src/templates/next-webgl/lib/styles/typography.ts +0 -36
  149. package/src/templates/next-webgl/lib/utils/css.d.ts +0 -21
  150. package/src/templates/next-webgl/lib/utils/math.test.ts +0 -221
  151. package/src/templates/next-webgl/lib/utils/strings.test.ts +0 -166
  152. package/src/templates/next-webgl/lib/utils/viewport.test.ts +0 -256
  153. package/src/templates/next-webgl/public/fonts/geist/Geist-Mono.woff2 +0 -0
package/README.md CHANGED
@@ -1,137 +1,65 @@
1
- # bsmnt `0.2.9`
1
+ # bsmnt
2
2
 
3
- Your project starts here. One command to go from zero to a fully configured Next.js project with our stack, CMS, agent skills, and everything wired up.
3
+ <a href="https://basement.studio"><img alt="basement.studio logo" src="https://img.shields.io/badge/MADE%20BY%20basement.studio-000000.svg?style=for-the-badge&labelColor=000"></a>
4
+ <a href="https://www.npmjs.com/package/bsmnt"><img alt="NPM version" src="https://img.shields.io/npm/v/bsmnt.svg?style=for-the-badge&labelColor=000000"></a>
5
+ <a href="https://github.com/basementstudio/basement-cli"><img alt="License" src="https://img.shields.io/npm/l/bsmnt.svg?style=for-the-badge&labelColor=000000"></a>
4
6
 
5
- ```bash
6
- bsmnt
7
- ```
8
-
9
- ## What's in 1.0
10
-
11
- ### Instant project scaffolding from templates
12
-
13
- Spin up a new project based on the stack we actually use. Pick a template, answer a few prompts, and you're running.
14
-
15
- | Template | What you get |
16
- |----------|-------------|
17
- | **Default** | Next.js 16 + React 19 + Tailwind v4 + Biome + Zustand |
18
- | **WebGL** | + React Three Fiber + Three.js + optional WebGPU renderer toggle |
19
- | **Experiment** | + Creative coding setup with navigation UI |
7
+ `bsmnt` is a CLI for scaffolding basement projects, adding integrations, and installing optional hooks and agent setup.
20
8
 
21
- Every template ships with TypeScript strict mode, React Compiler, Turbopack, PostCSS functions (`tovw`, `torem`, `columns`), component generation scripts, and the full `lib/` architecture.
9
+ ## Overview
22
10
 
23
- ### Full Sanity integration code and infrastructure
11
+ - Scaffold new projects from basement starter templates
12
+ - Add Sanity to an existing project
13
+ - Copy optional hooks into an existing codebase
14
+ - Set up supported agent tooling
24
15
 
25
- Not just boilerplate files. The CLI sets up your entire Sanity stack:
16
+ ## Templates
26
17
 
27
- - Embedded Studio at `/studio` with schemas, structure builder, and live preview
28
- - GROQ queries with TypeScript type generation
29
- - Draft mode with visual editing
30
- - API routes for revalidation webhooks
31
- - `.env.local` with all credentials
18
+ | Template | Includes |
19
+ | --- | --- |
20
+ | Default | Next.js, React, TypeScript, Tailwind, Biome, and Zustand |
21
+ | WebGPU | Default stack plus React Three Fiber, Three.js, and 3D/WebGPU-ready setup |
22
+ | Experiment | Default stack plus creative coding utilities and navigation UI |
32
23
 
33
- **Automated project creation** — The CLI creates a Sanity project on your dashboard, generates API tokens, and wires everything into your repo. If you're not logged in, it opens `sanity login` inline — you never leave the terminal.
24
+ ## Install
34
25
 
35
- ### Add Sanity to existing projects
36
-
37
- Already have a project running? The `integrate` command injects Sanity into it. It detects your project structure (`app/` or `src/app/`) and smart-merges layout, sitemap, and integration files without overwriting your code.
38
-
39
- Real-world validated — this is how we integrated Sanity into the ROX project.
26
+ Run without installing:
40
27
 
41
28
  ```bash
42
- bsmnt integrate --sanity
43
- ```
44
-
45
- ### Agent skills out of the box
46
-
47
- Pick your agent (Claude Code or OpenCode) and the CLI installs curated skills so it understands our stack from the start:
48
-
49
- - React + Next.js performance patterns
50
- - Web design and accessibility guidelines
51
- - Frontend design standards
52
- - WebGPU/TSL guides (for WebGL and Experiment templates)
53
- - Sanity agent toolkit (when Sanity is selected)
54
-
55
- For Claude Code + Sanity, it also registers the Sanity MCP server automatically.
56
-
57
- ## Project Structure
58
-
59
- Single TypeScript package published as `bsmnt` on npm:
60
-
61
- ```
62
- src/
63
- ├── index.ts # Commander program, prompts, routing
64
- ├── paths.ts # Centralized path resolution
65
- ├── configs/animations.ts # GSAP / Motion dependency configs
66
- ├── helpers/
67
- │ ├── create/ # Project creation pipeline
68
- │ ├── integrate/ # CMS integration injection
69
- │ │ └── sanity/ # Sanity files, config, mergers
70
- │ └── add/ # Hook injection
71
- └── utils/ # detect-project, format-results
72
- templates/ # Standalone project templates
73
- template-hooks/ # Reusable React hooks
74
- plugins/ # Biome linting rules (Grit patterns)
29
+ npx bsmnt
30
+ bunx bsmnt
75
31
  ```
76
32
 
77
- ## (SOON) Installation
33
+ Install globally:
78
34
 
79
35
  ```bash
80
36
  npm install -g bsmnt
81
37
  ```
82
38
 
83
- For local development -- clone the repo and run:
84
-
85
- ```bash
86
- bun install
87
- npm link .
88
- ```
89
-
90
- ## Release Channels
91
-
92
- This repo follows a two-channel release model similar to the Next.js stable/canary approach, while keeping Changesets as the version source of truth.
93
-
94
- - `latest` (stable): production releases from the Changesets release PR flow.
95
- - `canary`: snapshot prereleases from `main` under npm dist-tag `canary` triggered manually.
96
-
97
- Install stable:
98
-
99
- ```bash
100
- npm install -g bsmnt@latest
101
- ```
39
+ ## Usage
102
40
 
103
- Install canary:
41
+ Create a new project:
104
42
 
105
43
  ```bash
106
- npm install -g bsmnt@canary
44
+ bsmnt
45
+ npx bsmnt
46
+ bunx bsmnt
107
47
  ```
108
48
 
109
- Verify dist-tags:
49
+ Add Sanity to an existing project:
110
50
 
111
51
  ```bash
112
- npm view bsmnt dist-tags
52
+ bsmnt integrate --sanity
53
+ npx bsmnt integrate --sanity
54
+ bunx bsmnt integrate --sanity
113
55
  ```
114
56
 
115
- How to trigger stable releases:
116
-
117
- 1. Add a changeset in your feature PR (`bun run changeset`).
118
- 2. Merge PR(s) into `main`.
119
- 3. GitHub Actions updates/opens the release PR with version/changelog changes.
120
- 4. Merge that release PR to publish to npm `latest`.
121
-
122
- How to trigger canary releases:
123
-
124
- 1. Add a changeset in your feature PR (`bun run changeset`).
125
- 2. Merge the PR into `main`.
126
- 3. In GitHub Actions, run `Canary Release` with `workflow_dispatch` on the `main` branch.
127
- 4. The workflow publishes snapshot builds to npm tag `canary` when pending changesets exist.
128
-
129
- ## Usage
130
-
131
- Interactive mode — answer prompts step by step:
57
+ Add hooks to an existing project:
132
58
 
133
59
  ```bash
134
- bsmnt
60
+ bsmnt add
61
+ npx bsmnt add
62
+ bunx bsmnt add
135
63
  ```
136
64
 
137
65
  Skip prompts with flags:
@@ -140,64 +68,74 @@ Skip prompts with flags:
140
68
  bsmnt create my-app --webgpu --sanity --gsap --claude --no-hooks
141
69
  ```
142
70
 
143
- Add Sanity to an existing project:
71
+ ## Command Summary
144
72
 
145
73
  ```bash
74
+ bsmnt
75
+ bsmnt create [project-name]
146
76
  bsmnt integrate --sanity
77
+ bsmnt add
78
+ bsmnt --help
147
79
  ```
148
80
 
149
- ## All Flags
81
+ ## Options
150
82
 
151
- ```
152
- bsmnt [command]
83
+ ### Global
153
84
 
154
- Commands:
155
- create|c [project-name] Create a new project
156
- integrate|i Add CMS integration to existing project
157
- add|a Add hooks to an existing project
85
+ | Option | Description |
86
+ | --- | --- |
87
+ | `-h, --help` | Show help |
88
+ | `-V, --version` | Show the CLI version |
158
89
 
159
- Templates:
160
- -d, --default Next.js starter
161
- --webgpu Three.js/WebGPU starter
162
- --experiment Creative coding
90
+ ### `create`
163
91
 
164
- CMS:
165
- --sanity Sanity CMS
166
- --no-cms No CMS
92
+ | Option | Description |
93
+ | --- | --- |
94
+ | `-d, --default` | Use the default template |
95
+ | `--webgpu` | Use the WebGPU template |
96
+ | `--webgl` | Deprecated alias for `--webgpu` |
97
+ | `--experiment` | Use the experiment template |
98
+ | `--sanity` | Add Sanity |
99
+ | `--no-cms` | Skip CMS setup |
100
+ | `--gsap` | Use GSAP |
101
+ | `--motion` | Use Motion |
102
+ | `--no-animation` | Skip animation setup |
103
+ | `--claude` | Set up Claude Code |
104
+ | `--opencode` | Set up OpenCode |
105
+ | `--cursor` | Set up Cursor |
106
+ | `--codex` | Set up Codex |
107
+ | `--gemini` | Set up Gemini CLI |
108
+ | `--no-agent` | Skip agent setup |
109
+ | `--no-hooks` | Skip hook selection |
167
110
 
168
- Animation:
169
- --gsap GSAP
170
- --motion Framer Motion
171
- --no-animation No animation library
111
+ ### `integrate`
172
112
 
173
- Agent:
174
- --claude Claude Code
175
- --opencode OpenCode
113
+ | Option | Description |
114
+ | --- | --- |
115
+ | `--sanity` | Add Sanity to the current project |
176
116
 
177
- Hooks:
178
- --no-hooks Skip hook selection
117
+ ### `add`
179
118
 
180
- Other:
181
- -h, --help Show help
182
- ```
119
+ No command-specific flags currently.
183
120
 
184
- ## Generated Project Commands
121
+ ## Templates
185
122
 
186
- ```bash
187
- bun dev # Dev server with Turbopack
188
- bun build # Production build
189
- bun lint # Biome linter
190
- bun lint:fix # Auto-fix lint issues
191
- bun typecheck # Type check with tsgo
192
- bun generate # Scaffold components/hooks
193
- bun analyze # Bundle size analysis
194
- ```
123
+ - Default
124
+ - WebGPU
125
+ - Experiment
126
+
127
+ ## Included Features
195
128
 
196
- With Sanity:
129
+ - Starter templates
130
+ - Optional Sanity integration
131
+ - Optional hooks
132
+ - Optional agent setup
133
+
134
+ ## Local Development
197
135
 
198
136
  ```bash
199
- bun sanity:extract # Extract Sanity schema
200
- bun sanity:typegen # Generate TS types from schema
137
+ bun install
138
+ npm link .
201
139
  ```
202
140
 
203
141
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bsmnt",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "packageManager": "bun@1.2.20",
5
5
  "description": "CLI to scaffold basement projects and add integrations",
6
6
  "type": "module",
@@ -30,7 +30,7 @@
30
30
  "lint": "biome check .",
31
31
  "lint:fix": "biome check --write .",
32
32
  "changeset": "changeset",
33
- "version-packages": "changeset version && node scripts/sync-readme-version.js",
33
+ "version-packages": "changeset version",
34
34
  "release": "changeset publish",
35
35
  "prepublishOnly": "rm -rf dist && bun run build",
36
36
  "default": "turbo run dev --filter=bsmnt-next-starter",
@@ -1,221 +1,50 @@
1
1
  # Basement Next Starter
2
2
 
3
- A production-ready Next.js starter with React 19, Tailwind CSS v4, TypeScript strict mode, and everything you need to build modern web applications.
4
-
5
- ## Tech Stack
6
-
7
- | Technology | Version | Description |
8
- |------------|---------|-------------|
9
- | Next.js | 16.1 | App Router, Turbopack |
10
- | React | 19 | React Compiler enabled |
11
- | TypeScript | 5.9 | Strict mode, `noUncheckedIndexedAccess` |
12
- | Tailwind CSS | 4 | CSS-first configuration |
13
- | Biome | 2.3 | Linting and formatting |
14
- | Bun | 1.3 | Package manager and runtime |
15
- | Zustand | 5.0 | State management |
3
+ Minimal Next.js starter with Tailwind CSS, TypeScript, and Basement defaults.
16
4
 
17
5
  ## Quick Start
18
6
 
19
7
  ```bash
20
- # Clone the template
21
- bunx degit basementstudio/next-starter my-project
22
-
23
- # Install dependencies
24
- cd my-project && bun install
25
-
26
- # Start development
8
+ bun install
27
9
  bun dev
28
10
  ```
29
11
 
30
- Open [http://localhost:3000](http://localhost:3000) to see the result.
31
-
32
12
  ## Scripts
33
13
 
34
14
  | Command | Description |
35
15
  |---------|-------------|
36
- | `bun dev` | Start development server with Turbopack |
37
- | `bun dev:https` | Start with HTTPS (for secure contexts) |
16
+ | `bun dev` | Start the development server |
17
+ | `bun dev:https` | Start the development server with HTTPS |
38
18
  | `bun build` | Build for production |
39
- | `bun start` | Start production server |
40
- | `bun generate` | Scaffold new components/hooks |
41
- | `bun lint` | Run Biome linter |
42
- | `bun lint:fix` | Fix lint issues |
43
- | `bun format` | Format code with Biome |
44
- | `bun typecheck` | Type check with tsgo |
45
- | `bun test` | Run tests with Bun |
46
- | `bun analyze` | Analyze bundle size |
19
+ | `bun start` | Start the production server |
20
+ | `bun lint` | Run Biome |
21
+ | `bun lint:fix` | Run Biome with fixes |
22
+ | `bun format` | Format the codebase |
23
+ | `bun typecheck` | Run TypeScript |
24
+ | `bun analyze` | Analyze the Next.js bundle |
47
25
 
48
26
  ## Project Structure
49
27
 
50
- ```
51
- app/ # Next.js App Router pages and routes
52
- ├── api/ # API routes (draft-mode, revalidate)
53
- ├── layout.tsx # Root layout with metadata, fonts
54
- ├── page.tsx # Homepage
55
- ├── sitemap.ts # Dynamic sitemap generation
56
- └── robots.ts # SEO robots.txt
57
-
28
+ ```txt
29
+ app/
58
30
  components/
59
- ├── layout/
60
- │ ├── header/ # Navigation header
61
- │ ├── footer/ # Page footer
62
- │ ├── wrapper/ # Page wrapper with theme
63
- │ └── theme/ # Theme context provider
64
- └── ui/
65
- ├── image/ # Enhanced Next.js Image wrapper
66
- └── link/ # Smart Link component
67
-
68
31
  lib/
69
- ├── hooks/ # Custom React hooks
70
- │ ├── use-device-detection/ # Device/capability detection
71
- │ ├── use-media-breakpoint/ # Responsive breakpoint hook
72
- │ └── use-prefetch/ # Prefetch utilities
73
- ├── integrations/ # Third-party integrations
74
- ├── scripts/ # Build and dev scripts
75
- ├── store/ # Zustand global state
76
- ├── styles/ # Design tokens, CSS config
77
- │ ├── colors.ts # Theme colors
78
- │ ├── layout.mjs # Breakpoints, grid, spacing
79
- │ ├── easings.ts # CSS easing variables
80
- │ └── fonts.ts # Font loading (Geist Mono)
81
- └── utils/ # Utility functions
82
- ├── easings.ts # 30+ animation easing functions
83
- ├── math.ts # Math utilities
84
- ├── strings.ts # String utilities
85
- └── fetch.ts # Fetch utilities
86
- ```
87
-
88
- ## Features
89
-
90
- ### Design System
91
-
92
- Pre-configured design tokens ready to use:
93
-
94
- **Breakpoints:**
95
- - `mobile`: 375px
96
- - `tablet`: 620px
97
- - `tablet-lg`: 1024px
98
- - `desktop`: 1440px
99
- - `desktop-large`: 1920px
100
-
101
- **Grid:**
102
- - Mobile: 4 columns
103
- - Desktop: 12 columns
104
- - Gap: 16px
105
-
106
- **Colors:**
107
- - Theme colors: `primary`, `secondary`, `contrast`
108
- - Accent colors: `red`, `blue`, `green`, `violet`, `pink`
109
- - Light/dark mode support
110
-
111
- **Easings:**
112
- 30+ easing functions (quad, cubic, quart, quint, sine, expo, circ, back, elastic, bounce)
113
-
114
- ### Smart Components
115
-
116
- **`<Image>`** - Enhanced Next.js Image wrapper:
117
- - Automatic responsive sizes based on breakpoints
118
- - Blur placeholder with shimmer effect
119
- - Preload support for LCP images
120
- - SVG handling
121
-
122
- **`<Link>`** - Intelligent link component:
123
- - Auto-detects external links (opens in new tab)
124
- - Connection-aware prefetching (4G only, respects data saver)
125
- - Falls back to button/div when no href
126
- - Active state detection
127
-
128
- **`<Wrapper>`** - Page layout component:
129
- - Includes Header and Footer
130
- - Theme provider integration
131
- - Flexible content area
132
-
133
- ### Theme Support
134
-
135
- Light/dark theme with CSS custom properties:
136
-
137
- ```tsx
138
- import { Wrapper } from "@/components/layout/wrapper"
139
-
140
- export default function Page() {
141
- return (
142
- <Wrapper theme="dark">
143
- <section>Your content</section>
144
- </Wrapper>
145
- )
146
- }
32
+ hooks/
33
+ integrations/
34
+ scripts/
35
+ store/
36
+ styles/
37
+ index.css
38
+ tokens.css
39
+ global.css
40
+ fonts.ts
41
+ cn.ts
42
+ utils/
147
43
  ```
148
44
 
149
- Access theme in components:
150
-
151
- ```tsx
152
- import { useTheme } from "@/components/layout/theme"
153
-
154
- function Component() {
155
- const { name, setThemeName } = useTheme()
156
- // ...
157
- }
158
- ```
159
-
160
- ### Performance Optimizations
161
-
162
- - **React Compiler** - Automatic memoization (no manual `useMemo`/`useCallback`)
163
- - **Turbopack** - Fast development builds
164
- - **Bundle Analyzer** - `bun analyze` to inspect bundle size
165
- - **Optimized Imports** - Auto-optimization for GSAP, Three.js, Lenis, Zustand
166
- - **Security Headers** - CSP, HSTS, XSS protection pre-configured
167
- - **Image Optimization** - AVIF, WebP with custom quality settings
168
-
169
- ### Developer Experience
170
-
171
- - **Component Scaffolding** - `bun generate` to create components/hooks
172
- - **HTTPS Dev Server** - `bun dev:https` for secure contexts
173
- - **Strict TypeScript** - `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`
174
- - **Biome** - Fast linting and formatting with custom rules
175
- - **Tests** - Bun test runner with utilities
176
-
177
- ## Configuration
178
-
179
- ### Styles
180
-
181
- Edit design tokens in `lib/styles/`:
182
-
183
- - `colors.ts` - Theme and accent colors
184
- - `layout.mjs` - Breakpoints, grid, spacing
185
- - `typography.ts` - Font definitions
186
- - `easings.ts` - CSS easing variables
187
-
188
- After editing, regenerate CSS:
189
-
190
- ```bash
191
- bun setup:styles
192
- ```
193
-
194
- ### Next.js
195
-
196
- Configuration in `next.config.ts`:
197
-
198
- - React Compiler enabled
199
- - Typed routes
200
- - SVG loader (@svgr/webpack)
201
- - Security headers
202
- - Image optimization settings
203
-
204
- ## Deployment
205
-
206
- ### Vercel (Recommended)
207
-
208
- [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/basementstudio/next-starter)
209
-
210
- ### Other Platforms
211
-
212
- ```bash
213
- bun build
214
- bun start
215
- ```
216
-
217
- The app runs on port 3000 by default.
218
-
219
- ## License
45
+ ## Styling
220
46
 
221
- MIT
47
+ - Import `@/lib/styles/index.css` once in `app/layout.tsx`.
48
+ - Edit `lib/styles/tokens.css` for theme variables, breakpoints, and custom Tailwind utilities.
49
+ - Edit `lib/styles/global.css` for reset rules and app-wide global styles.
50
+ - `lib/styles/fonts.ts` handles font variables.
@@ -2,10 +2,9 @@ import type { Metadata, Viewport } from "next";
2
2
  import { Geist } from "next/font/google";
3
3
  import { type PropsWithChildren, Suspense } from "react";
4
4
  import { Link } from "@/components/ui/link";
5
- import { themes } from "@/lib/styles/colors";
6
5
  import { fontsVariable } from "@/lib/styles/fonts";
7
6
  import AppData from "@/package.json";
8
- import "@/lib/styles/css/index.css";
7
+ import "@/lib/styles/index.css";
9
8
  import { cn } from "@/lib/styles/cn";
10
9
 
11
10
  const APP_NAME = AppData.name;
@@ -74,7 +73,7 @@ export const metadata: Metadata = {
74
73
 
75
74
  export const viewport: Viewport = {
76
75
  colorScheme: "normal",
77
- themeColor: themes.dark.primary,
76
+ themeColor: "#000000",
78
77
  };
79
78
 
80
79
  export default async function Layout({ children }: PropsWithChildren) {
@@ -214,20 +214,7 @@
214
214
  }
215
215
  },
216
216
  {
217
- "includes": ["**/*.module.css"],
218
- "linter": {
219
- "rules": {
220
- "correctness": {
221
- "noUnknownProperty": "off"
222
- },
223
- "style": {
224
- "noDescendingSpecificity": "off"
225
- }
226
- }
227
- }
228
- },
229
- {
230
- "includes": ["lib/styles/css/root.css"],
217
+ "includes": ["lib/styles/tokens.css"],
231
218
  "linter": {
232
219
  "rules": {
233
220
  "suspicious": {
@@ -2,16 +2,14 @@
2
2
 
3
3
  import { usePathname } from "next/navigation"
4
4
  import { createContext, useContext, useEffect, useState } from "react"
5
- import type { Themes } from "@/lib/styles/colors"
6
- import { type ThemeName, themes } from "@/lib/styles/config"
5
+
6
+ export type ThemeName = "light" | "dark"
7
7
 
8
8
  export const ThemeContext = createContext<{
9
9
  name: ThemeName
10
- theme: Themes[ThemeName]
11
10
  setThemeName: (theme: ThemeName) => void
12
11
  }>({
13
12
  name: "light",
14
- theme: themes.light,
15
13
  setThemeName: () => {
16
14
  void 0
17
15
  },
@@ -55,7 +53,6 @@ export function Theme({
55
53
  <ThemeContext.Provider
56
54
  value={{
57
55
  name: currentTheme,
58
- theme: themes[currentTheme],
59
56
  setThemeName: setCurrentTheme,
60
57
  }}
61
58
  >
@@ -6,8 +6,7 @@
6
6
  import cn from "clsx"
7
7
  import { Footer } from "@/components/layout/footer"
8
8
  import { Header } from "@/components/layout/header"
9
- import { Theme } from "@/components/layout/theme"
10
- import type { ThemeName } from "@/lib/styles/config"
9
+ import { Theme, type ThemeName } from "@/components/layout/theme"
11
10
 
12
11
  /**
13
12
  * Props for the Wrapper component.
@@ -65,9 +65,8 @@ import { Link } from '@/components/ui/link'
65
65
  <Link href="/about">Internal</Link>
66
66
  <Link href="https://example.com">External</Link>
67
67
 
68
- // ✅ CSS Modules + Tailwind
69
- import s from './component.module.css'
70
- <div className={cn(s.wrapper, 'flex items-center')} />
68
+ // ✅ Tailwind only
69
+ <div className="flex items-center" />
71
70
  ```
72
71
 
73
72
  ## Related
@@ -9,7 +9,8 @@
9
9
  import cn from "clsx"
10
10
  import NextImage, { type ImageProps as NextImageProps } from "next/image"
11
11
  import type { CSSProperties, Ref } from "react"
12
- import { breakpoints } from "@/lib/styles/config"
12
+
13
+ const DESKTOP_BREAKPOINT = 1440
13
14
 
14
15
  /**
15
16
  * Enhanced Image component props extending Next.js Image.
@@ -166,8 +167,7 @@ export function Image({
166
167
  }: ImageProps) {
167
168
  // Generate responsive sizes if not provided
168
169
  const finalSizes =
169
- sizes ||
170
- `(max-width: ${breakpoints.desktop}px) ${mobileSize}, ${desktopSize}`
170
+ sizes || `(max-width: ${DESKTOP_BREAKPOINT}px) ${mobileSize}, ${desktopSize}`
171
171
 
172
172
  // Early return after hooks
173
173
  if (!src) return null
@@ -27,7 +27,7 @@ import { colors, themes, breakpoints } from '@/lib/styles/config'
27
27
 
28
28
  ```bash
29
29
  bun dev # Start dev server
30
- bun run generate # Generate pages/components
31
- bun run setup:project # Configure integrations
32
- bun setup:styles # Regenerate CSS
30
+ bun build # Create production build
31
+ bun lint:fix # Fix lint issues
32
+ bun typecheck # Run type checks
33
33
  ```