create-atsdc-stack 1.1.0 → 1.2.1
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/.claude/settings.local.json +3 -1
- package/CLAUDE.md +236 -215
- package/CONTRIBUTING.md +342 -342
- package/INSTALLATION.md +359 -359
- package/LICENSE +201 -201
- package/README.md +405 -405
- package/app/.env.example +17 -17
- package/app/.github/labeler.yml +61 -0
- package/app/.github/workflows/browser-tests.yml +101 -0
- package/app/.github/workflows/check.yml +24 -0
- package/app/.github/workflows/greetings.yml +16 -0
- package/app/.github/workflows/label.yml +22 -0
- package/app/.github/workflows/stale.yml +27 -0
- package/app/.github/workflows/summary.yml +34 -0
- package/app/.stylelintrc.json +8 -0
- package/app/README.md +251 -251
- package/app/astro.config.mjs +83 -83
- package/app/drizzle.config.ts +16 -16
- package/app/package.json +66 -52
- package/app/playwright.config.ts +27 -0
- package/app/public/manifest.webmanifest +36 -36
- package/app/pwa-assets.config.ts +8 -0
- package/app/src/components/Card.astro +36 -36
- package/app/src/db/initialize.ts +107 -107
- package/app/src/db/schema.ts +72 -72
- package/app/src/db/validations.ts +158 -158
- package/app/src/layouts/Layout.astro +63 -63
- package/app/src/lib/config.ts +36 -36
- package/app/src/lib/content-converter.ts +141 -141
- package/app/src/lib/dom-utils.ts +230 -230
- package/app/src/lib/exa-search.ts +269 -269
- package/app/src/pages/api/chat.ts +91 -91
- package/app/src/pages/api/posts.ts +350 -350
- package/app/src/pages/index.astro +87 -87
- package/app/src/styles/components/button.scss +152 -152
- package/app/src/styles/components/card.scss +180 -180
- package/app/src/styles/components/form.scss +240 -240
- package/app/src/styles/global.scss +141 -141
- package/app/src/styles/pages/index.scss +80 -80
- package/app/src/styles/reset.scss +83 -83
- package/app/src/styles/variables/globals.scss +96 -96
- package/app/src/styles/variables/mixins.scss +238 -238
- package/app/tests/browser.test.nopause.ts +10 -0
- package/app/tests/browser.test.ts +13 -0
- package/bin/cli.js +1151 -1151
- package/package.json +8 -6
- package/app/.astro/settings.json +0 -5
- package/app/.astro/types.d.ts +0 -1
package/INSTALLATION.md
CHANGED
|
@@ -1,359 +1,359 @@
|
|
|
1
|
-
# Installation Guide
|
|
2
|
-
|
|
3
|
-
This guide provides detailed shell commands for initializing a new Astro project with the ATSDC Stack.
|
|
4
|
-
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
### Option 1: Using the CLI (Recommended)
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npx create-atsdc-stack my-app
|
|
11
|
-
cd my-app
|
|
12
|
-
npm install
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Option 2: Manual Setup from Scratch
|
|
16
|
-
|
|
17
|
-
If you want to build the stack manually from scratch, follow these steps:
|
|
18
|
-
|
|
19
|
-
## Step 1: Initialize Astro Project
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
# Create a new directory
|
|
23
|
-
mkdir my-atsdc-app
|
|
24
|
-
cd my-atsdc-app
|
|
25
|
-
|
|
26
|
-
# Initialize npm project
|
|
27
|
-
npm init -y
|
|
28
|
-
|
|
29
|
-
# Install Astro and core dependencies
|
|
30
|
-
npm install astro@latest
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Step 2: Install All Stack Dependencies
|
|
34
|
-
|
|
35
|
-
### Core Framework & Language
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npm install astro@latest typescript@latest
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Astro Integrations
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
npm install @astrojs/react@latest @astrojs/vercel@latest @astrojs/check@latest
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Authentication (Clerk)
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
npm install @clerk/astro@latest @clerk/clerk-react@latest
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Database (Drizzle ORM + PostgreSQL)
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npm install drizzle-orm@latest postgres@latest @vercel/postgres@latest
|
|
57
|
-
npm install -D drizzle-kit@latest
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Validation (Zod)
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
npm install zod@latest
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Styling (SCSS)
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
npm install -D sass@latest
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### AI Integration (Vercel AI SDK)
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npm install ai@latest @ai-sdk/openai@latest
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Unique IDs (NanoID)
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
npm install nanoid@latest
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### PWA Support
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
npm install -D vite-plugin-pwa@latest @vite-pwa/assets-generator@latest
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### React Dependencies (for Clerk components)
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
npm install react@latest react-dom@latest
|
|
94
|
-
npm install -D @types/react@latest @types/react-dom@latest
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### TypeScript Types
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
npm install -D @types/node@latest
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
## Step 3: All-in-One Installation Command
|
|
104
|
-
|
|
105
|
-
Alternatively, install all dependencies at once:
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
npm install \
|
|
109
|
-
astro@latest \
|
|
110
|
-
@astrojs/react@latest \
|
|
111
|
-
@astrojs/vercel@latest \
|
|
112
|
-
@astrojs/check@latest \
|
|
113
|
-
@clerk/astro@latest \
|
|
114
|
-
@clerk/clerk-react@latest \
|
|
115
|
-
@vercel/postgres@latest \
|
|
116
|
-
ai@latest \
|
|
117
|
-
@ai-sdk/openai@latest \
|
|
118
|
-
drizzle-orm@latest \
|
|
119
|
-
nanoid@latest \
|
|
120
|
-
postgres@latest \
|
|
121
|
-
react@latest \
|
|
122
|
-
react-dom@latest \
|
|
123
|
-
typescript@latest \
|
|
124
|
-
zod@latest
|
|
125
|
-
|
|
126
|
-
npm install -D \
|
|
127
|
-
@types/node@latest \
|
|
128
|
-
@types/react@latest \
|
|
129
|
-
@types/react-dom@latest \
|
|
130
|
-
@vite-pwa/assets-generator@latest \
|
|
131
|
-
drizzle-kit@latest \
|
|
132
|
-
sass@latest \
|
|
133
|
-
vite-plugin-pwa@latest
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Step 4: Project Structure Setup
|
|
137
|
-
|
|
138
|
-
Create the necessary directories:
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
mkdir -p src/{components,db,layouts,pages/api,styles/components,styles/pages} public bin
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Step 5: Configuration Files
|
|
145
|
-
|
|
146
|
-
### Create `package.json` scripts
|
|
147
|
-
|
|
148
|
-
Add these to your `package.json`:
|
|
149
|
-
|
|
150
|
-
```json
|
|
151
|
-
{
|
|
152
|
-
"scripts": {
|
|
153
|
-
"dev": "astro dev",
|
|
154
|
-
"build": "astro check && astro build",
|
|
155
|
-
"preview": "astro preview",
|
|
156
|
-
"astro": "astro",
|
|
157
|
-
"db:generate": "drizzle-kit generate",
|
|
158
|
-
"db:migrate": "drizzle-kit migrate",
|
|
159
|
-
"db:push": "drizzle-kit push",
|
|
160
|
-
"db:studio": "drizzle-kit studio"
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Create `tsconfig.json`
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
cat > tsconfig.json << 'EOF'
|
|
169
|
-
{
|
|
170
|
-
"extends": "astro/tsconfigs/strict",
|
|
171
|
-
"compilerOptions": {
|
|
172
|
-
"target": "ES2022",
|
|
173
|
-
"module": "ESNext",
|
|
174
|
-
"moduleResolution": "bundler",
|
|
175
|
-
"jsx": "react-jsx",
|
|
176
|
-
"jsxImportSource": "react",
|
|
177
|
-
"strict": true,
|
|
178
|
-
"baseUrl": ".",
|
|
179
|
-
"paths": {
|
|
180
|
-
"@/*": ["src/*"]
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
EOF
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### Create `astro.config.mjs`
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
cat > astro.config.mjs << 'EOF'
|
|
191
|
-
import { defineConfig } from 'astro/config';
|
|
192
|
-
import react from '@astrojs/react';
|
|
193
|
-
import vercel from '@astrojs/vercel/serverless';
|
|
194
|
-
import clerk from '@clerk/astro';
|
|
195
|
-
import { VitePWA } from 'vite-plugin-pwa';
|
|
196
|
-
|
|
197
|
-
export default defineConfig({
|
|
198
|
-
output: 'server',
|
|
199
|
-
adapter: vercel(),
|
|
200
|
-
integrations: [react(), clerk()],
|
|
201
|
-
vite: {
|
|
202
|
-
plugins: [VitePWA({ registerType: 'autoUpdate' })],
|
|
203
|
-
},
|
|
204
|
-
});
|
|
205
|
-
EOF
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### Create `.env.example`
|
|
209
|
-
|
|
210
|
-
```bash
|
|
211
|
-
cat > .env.example << 'EOF'
|
|
212
|
-
DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
|
|
213
|
-
PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_..."
|
|
214
|
-
CLERK_SECRET_KEY="sk_test_..."
|
|
215
|
-
OPENAI_API_KEY="sk-..."
|
|
216
|
-
EOF
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
### Create `.gitignore`
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
cat > .gitignore << 'EOF'
|
|
223
|
-
node_modules/
|
|
224
|
-
dist/
|
|
225
|
-
.astro/
|
|
226
|
-
.env
|
|
227
|
-
.env.local
|
|
228
|
-
.DS_Store
|
|
229
|
-
.vscode/
|
|
230
|
-
*.log
|
|
231
|
-
drizzle/
|
|
232
|
-
EOF
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
## Step 6: Environment Setup
|
|
236
|
-
|
|
237
|
-
```bash
|
|
238
|
-
# Copy environment template
|
|
239
|
-
cp .env.example .env
|
|
240
|
-
|
|
241
|
-
# Edit .env with your actual credentials
|
|
242
|
-
nano .env # or use your preferred editor
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
## Step 7: Database Setup
|
|
246
|
-
|
|
247
|
-
```bash
|
|
248
|
-
# Push your schema to the database
|
|
249
|
-
npm run db:push
|
|
250
|
-
|
|
251
|
-
# Or generate migrations
|
|
252
|
-
npm run db:generate
|
|
253
|
-
npm run db:migrate
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
## Step 8: Start Development
|
|
257
|
-
|
|
258
|
-
```bash
|
|
259
|
-
npm run dev
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
Your application will be available at `http://localhost:4321`
|
|
263
|
-
|
|
264
|
-
## Verification
|
|
265
|
-
|
|
266
|
-
Verify your installation:
|
|
267
|
-
|
|
268
|
-
```bash
|
|
269
|
-
# Check Node version (should be 18+)
|
|
270
|
-
node --version
|
|
271
|
-
|
|
272
|
-
# Check npm version
|
|
273
|
-
npm --version
|
|
274
|
-
|
|
275
|
-
# Verify Astro is working
|
|
276
|
-
npm run astro -- --version
|
|
277
|
-
|
|
278
|
-
# Check TypeScript
|
|
279
|
-
npx tsc --version
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
## Troubleshooting
|
|
283
|
-
|
|
284
|
-
### Port Already in Use
|
|
285
|
-
|
|
286
|
-
```bash
|
|
287
|
-
# Kill process on port 4321
|
|
288
|
-
lsof -ti:4321 | xargs kill -9
|
|
289
|
-
|
|
290
|
-
# Or specify a different port
|
|
291
|
-
npm run dev -- --port 3000
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
### Database Connection Issues
|
|
295
|
-
|
|
296
|
-
```bash
|
|
297
|
-
# Test PostgreSQL connection
|
|
298
|
-
psql $DATABASE_URL
|
|
299
|
-
|
|
300
|
-
# Check if database exists
|
|
301
|
-
psql -l
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
### Clear Cache and Reinstall
|
|
305
|
-
|
|
306
|
-
```bash
|
|
307
|
-
# Remove node_modules and lockfile
|
|
308
|
-
rm -rf node_modules package-lock.json
|
|
309
|
-
|
|
310
|
-
# Clear npm cache
|
|
311
|
-
npm cache clean --force
|
|
312
|
-
|
|
313
|
-
# Reinstall
|
|
314
|
-
npm install
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
## Next Steps
|
|
318
|
-
|
|
319
|
-
1. Review the [README.md](./README.md) for architecture details
|
|
320
|
-
2. Explore the example code in `src/pages/api/`
|
|
321
|
-
3. Customize your database schema in `src/db/schema.ts`
|
|
322
|
-
4. Set up your Clerk authentication
|
|
323
|
-
5. Deploy to Vercel
|
|
324
|
-
|
|
325
|
-
## Production Deployment
|
|
326
|
-
|
|
327
|
-
### Vercel
|
|
328
|
-
|
|
329
|
-
```bash
|
|
330
|
-
# Install Vercel CLI
|
|
331
|
-
npm i -g vercel
|
|
332
|
-
|
|
333
|
-
# Login
|
|
334
|
-
vercel login
|
|
335
|
-
|
|
336
|
-
# Deploy
|
|
337
|
-
vercel
|
|
338
|
-
|
|
339
|
-
# Deploy to production
|
|
340
|
-
vercel --prod
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
### Set Environment Variables on Vercel
|
|
344
|
-
|
|
345
|
-
```bash
|
|
346
|
-
vercel env add DATABASE_URL
|
|
347
|
-
vercel env add CLERK_SECRET_KEY
|
|
348
|
-
vercel env add OPENAI_API_KEY
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
## Support
|
|
352
|
-
|
|
353
|
-
If you encounter issues:
|
|
354
|
-
|
|
355
|
-
1. Check the [GitHub Issues](https://github.com/yourusername/atsdc-stack/issues)
|
|
356
|
-
2. Review the official documentation for each technology
|
|
357
|
-
3. Ask in the community Discord/Slack
|
|
358
|
-
|
|
359
|
-
Happy coding!
|
|
1
|
+
# Installation Guide
|
|
2
|
+
|
|
3
|
+
This guide provides detailed shell commands for initializing a new Astro project with the ATSDC Stack.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### Option 1: Using the CLI (Recommended)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx create-atsdc-stack my-app
|
|
11
|
+
cd my-app
|
|
12
|
+
npm install
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Option 2: Manual Setup from Scratch
|
|
16
|
+
|
|
17
|
+
If you want to build the stack manually from scratch, follow these steps:
|
|
18
|
+
|
|
19
|
+
## Step 1: Initialize Astro Project
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Create a new directory
|
|
23
|
+
mkdir my-atsdc-app
|
|
24
|
+
cd my-atsdc-app
|
|
25
|
+
|
|
26
|
+
# Initialize npm project
|
|
27
|
+
npm init -y
|
|
28
|
+
|
|
29
|
+
# Install Astro and core dependencies
|
|
30
|
+
npm install astro@latest
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Step 2: Install All Stack Dependencies
|
|
34
|
+
|
|
35
|
+
### Core Framework & Language
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install astro@latest typescript@latest
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Astro Integrations
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install @astrojs/react@latest @astrojs/vercel@latest @astrojs/check@latest
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Authentication (Clerk)
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install @clerk/astro@latest @clerk/clerk-react@latest
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Database (Drizzle ORM + PostgreSQL)
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install drizzle-orm@latest postgres@latest @vercel/postgres@latest
|
|
57
|
+
npm install -D drizzle-kit@latest
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Validation (Zod)
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm install zod@latest
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Styling (SCSS)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm install -D sass@latest
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### AI Integration (Vercel AI SDK)
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install ai@latest @ai-sdk/openai@latest
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Unique IDs (NanoID)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm install nanoid@latest
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### PWA Support
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm install -D vite-plugin-pwa@latest @vite-pwa/assets-generator@latest
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### React Dependencies (for Clerk components)
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npm install react@latest react-dom@latest
|
|
94
|
+
npm install -D @types/react@latest @types/react-dom@latest
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### TypeScript Types
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npm install -D @types/node@latest
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Step 3: All-in-One Installation Command
|
|
104
|
+
|
|
105
|
+
Alternatively, install all dependencies at once:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm install \
|
|
109
|
+
astro@latest \
|
|
110
|
+
@astrojs/react@latest \
|
|
111
|
+
@astrojs/vercel@latest \
|
|
112
|
+
@astrojs/check@latest \
|
|
113
|
+
@clerk/astro@latest \
|
|
114
|
+
@clerk/clerk-react@latest \
|
|
115
|
+
@vercel/postgres@latest \
|
|
116
|
+
ai@latest \
|
|
117
|
+
@ai-sdk/openai@latest \
|
|
118
|
+
drizzle-orm@latest \
|
|
119
|
+
nanoid@latest \
|
|
120
|
+
postgres@latest \
|
|
121
|
+
react@latest \
|
|
122
|
+
react-dom@latest \
|
|
123
|
+
typescript@latest \
|
|
124
|
+
zod@latest
|
|
125
|
+
|
|
126
|
+
npm install -D \
|
|
127
|
+
@types/node@latest \
|
|
128
|
+
@types/react@latest \
|
|
129
|
+
@types/react-dom@latest \
|
|
130
|
+
@vite-pwa/assets-generator@latest \
|
|
131
|
+
drizzle-kit@latest \
|
|
132
|
+
sass@latest \
|
|
133
|
+
vite-plugin-pwa@latest
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Step 4: Project Structure Setup
|
|
137
|
+
|
|
138
|
+
Create the necessary directories:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
mkdir -p src/{components,db,layouts,pages/api,styles/components,styles/pages} public bin
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Step 5: Configuration Files
|
|
145
|
+
|
|
146
|
+
### Create `package.json` scripts
|
|
147
|
+
|
|
148
|
+
Add these to your `package.json`:
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"scripts": {
|
|
153
|
+
"dev": "astro dev",
|
|
154
|
+
"build": "astro check && astro build",
|
|
155
|
+
"preview": "astro preview",
|
|
156
|
+
"astro": "astro",
|
|
157
|
+
"db:generate": "drizzle-kit generate",
|
|
158
|
+
"db:migrate": "drizzle-kit migrate",
|
|
159
|
+
"db:push": "drizzle-kit push",
|
|
160
|
+
"db:studio": "drizzle-kit studio"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Create `tsconfig.json`
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
cat > tsconfig.json << 'EOF'
|
|
169
|
+
{
|
|
170
|
+
"extends": "astro/tsconfigs/strict",
|
|
171
|
+
"compilerOptions": {
|
|
172
|
+
"target": "ES2022",
|
|
173
|
+
"module": "ESNext",
|
|
174
|
+
"moduleResolution": "bundler",
|
|
175
|
+
"jsx": "react-jsx",
|
|
176
|
+
"jsxImportSource": "react",
|
|
177
|
+
"strict": true,
|
|
178
|
+
"baseUrl": ".",
|
|
179
|
+
"paths": {
|
|
180
|
+
"@/*": ["src/*"]
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
EOF
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Create `astro.config.mjs`
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
cat > astro.config.mjs << 'EOF'
|
|
191
|
+
import { defineConfig } from 'astro/config';
|
|
192
|
+
import react from '@astrojs/react';
|
|
193
|
+
import vercel from '@astrojs/vercel/serverless';
|
|
194
|
+
import clerk from '@clerk/astro';
|
|
195
|
+
import { VitePWA } from 'vite-plugin-pwa';
|
|
196
|
+
|
|
197
|
+
export default defineConfig({
|
|
198
|
+
output: 'server',
|
|
199
|
+
adapter: vercel(),
|
|
200
|
+
integrations: [react(), clerk()],
|
|
201
|
+
vite: {
|
|
202
|
+
plugins: [VitePWA({ registerType: 'autoUpdate' })],
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
EOF
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Create `.env.example`
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
cat > .env.example << 'EOF'
|
|
212
|
+
DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
|
|
213
|
+
PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_..."
|
|
214
|
+
CLERK_SECRET_KEY="sk_test_..."
|
|
215
|
+
OPENAI_API_KEY="sk-..."
|
|
216
|
+
EOF
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Create `.gitignore`
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
cat > .gitignore << 'EOF'
|
|
223
|
+
node_modules/
|
|
224
|
+
dist/
|
|
225
|
+
.astro/
|
|
226
|
+
.env
|
|
227
|
+
.env.local
|
|
228
|
+
.DS_Store
|
|
229
|
+
.vscode/
|
|
230
|
+
*.log
|
|
231
|
+
drizzle/
|
|
232
|
+
EOF
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Step 6: Environment Setup
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Copy environment template
|
|
239
|
+
cp .env.example .env
|
|
240
|
+
|
|
241
|
+
# Edit .env with your actual credentials
|
|
242
|
+
nano .env # or use your preferred editor
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Step 7: Database Setup
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Push your schema to the database
|
|
249
|
+
npm run db:push
|
|
250
|
+
|
|
251
|
+
# Or generate migrations
|
|
252
|
+
npm run db:generate
|
|
253
|
+
npm run db:migrate
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Step 8: Start Development
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
npm run dev
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Your application will be available at `http://localhost:4321`
|
|
263
|
+
|
|
264
|
+
## Verification
|
|
265
|
+
|
|
266
|
+
Verify your installation:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# Check Node version (should be 18+)
|
|
270
|
+
node --version
|
|
271
|
+
|
|
272
|
+
# Check npm version
|
|
273
|
+
npm --version
|
|
274
|
+
|
|
275
|
+
# Verify Astro is working
|
|
276
|
+
npm run astro -- --version
|
|
277
|
+
|
|
278
|
+
# Check TypeScript
|
|
279
|
+
npx tsc --version
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Troubleshooting
|
|
283
|
+
|
|
284
|
+
### Port Already in Use
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# Kill process on port 4321
|
|
288
|
+
lsof -ti:4321 | xargs kill -9
|
|
289
|
+
|
|
290
|
+
# Or specify a different port
|
|
291
|
+
npm run dev -- --port 3000
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Database Connection Issues
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Test PostgreSQL connection
|
|
298
|
+
psql $DATABASE_URL
|
|
299
|
+
|
|
300
|
+
# Check if database exists
|
|
301
|
+
psql -l
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Clear Cache and Reinstall
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
# Remove node_modules and lockfile
|
|
308
|
+
rm -rf node_modules package-lock.json
|
|
309
|
+
|
|
310
|
+
# Clear npm cache
|
|
311
|
+
npm cache clean --force
|
|
312
|
+
|
|
313
|
+
# Reinstall
|
|
314
|
+
npm install
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Next Steps
|
|
318
|
+
|
|
319
|
+
1. Review the [README.md](./README.md) for architecture details
|
|
320
|
+
2. Explore the example code in `src/pages/api/`
|
|
321
|
+
3. Customize your database schema in `src/db/schema.ts`
|
|
322
|
+
4. Set up your Clerk authentication
|
|
323
|
+
5. Deploy to Vercel
|
|
324
|
+
|
|
325
|
+
## Production Deployment
|
|
326
|
+
|
|
327
|
+
### Vercel
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
# Install Vercel CLI
|
|
331
|
+
npm i -g vercel
|
|
332
|
+
|
|
333
|
+
# Login
|
|
334
|
+
vercel login
|
|
335
|
+
|
|
336
|
+
# Deploy
|
|
337
|
+
vercel
|
|
338
|
+
|
|
339
|
+
# Deploy to production
|
|
340
|
+
vercel --prod
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### Set Environment Variables on Vercel
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
vercel env add DATABASE_URL
|
|
347
|
+
vercel env add CLERK_SECRET_KEY
|
|
348
|
+
vercel env add OPENAI_API_KEY
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## Support
|
|
352
|
+
|
|
353
|
+
If you encounter issues:
|
|
354
|
+
|
|
355
|
+
1. Check the [GitHub Issues](https://github.com/yourusername/atsdc-stack/issues)
|
|
356
|
+
2. Review the official documentation for each technology
|
|
357
|
+
3. Ask in the community Discord/Slack
|
|
358
|
+
|
|
359
|
+
Happy coding!
|