@totaland/create-starter-kit 1.0.0 → 2.0.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.
- package/README.md +130 -18
- package/bin/index.js +109 -21
- package/package.json +2 -2
- package/templates/frontend/.env.example +7 -0
- package/templates/frontend/README.md +132 -0
- package/templates/frontend/RECOMMENDED_LIBRARIES.md +226 -0
- package/templates/frontend/SETUP_SUMMARY.md +162 -0
- package/templates/frontend/biome.json +47 -0
- package/templates/frontend/components.json +22 -0
- package/templates/frontend/index.html +13 -0
- package/templates/frontend/package.json +44 -0
- package/templates/frontend/postcss.config.js +6 -0
- package/templates/frontend/public/vite.svg +1 -0
- package/templates/frontend/src/App.css +42 -0
- package/templates/frontend/src/App.tsx +17 -0
- package/templates/frontend/src/assets/react.svg +1 -0
- package/templates/frontend/src/components/layout/Layout.tsx +31 -0
- package/templates/frontend/src/components/menu-toggle-icon.tsx +53 -0
- package/templates/frontend/src/components/ui/button.tsx +57 -0
- package/templates/frontend/src/hooks/use-scroll.ts +21 -0
- package/templates/frontend/src/index.css +121 -0
- package/templates/frontend/src/lib/api-client.ts +46 -0
- package/templates/frontend/src/lib/utils.ts +6 -0
- package/templates/frontend/src/main.tsx +30 -0
- package/templates/frontend/src/pages/about/AboutPage.tsx +50 -0
- package/templates/frontend/src/pages/home/HomePage.tsx +43 -0
- package/templates/frontend/tailwind.config.js +59 -0
- package/templates/frontend/tsconfig.app.json +41 -0
- package/templates/frontend/tsconfig.json +13 -0
- package/templates/frontend/tsconfig.node.json +26 -0
- package/templates/frontend/vite.config.ts +14 -0
- package/template/.env.example +0 -8
- /package/{template → templates/backend}/AGENTS.md +0 -0
- /package/{template → templates/backend}/ARCHITECTURE.md +0 -0
- /package/{template → templates/backend}/ORDER_SYSTEM.md +0 -0
- /package/{template → templates/backend}/biome.json +0 -0
- /package/{template → templates/backend}/drizzle.config.ts +0 -0
- /package/{template → templates/backend}/knip.json +0 -0
- /package/{template → templates/backend}/package.json +0 -0
- /package/{template → templates/backend}/playwright.config.ts +0 -0
- /package/{template → templates/backend}/pnpm-workspace.yaml +0 -0
- /package/{template → templates/backend}/src/features/health/controller.ts +0 -0
- /package/{template → templates/backend}/src/features/health/index.ts +0 -0
- /package/{template → templates/backend}/src/features/orders/controller.ts +0 -0
- /package/{template → templates/backend}/src/features/orders/index.ts +0 -0
- /package/{template → templates/backend}/src/index.ts +0 -0
- /package/{template → templates/backend}/tsconfig.build.json +0 -0
- /package/{template → templates/backend}/tsconfig.json +0 -0
- /package/{template → templates/backend}/vitest.config.ts +0 -0
package/README.md
CHANGED
|
@@ -1,42 +1,127 @@
|
|
|
1
|
-
# create-starter-kit
|
|
1
|
+
# @totaland/create-starter-kit
|
|
2
2
|
|
|
3
|
-
Scaffolding tool for creating new starter-kit projects.
|
|
3
|
+
Scaffolding tool for creating new starter-kit projects with a choice between backend and frontend templates.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- ✨ Interactive template selection (backend or frontend)
|
|
8
|
+
- 🎯 CLI argument support for automation
|
|
9
|
+
- 📦 Clean, production-ready templates
|
|
10
|
+
- 🚀 Quick project initialization
|
|
4
11
|
|
|
5
12
|
## Usage
|
|
6
13
|
|
|
7
|
-
###
|
|
14
|
+
### Interactive Mode (Recommended)
|
|
8
15
|
|
|
9
16
|
```bash
|
|
10
|
-
pnpm create starter-kit my-new-project
|
|
17
|
+
pnpm create @totaland/starter-kit my-new-project
|
|
11
18
|
```
|
|
12
19
|
|
|
13
|
-
|
|
20
|
+
You'll be prompted to select a template:
|
|
21
|
+
- **Backend** - Express.js + TypeScript + Drizzle ORM + Scalar API docs
|
|
22
|
+
- **Frontend** - React + Vite + TypeScript + Tailwind CSS v4 + shadcn/ui + TanStack Query
|
|
23
|
+
|
|
24
|
+
### With Template Argument
|
|
25
|
+
|
|
26
|
+
Skip the prompt by specifying the template:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Create backend project
|
|
30
|
+
pnpm create @totaland/starter-kit my-backend backend
|
|
31
|
+
|
|
32
|
+
# Create frontend project
|
|
33
|
+
pnpm create @totaland/starter-kit my-frontend frontend
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Alternative Package Managers
|
|
37
|
+
|
|
38
|
+
Using npm:
|
|
39
|
+
```bash
|
|
40
|
+
npm create @totaland/starter-kit@latest my-project
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Using yarn:
|
|
44
|
+
```bash
|
|
45
|
+
yarn create @totaland/starter-kit my-project
|
|
46
|
+
```
|
|
14
47
|
|
|
48
|
+
Using pnpm dlx:
|
|
15
49
|
```bash
|
|
16
|
-
pnpm dlx create-starter-kit my-
|
|
50
|
+
pnpm dlx @totaland/create-starter-kit my-project
|
|
17
51
|
```
|
|
18
52
|
|
|
19
|
-
|
|
53
|
+
## Templates
|
|
20
54
|
|
|
55
|
+
### Backend Template
|
|
56
|
+
|
|
57
|
+
**Tech Stack:**
|
|
58
|
+
- Express.js (via ultimate-express)
|
|
59
|
+
- TypeScript
|
|
60
|
+
- Drizzle ORM with PostgreSQL
|
|
61
|
+
- Scalar API documentation
|
|
62
|
+
- Biome for linting/formatting
|
|
63
|
+
- Vitest for testing
|
|
64
|
+
|
|
65
|
+
**Features:**
|
|
66
|
+
- 🏗️ Feature-based architecture
|
|
67
|
+
- 🔄 JSON-driven orchestration engine
|
|
68
|
+
- 📝 Comprehensive API documentation
|
|
69
|
+
- 🧪 Testing setup with Vitest
|
|
70
|
+
- 🗄️ Database migrations with Drizzle
|
|
71
|
+
|
|
72
|
+
**After Creation:**
|
|
73
|
+
```bash
|
|
74
|
+
cd my-backend
|
|
75
|
+
pnpm install
|
|
76
|
+
pnpm dev
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Frontend Template
|
|
80
|
+
|
|
81
|
+
**Tech Stack:**
|
|
82
|
+
- React 19
|
|
83
|
+
- Vite 7
|
|
84
|
+
- TypeScript
|
|
85
|
+
- Tailwind CSS v4
|
|
86
|
+
- shadcn/ui (component library)
|
|
87
|
+
- TanStack Query v5
|
|
88
|
+
- React Router v7
|
|
89
|
+
- Drizzle ORM
|
|
90
|
+
- Biome for linting/formatting
|
|
91
|
+
|
|
92
|
+
**Features:**
|
|
93
|
+
- 🎨 Modern UI with Tailwind CSS v4
|
|
94
|
+
- 🎯 shadcn/ui ready (add components via CLI)
|
|
95
|
+
- 🔄 TanStack Query for data fetching
|
|
96
|
+
- 🗺️ React Router for navigation
|
|
97
|
+
- 📱 Responsive layout examples
|
|
98
|
+
- 🌗 Dark mode support
|
|
99
|
+
|
|
100
|
+
**After Creation:**
|
|
21
101
|
```bash
|
|
22
|
-
|
|
102
|
+
cd my-frontend
|
|
103
|
+
pnpm install
|
|
104
|
+
pnpm dev
|
|
105
|
+
|
|
106
|
+
# Add shadcn/ui components
|
|
107
|
+
pnpm dlx shadcn@latest add button card dialog
|
|
23
108
|
```
|
|
24
109
|
|
|
25
|
-
## What
|
|
110
|
+
## What It Does
|
|
26
111
|
|
|
27
|
-
1. Creates a new directory with your project name
|
|
28
|
-
2. Copies the
|
|
29
|
-
3. Updates the `package.json` name field to match your project name
|
|
30
|
-
4. Provides next steps for installation and running the project
|
|
112
|
+
1. ✅ Creates a new directory with your project name
|
|
113
|
+
2. ✅ Copies the selected template (backend or frontend)
|
|
114
|
+
3. ✅ Updates the `package.json` name field to match your project name
|
|
115
|
+
4. ✅ Provides next steps for installation and running the project
|
|
31
116
|
|
|
32
117
|
## Local Development
|
|
33
118
|
|
|
34
119
|
To test this locally before publishing:
|
|
35
120
|
|
|
36
|
-
1.
|
|
121
|
+
1. Make sure templates are up to date:
|
|
37
122
|
```bash
|
|
38
|
-
cd /path/to/starter-kit
|
|
39
|
-
./
|
|
123
|
+
cd /path/to/starter-kit/create-starter-kit
|
|
124
|
+
# Templates are in ./templates/backend and ./templates/frontend
|
|
40
125
|
```
|
|
41
126
|
|
|
42
127
|
2. Link the package globally:
|
|
@@ -48,7 +133,12 @@ To test this locally before publishing:
|
|
|
48
133
|
3. Test it:
|
|
49
134
|
```bash
|
|
50
135
|
cd /tmp
|
|
51
|
-
pnpm create starter-kit test-project
|
|
136
|
+
pnpm create @totaland/starter-kit test-project
|
|
137
|
+
# Select a template when prompted
|
|
138
|
+
|
|
139
|
+
# Or specify template directly
|
|
140
|
+
pnpm create @totaland/starter-kit test-backend backend
|
|
141
|
+
pnpm create @totaland/starter-kit test-frontend frontend
|
|
52
142
|
```
|
|
53
143
|
|
|
54
144
|
## Publishing
|
|
@@ -62,5 +152,27 @@ pnpm publish
|
|
|
62
152
|
|
|
63
153
|
Once published, anyone can use:
|
|
64
154
|
```bash
|
|
65
|
-
pnpm create starter-kit my-project
|
|
155
|
+
pnpm create @totaland/starter-kit my-project
|
|
66
156
|
```
|
|
157
|
+
|
|
158
|
+
## Project Structure
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
create-starter-kit/
|
|
162
|
+
├── bin/
|
|
163
|
+
│ └── index.js # CLI entry point
|
|
164
|
+
├── templates/
|
|
165
|
+
│ ├── backend/ # Backend template files
|
|
166
|
+
│ └── frontend/ # Frontend template files
|
|
167
|
+
├── package.json
|
|
168
|
+
└── README.md
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Requirements
|
|
172
|
+
|
|
173
|
+
- Node.js 18+
|
|
174
|
+
- pnpm (recommended) or npm/yarn
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
MIT
|
package/bin/index.js
CHANGED
|
@@ -1,26 +1,53 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
copyFileSync,
|
|
5
|
+
mkdirSync,
|
|
6
|
+
readFileSync,
|
|
7
|
+
writeFileSync,
|
|
8
|
+
readdirSync,
|
|
9
|
+
existsSync,
|
|
10
|
+
} from 'node:fs';
|
|
4
11
|
import { dirname, join, resolve } from 'node:path';
|
|
5
12
|
import { fileURLToPath } from 'node:url';
|
|
13
|
+
import * as readline from 'node:readline/promises';
|
|
6
14
|
|
|
7
15
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
16
|
|
|
9
17
|
// Get the project name from command line arguments
|
|
10
18
|
const projectName = process.argv[2];
|
|
19
|
+
const templateArg = process.argv[3]; // Optional template argument
|
|
11
20
|
|
|
12
21
|
if (!projectName) {
|
|
13
22
|
console.error('Error: Please provide a project name');
|
|
14
|
-
console.log('Usage: pnpm create starter-kit <project-name>');
|
|
23
|
+
console.log('Usage: pnpm create @totaland/starter-kit <project-name> [template]');
|
|
24
|
+
console.log('Templates: backend, frontend');
|
|
15
25
|
process.exit(1);
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
// Resolve paths
|
|
19
|
-
const
|
|
29
|
+
const templatesDir = resolve(__dirname, '../templates');
|
|
20
30
|
const targetDir = resolve(process.cwd(), projectName);
|
|
21
31
|
|
|
22
|
-
|
|
23
|
-
|
|
32
|
+
// Check if target directory already exists
|
|
33
|
+
if (existsSync(targetDir)) {
|
|
34
|
+
console.error(`Error: Directory "${projectName}" already exists`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Available templates
|
|
39
|
+
const TEMPLATES = {
|
|
40
|
+
backend: {
|
|
41
|
+
name: 'Backend',
|
|
42
|
+
description: 'Express.js backend with TypeScript, Drizzle ORM, and Scalar API docs',
|
|
43
|
+
dir: 'backend',
|
|
44
|
+
},
|
|
45
|
+
frontend: {
|
|
46
|
+
name: 'Frontend',
|
|
47
|
+
description: 'React + Vite with TypeScript, Tailwind CSS v4, shadcn/ui, and TanStack Query',
|
|
48
|
+
dir: 'frontend',
|
|
49
|
+
},
|
|
50
|
+
};
|
|
24
51
|
|
|
25
52
|
// Function to recursively copy directory
|
|
26
53
|
function copyDir(src, dest) {
|
|
@@ -40,25 +67,86 @@ function copyDir(src, dest) {
|
|
|
40
67
|
}
|
|
41
68
|
}
|
|
42
69
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
70
|
+
// Function to prompt for template selection
|
|
71
|
+
async function promptTemplate() {
|
|
72
|
+
const rl = readline.createInterface({
|
|
73
|
+
input: process.stdin,
|
|
74
|
+
output: process.stdout,
|
|
75
|
+
});
|
|
46
76
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
77
|
+
console.log('\n📦 Select a template:\n');
|
|
78
|
+
console.log('1. Backend - Express.js + TypeScript + Drizzle ORM');
|
|
79
|
+
console.log('2. Frontend - React + Vite + Tailwind CSS v4 + shadcn/ui\n');
|
|
50
80
|
|
|
51
|
-
|
|
81
|
+
const answer = await rl.question('Enter your choice (1 or 2): ');
|
|
82
|
+
rl.close();
|
|
52
83
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
console.log(' pnpm dev');
|
|
84
|
+
if (answer === '1' || answer.toLowerCase() === 'backend') {
|
|
85
|
+
return 'backend';
|
|
86
|
+
}
|
|
87
|
+
if (answer === '2' || answer.toLowerCase() === 'frontend') {
|
|
88
|
+
return 'frontend';
|
|
89
|
+
}
|
|
60
90
|
|
|
61
|
-
|
|
62
|
-
console.error('Error creating project:', error.message);
|
|
91
|
+
console.error('Invalid choice. Please run the command again.');
|
|
63
92
|
process.exit(1);
|
|
64
93
|
}
|
|
94
|
+
|
|
95
|
+
async function main() {
|
|
96
|
+
try {
|
|
97
|
+
// Determine which template to use
|
|
98
|
+
let templateKey;
|
|
99
|
+
|
|
100
|
+
if (templateArg) {
|
|
101
|
+
// Template specified via CLI argument
|
|
102
|
+
templateKey = templateArg.toLowerCase();
|
|
103
|
+
if (!TEMPLATES[templateKey]) {
|
|
104
|
+
console.error(`Error: Invalid template "${templateArg}"`);
|
|
105
|
+
console.log('Available templates: backend, frontend');
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
// Prompt for template selection
|
|
110
|
+
templateKey = await promptTemplate();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const template = TEMPLATES[templateKey];
|
|
114
|
+
const templateDir = join(templatesDir, template.dir);
|
|
115
|
+
|
|
116
|
+
// Verify template directory exists
|
|
117
|
+
if (!existsSync(templateDir)) {
|
|
118
|
+
console.error(`Error: Template directory not found: ${templateDir}`);
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
console.log(`\n🚀 Creating ${template.name} project: ${projectName}`);
|
|
123
|
+
console.log(`📁 ${template.description}\n`);
|
|
124
|
+
|
|
125
|
+
// Copy template to target directory
|
|
126
|
+
copyDir(templateDir, targetDir);
|
|
127
|
+
|
|
128
|
+
// Update package.json with the new project name
|
|
129
|
+
const packageJsonPath = join(targetDir, 'package.json');
|
|
130
|
+
if (existsSync(packageJsonPath)) {
|
|
131
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
132
|
+
packageJson.name = projectName;
|
|
133
|
+
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
console.log('✅ Project created successfully!\n');
|
|
137
|
+
console.log('📝 Next steps:');
|
|
138
|
+
console.log(` cd ${projectName}`);
|
|
139
|
+
console.log(' pnpm install');
|
|
140
|
+
console.log(' pnpm dev\n');
|
|
141
|
+
|
|
142
|
+
if (templateKey === 'frontend') {
|
|
143
|
+
console.log('💡 Tip: Add shadcn/ui components with:');
|
|
144
|
+
console.log(' pnpm dlx shadcn@latest add button card dialog\n');
|
|
145
|
+
}
|
|
146
|
+
} catch (error) {
|
|
147
|
+
console.error('Error creating project:', error.message);
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@totaland/create-starter-kit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Scaffolding tool for creating new starter-kit projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"bin",
|
|
14
|
-
"
|
|
14
|
+
"templates"
|
|
15
15
|
],
|
|
16
16
|
"keywords": [
|
|
17
17
|
"starter-kit",
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Frontend Starter Kit
|
|
2
|
+
|
|
3
|
+
A modern React + TypeScript frontend starter with carefully selected tools and libraries.
|
|
4
|
+
|
|
5
|
+
## Tech Stack
|
|
6
|
+
|
|
7
|
+
- **React 19** - Latest React with improved performance
|
|
8
|
+
- **TypeScript** - Type-safe development
|
|
9
|
+
- **Vite** - Fast build tool and dev server
|
|
10
|
+
- **Tailwind CSS** - Utility-first CSS framework
|
|
11
|
+
- **shadcn/ui** - Beautiful, accessible components
|
|
12
|
+
- **TanStack Query** - Powerful data fetching and caching
|
|
13
|
+
- **React Router** - Client-side routing
|
|
14
|
+
- **Drizzle ORM** - Type-safe database access
|
|
15
|
+
- **Biome** - Fast linter and formatter
|
|
16
|
+
|
|
17
|
+
## Getting Started
|
|
18
|
+
|
|
19
|
+
### Install Dependencies
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm install
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Development
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm dev
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Build
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm build
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Preview Production Build
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm preview
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Adding shadcn/ui Components
|
|
44
|
+
|
|
45
|
+
To add shadcn/ui components, use the official CLI. For example:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Add a button component
|
|
49
|
+
pnpm dlx shadcn@latest add button
|
|
50
|
+
|
|
51
|
+
# Add multiple components
|
|
52
|
+
pnpm dlx shadcn@latest add button card dialog
|
|
53
|
+
|
|
54
|
+
# Add all components (not recommended)
|
|
55
|
+
pnpm dlx shadcn@latest add
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Components will be added to `src/components/ui/` and can be customized as needed.
|
|
59
|
+
|
|
60
|
+
## Folder Structure
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
src/
|
|
64
|
+
├── components/ # Reusable components
|
|
65
|
+
│ ├── layout/ # Layout components (Header, Footer, etc.)
|
|
66
|
+
│ └── ui/ # shadcn/ui components (added via CLI)
|
|
67
|
+
├── hooks/ # Custom React hooks
|
|
68
|
+
├── lib/ # Utility functions and configurations
|
|
69
|
+
│ ├── api-client.ts # API client for HTTP requests
|
|
70
|
+
│ └── utils.ts # Common utilities (cn helper, etc.)
|
|
71
|
+
├── pages/ # Page components (route-based)
|
|
72
|
+
│ ├── home/
|
|
73
|
+
│ └── about/
|
|
74
|
+
├── App.tsx # Main app component with routes
|
|
75
|
+
├── main.tsx # App entry point
|
|
76
|
+
└── index.css # Global styles with Tailwind
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Scripts
|
|
80
|
+
|
|
81
|
+
- `pnpm dev` - Start development server
|
|
82
|
+
- `pnpm build` - Build for production
|
|
83
|
+
- `pnpm preview` - Preview production build
|
|
84
|
+
- `pnpm lint` - Run Biome linter
|
|
85
|
+
- `pnpm lint:fix` - Fix linting issues
|
|
86
|
+
- `pnpm format` - Format code with Biome
|
|
87
|
+
|
|
88
|
+
## Environment Variables
|
|
89
|
+
|
|
90
|
+
Copy `.env.example` to `.env` and update the values:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
cp .env.example .env
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Path Aliases
|
|
97
|
+
|
|
98
|
+
The project uses `@` as an alias for the `src/` directory:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { cn } from '@/lib/utils';
|
|
102
|
+
import { Button } from '@/components/ui/button';
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Drizzle ORM Setup
|
|
106
|
+
|
|
107
|
+
To use Drizzle ORM with your frontend:
|
|
108
|
+
|
|
109
|
+
1. Define your schema in a shared location (e.g., `../backend/src/db/schema.ts`)
|
|
110
|
+
2. Generate types: `pnpm drizzle-kit generate`
|
|
111
|
+
3. Use the typed client in your queries
|
|
112
|
+
|
|
113
|
+
## TanStack Query
|
|
114
|
+
|
|
115
|
+
Example usage:
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import { useQuery } from '@tanstack/react-query';
|
|
119
|
+
|
|
120
|
+
function MyComponent() {
|
|
121
|
+
const { data, isLoading } = useQuery({
|
|
122
|
+
queryKey: ['myData'],
|
|
123
|
+
queryFn: () => fetch('/api/data').then(r => r.json()),
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// ...
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
MIT
|