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.
Files changed (48) hide show
  1. package/.claude/settings.local.json +3 -1
  2. package/CLAUDE.md +236 -215
  3. package/CONTRIBUTING.md +342 -342
  4. package/INSTALLATION.md +359 -359
  5. package/LICENSE +201 -201
  6. package/README.md +405 -405
  7. package/app/.env.example +17 -17
  8. package/app/.github/labeler.yml +61 -0
  9. package/app/.github/workflows/browser-tests.yml +101 -0
  10. package/app/.github/workflows/check.yml +24 -0
  11. package/app/.github/workflows/greetings.yml +16 -0
  12. package/app/.github/workflows/label.yml +22 -0
  13. package/app/.github/workflows/stale.yml +27 -0
  14. package/app/.github/workflows/summary.yml +34 -0
  15. package/app/.stylelintrc.json +8 -0
  16. package/app/README.md +251 -251
  17. package/app/astro.config.mjs +83 -83
  18. package/app/drizzle.config.ts +16 -16
  19. package/app/package.json +66 -52
  20. package/app/playwright.config.ts +27 -0
  21. package/app/public/manifest.webmanifest +36 -36
  22. package/app/pwa-assets.config.ts +8 -0
  23. package/app/src/components/Card.astro +36 -36
  24. package/app/src/db/initialize.ts +107 -107
  25. package/app/src/db/schema.ts +72 -72
  26. package/app/src/db/validations.ts +158 -158
  27. package/app/src/layouts/Layout.astro +63 -63
  28. package/app/src/lib/config.ts +36 -36
  29. package/app/src/lib/content-converter.ts +141 -141
  30. package/app/src/lib/dom-utils.ts +230 -230
  31. package/app/src/lib/exa-search.ts +269 -269
  32. package/app/src/pages/api/chat.ts +91 -91
  33. package/app/src/pages/api/posts.ts +350 -350
  34. package/app/src/pages/index.astro +87 -87
  35. package/app/src/styles/components/button.scss +152 -152
  36. package/app/src/styles/components/card.scss +180 -180
  37. package/app/src/styles/components/form.scss +240 -240
  38. package/app/src/styles/global.scss +141 -141
  39. package/app/src/styles/pages/index.scss +80 -80
  40. package/app/src/styles/reset.scss +83 -83
  41. package/app/src/styles/variables/globals.scss +96 -96
  42. package/app/src/styles/variables/mixins.scss +238 -238
  43. package/app/tests/browser.test.nopause.ts +10 -0
  44. package/app/tests/browser.test.ts +13 -0
  45. package/bin/cli.js +1151 -1151
  46. package/package.json +8 -6
  47. package/app/.astro/settings.json +0 -5
  48. package/app/.astro/types.d.ts +0 -1
package/app/README.md CHANGED
@@ -1,251 +1,251 @@
1
- # ATSDC Stack Application
2
-
3
- This is the main Astro application for the ATSDC Stack.
4
-
5
- ## 🚀 Quick Start
6
-
7
- ### Prerequisites
8
-
9
- - Node.js >= 18.0.0
10
- - PostgreSQL database (Vercel Postgres, Neon, or local)
11
- - API keys for Clerk, OpenAI, and optionally Exa
12
-
13
- ### Installation
14
-
15
- ```bash
16
- # Install dependencies
17
- npm install
18
-
19
- # Copy environment template
20
- cp .env.example .env
21
-
22
- # Configure your .env file with your credentials
23
- ```
24
-
25
- ### Environment Variables
26
-
27
- Create a `.env` file with the following variables:
28
-
29
- ```env
30
- # Database
31
- DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
32
-
33
- # Clerk Authentication
34
- PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_..."
35
- CLERK_SECRET_KEY="sk_test_..."
36
-
37
- # OpenAI (for Vercel AI SDK)
38
- OPENAI_API_KEY="sk-..."
39
-
40
- # Exa Search (optional)
41
- EXA_API_KEY="..."
42
- ```
43
-
44
- ### Database Setup
45
-
46
- ```bash
47
- # Push schema to database
48
- npm run db:push
49
-
50
- # Or generate migrations
51
- npm run db:generate
52
- npm run db:migrate
53
-
54
- # Open Drizzle Studio (database GUI)
55
- npm run db:studio
56
- ```
57
-
58
- ### Development
59
-
60
- ```bash
61
- # Start dev server
62
- npm run dev
63
- ```
64
-
65
- Visit `http://localhost:4321`
66
-
67
- ## 📝 Available Scripts
68
-
69
- - `npm run dev` - Start development server
70
- - `npm run build` - Build for production
71
- - `npm run preview` - Preview production build
72
- - `npm run astro` - Run Astro CLI commands
73
- - `npm run db:generate` - Generate database migrations
74
- - `npm run db:migrate` - Run database migrations
75
- - `npm run db:push` - Push schema changes to database
76
- - `npm run db:studio` - Open Drizzle Studio
77
-
78
- ## 📁 Project Structure
79
-
80
- ```text
81
- src/
82
- ├── components/ # Reusable Astro components
83
- ├── db/ # Database schema and client
84
- │ ├── initialize.ts # Database initialization
85
- │ ├── schema.ts # Drizzle ORM schemas
86
- │ └── validations.ts # Zod validation schemas
87
- ├── layouts/ # Page layouts
88
- │ └── Layout.astro
89
- ├── lib/ # Utility libraries
90
- │ ├── config.ts # App configuration
91
- │ ├── content-converter.ts # Markdown/HTML conversion
92
- │ ├── dom-utils.ts # DOM manipulation
93
- │ └── exa-search.ts # AI-powered search
94
- ├── pages/ # Routes and pages
95
- │ ├── api/ # API endpoints
96
- │ │ ├── chat.ts # AI chat endpoint
97
- │ │ └── posts.ts # Posts CRUD
98
- │ └── index.astro # Home page
99
- └── styles/ # SCSS stylesheets
100
- ├── variables/ # SCSS variables and mixins
101
- ├── components/ # Component styles
102
- ├── pages/ # Page styles
103
- ├── reset.scss # CSS reset
104
- └── global.scss # Global styles
105
- ```
106
-
107
- ## 🎨 SCSS Architecture
108
-
109
- This app uses a strict SCSS architecture:
110
-
111
- - **No inline `<style>` tags** in `.astro` files
112
- - **All styles in external SCSS files** for better maintainability
113
- - **Data attributes for modifiers** (preferred over BEM)
114
- - **Semantic class names** (no utility classes)
115
-
116
- Example:
117
-
118
- ```astro
119
- ---
120
- import '@/styles/components/button.scss';
121
- ---
122
- <button class="btn" data-variant="primary" data-size="lg">
123
- Click Me
124
- </button>
125
- ```
126
-
127
- ## 🗄️ Database
128
-
129
- ### Schema Definition
130
-
131
- Define your database schema in `src/db/schema.ts` using Drizzle ORM:
132
-
133
- ```typescript
134
- export const posts = pgTable('posts', {
135
- id: varchar('id', { length: 21 })
136
- .primaryKey()
137
- .$defaultFn(() => nanoid()),
138
- title: varchar('title', { length: 255 }).notNull(),
139
- content: text('content').notNull(),
140
- createdAt: timestamp('created_at').defaultNow().notNull(),
141
- });
142
- ```
143
-
144
- ### Validation
145
-
146
- Define Zod schemas in `src/db/validations.ts`:
147
-
148
- ```typescript
149
- export const createPostSchema = z.object({
150
- title: z.string().min(1).max(255),
151
- content: z.string().min(1),
152
- });
153
- ```
154
-
155
- ## 🔐 Authentication
156
-
157
- Authentication is handled by Clerk. Configure in `astro.config.mjs`:
158
-
159
- ```javascript
160
- clerk({
161
- afterSignInUrl: '/',
162
- afterSignUpUrl: '/',
163
- })
164
- ```
165
-
166
- ## 🤖 AI Features
167
-
168
- ### Vercel AI SDK
169
-
170
- Chat endpoint example in `src/pages/api/chat.ts`:
171
-
172
- ```typescript
173
- import { OpenAI } from 'ai';
174
-
175
- export const POST: APIRoute = async ({ request }) => {
176
- // AI chat implementation
177
- };
178
- ```
179
-
180
- ### Exa Search
181
-
182
- AI-powered search utilities in `src/lib/exa-search.ts`.
183
-
184
- ## 📱 Progressive Web App
185
-
186
- This app includes PWA support with offline capabilities:
187
-
188
- - Service worker auto-generated
189
- - Installable on mobile/desktop
190
- - Offline caching configured in `astro.config.mjs`
191
-
192
- ## 🚀 Deployment
193
-
194
- ### Vercel (Recommended)
195
-
196
- ```bash
197
- # Install Vercel CLI
198
- npm i -g vercel
199
-
200
- # Deploy
201
- vercel
202
- ```
203
-
204
- Make sure to set these environment variables in your Vercel project settings:
205
-
206
- - `DATABASE_URL`
207
- - `PUBLIC_CLERK_PUBLISHABLE_KEY`
208
- - `CLERK_SECRET_KEY`
209
- - `OPENAI_API_KEY`
210
- - `EXA_API_KEY` (optional)
211
-
212
- ## 📚 Documentation
213
-
214
- - [Astro Documentation](https://docs.astro.build)
215
- - [Drizzle ORM](https://orm.drizzle.team)
216
- - [Clerk](https://clerk.com/docs)
217
- - [Vercel AI SDK](https://sdk.vercel.ai/docs)
218
- - [Zod](https://zod.dev)
219
- - [Exa Search](https://docs.exa.ai)
220
-
221
- ## 🛠️ Utilities
222
-
223
- ### Content Conversion
224
-
225
- ```typescript
226
- import { htmlToMarkdown, markdownToHtml } from '@/lib/content-converter';
227
-
228
- const markdown = htmlToMarkdown('<h1>Hello</h1>');
229
- const html = markdownToHtml('# Hello');
230
- ```
231
-
232
- ### DOM Manipulation
233
-
234
- ```typescript
235
- import { extractText, findLinks } from '@/lib/dom-utils';
236
-
237
- const text = extractText(htmlString);
238
- const links = findLinks(htmlString);
239
- ```
240
-
241
- ### AI Search
242
-
243
- ```typescript
244
- import { searchWithExa } from '@/lib/exa-search';
245
-
246
- const results = await searchWithExa('your query');
247
- ```
248
-
249
- ## 📄 License
250
-
251
- MIT
1
+ # ATSDC Stack Application
2
+
3
+ This is the main Astro application for the ATSDC Stack.
4
+
5
+ ## 🚀 Quick Start
6
+
7
+ ### Prerequisites
8
+
9
+ - Node.js >= 18.0.0
10
+ - PostgreSQL database (Vercel Postgres, Neon, or local)
11
+ - API keys for Clerk, OpenAI, and optionally Exa
12
+
13
+ ### Installation
14
+
15
+ ```bash
16
+ # Install dependencies
17
+ npm install
18
+
19
+ # Copy environment template
20
+ cp .env.example .env
21
+
22
+ # Configure your .env file with your credentials
23
+ ```
24
+
25
+ ### Environment Variables
26
+
27
+ Create a `.env` file with the following variables:
28
+
29
+ ```env
30
+ # Database
31
+ DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
32
+
33
+ # Clerk Authentication
34
+ PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_..."
35
+ CLERK_SECRET_KEY="sk_test_..."
36
+
37
+ # OpenAI (for Vercel AI SDK)
38
+ OPENAI_API_KEY="sk-..."
39
+
40
+ # Exa Search (optional)
41
+ EXA_API_KEY="..."
42
+ ```
43
+
44
+ ### Database Setup
45
+
46
+ ```bash
47
+ # Push schema to database
48
+ npm run db:push
49
+
50
+ # Or generate migrations
51
+ npm run db:generate
52
+ npm run db:migrate
53
+
54
+ # Open Drizzle Studio (database GUI)
55
+ npm run db:studio
56
+ ```
57
+
58
+ ### Development
59
+
60
+ ```bash
61
+ # Start dev server
62
+ npm run dev
63
+ ```
64
+
65
+ Visit `http://localhost:4321`
66
+
67
+ ## 📝 Available Scripts
68
+
69
+ - `npm run dev` - Start development server
70
+ - `npm run build` - Build for production
71
+ - `npm run preview` - Preview production build
72
+ - `npm run astro` - Run Astro CLI commands
73
+ - `npm run db:generate` - Generate database migrations
74
+ - `npm run db:migrate` - Run database migrations
75
+ - `npm run db:push` - Push schema changes to database
76
+ - `npm run db:studio` - Open Drizzle Studio
77
+
78
+ ## 📁 Project Structure
79
+
80
+ ```text
81
+ src/
82
+ ├── components/ # Reusable Astro components
83
+ ├── db/ # Database schema and client
84
+ │ ├── initialize.ts # Database initialization
85
+ │ ├── schema.ts # Drizzle ORM schemas
86
+ │ └── validations.ts # Zod validation schemas
87
+ ├── layouts/ # Page layouts
88
+ │ └── Layout.astro
89
+ ├── lib/ # Utility libraries
90
+ │ ├── config.ts # App configuration
91
+ │ ├── content-converter.ts # Markdown/HTML conversion
92
+ │ ├── dom-utils.ts # DOM manipulation
93
+ │ └── exa-search.ts # AI-powered search
94
+ ├── pages/ # Routes and pages
95
+ │ ├── api/ # API endpoints
96
+ │ │ ├── chat.ts # AI chat endpoint
97
+ │ │ └── posts.ts # Posts CRUD
98
+ │ └── index.astro # Home page
99
+ └── styles/ # SCSS stylesheets
100
+ ├── variables/ # SCSS variables and mixins
101
+ ├── components/ # Component styles
102
+ ├── pages/ # Page styles
103
+ ├── reset.scss # CSS reset
104
+ └── global.scss # Global styles
105
+ ```
106
+
107
+ ## 🎨 SCSS Architecture
108
+
109
+ This app uses a strict SCSS architecture:
110
+
111
+ - **No inline `<style>` tags** in `.astro` files
112
+ - **All styles in external SCSS files** for better maintainability
113
+ - **Data attributes for modifiers** (preferred over BEM)
114
+ - **Semantic class names** (no utility classes)
115
+
116
+ Example:
117
+
118
+ ```astro
119
+ ---
120
+ import '@/styles/components/button.scss';
121
+ ---
122
+ <button class="btn" data-variant="primary" data-size="lg">
123
+ Click Me
124
+ </button>
125
+ ```
126
+
127
+ ## 🗄️ Database
128
+
129
+ ### Schema Definition
130
+
131
+ Define your database schema in `src/db/schema.ts` using Drizzle ORM:
132
+
133
+ ```typescript
134
+ export const posts = pgTable('posts', {
135
+ id: varchar('id', { length: 21 })
136
+ .primaryKey()
137
+ .$defaultFn(() => nanoid()),
138
+ title: varchar('title', { length: 255 }).notNull(),
139
+ content: text('content').notNull(),
140
+ createdAt: timestamp('created_at').defaultNow().notNull(),
141
+ });
142
+ ```
143
+
144
+ ### Validation
145
+
146
+ Define Zod schemas in `src/db/validations.ts`:
147
+
148
+ ```typescript
149
+ export const createPostSchema = z.object({
150
+ title: z.string().min(1).max(255),
151
+ content: z.string().min(1),
152
+ });
153
+ ```
154
+
155
+ ## 🔐 Authentication
156
+
157
+ Authentication is handled by Clerk. Configure in `astro.config.mjs`:
158
+
159
+ ```javascript
160
+ clerk({
161
+ afterSignInUrl: '/',
162
+ afterSignUpUrl: '/',
163
+ })
164
+ ```
165
+
166
+ ## 🤖 AI Features
167
+
168
+ ### Vercel AI SDK
169
+
170
+ Chat endpoint example in `src/pages/api/chat.ts`:
171
+
172
+ ```typescript
173
+ import { OpenAI } from 'ai';
174
+
175
+ export const POST: APIRoute = async ({ request }) => {
176
+ // AI chat implementation
177
+ };
178
+ ```
179
+
180
+ ### Exa Search
181
+
182
+ AI-powered search utilities in `src/lib/exa-search.ts`.
183
+
184
+ ## 📱 Progressive Web App
185
+
186
+ This app includes PWA support with offline capabilities:
187
+
188
+ - Service worker auto-generated
189
+ - Installable on mobile/desktop
190
+ - Offline caching configured in `astro.config.mjs`
191
+
192
+ ## 🚀 Deployment
193
+
194
+ ### Vercel (Recommended)
195
+
196
+ ```bash
197
+ # Install Vercel CLI
198
+ npm i -g vercel
199
+
200
+ # Deploy
201
+ vercel
202
+ ```
203
+
204
+ Make sure to set these environment variables in your Vercel project settings:
205
+
206
+ - `DATABASE_URL`
207
+ - `PUBLIC_CLERK_PUBLISHABLE_KEY`
208
+ - `CLERK_SECRET_KEY`
209
+ - `OPENAI_API_KEY`
210
+ - `EXA_API_KEY` (optional)
211
+
212
+ ## 📚 Documentation
213
+
214
+ - [Astro Documentation](https://docs.astro.build)
215
+ - [Drizzle ORM](https://orm.drizzle.team)
216
+ - [Clerk](https://clerk.com/docs)
217
+ - [Vercel AI SDK](https://sdk.vercel.ai/docs)
218
+ - [Zod](https://zod.dev)
219
+ - [Exa Search](https://docs.exa.ai)
220
+
221
+ ## 🛠️ Utilities
222
+
223
+ ### Content Conversion
224
+
225
+ ```typescript
226
+ import { htmlToMarkdown, markdownToHtml } from '@/lib/content-converter';
227
+
228
+ const markdown = htmlToMarkdown('<h1>Hello</h1>');
229
+ const html = markdownToHtml('# Hello');
230
+ ```
231
+
232
+ ### DOM Manipulation
233
+
234
+ ```typescript
235
+ import { extractText, findLinks } from '@/lib/dom-utils';
236
+
237
+ const text = extractText(htmlString);
238
+ const links = findLinks(htmlString);
239
+ ```
240
+
241
+ ### AI Search
242
+
243
+ ```typescript
244
+ import { searchWithExa } from '@/lib/exa-search';
245
+
246
+ const results = await searchWithExa('your query');
247
+ ```
248
+
249
+ ## 📄 License
250
+
251
+ MIT
@@ -1,83 +1,83 @@
1
- import { defineConfig } from 'astro/config';
2
- import react from '@astrojs/react';
3
- import vercel from '@astrojs/vercel';
4
- import clerk from '@clerk/astro';
5
- import { VitePWA } from 'vite-plugin-pwa';
6
-
7
- // https://astro.build/config
8
- export default defineConfig({
9
- output: 'server',
10
- adapter: vercel({
11
- imageService: true,
12
- }),
13
- image: {
14
- service: {
15
- entrypoint: 'astro/assets/services/noop',
16
- },
17
- },
18
- integrations: [
19
- react(),
20
- clerk({
21
- afterSignInUrl: '/',
22
- afterSignUpUrl: '/',
23
- }),
24
- ],
25
- vite: {
26
- plugins: [
27
- VitePWA({
28
- registerType: 'autoUpdate',
29
- includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'mask-icon.svg'],
30
- manifest: {
31
- name: 'ATSDC Stack App',
32
- short_name: 'ATSDC',
33
- description: 'Progressive Web App built with the ATSDC Stack',
34
- theme_color: '#ffffff',
35
- background_color: '#ffffff',
36
- display: 'standalone',
37
- icons: [
38
- {
39
- src: 'pwa-192x192.png',
40
- sizes: '192x192',
41
- type: 'image/png',
42
- },
43
- {
44
- src: 'pwa-512x512.png',
45
- sizes: '512x512',
46
- type: 'image/png',
47
- },
48
- {
49
- src: 'pwa-512x512.png',
50
- sizes: '512x512',
51
- type: 'image/png',
52
- purpose: 'any maskable',
53
- },
54
- ],
55
- },
56
- workbox: {
57
- globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
58
- runtimeCaching: [
59
- {
60
- urlPattern: /^https:\/\/api\./i,
61
- handler: 'NetworkFirst',
62
- options: {
63
- cacheName: 'api-cache',
64
- expiration: {
65
- maxEntries: 50,
66
- maxAgeSeconds: 60 * 60 * 24, // 24 hours
67
- },
68
- },
69
- },
70
- ],
71
- },
72
- }),
73
- ],
74
- css: {
75
- preprocessorOptions: {
76
- scss: {
77
- api: 'modern-compiler',
78
- additionalData: `@use "@/styles/variables/globals.scss" as *;`,
79
- },
80
- },
81
- },
82
- },
83
- });
1
+ import { defineConfig } from 'astro/config';
2
+ import react from '@astrojs/react';
3
+ import vercel from '@astrojs/vercel';
4
+ import clerk from '@clerk/astro';
5
+ import { VitePWA } from 'vite-plugin-pwa';
6
+
7
+ // https://astro.build/config
8
+ export default defineConfig({
9
+ output: 'server',
10
+ adapter: vercel({
11
+ imageService: true,
12
+ }),
13
+ image: {
14
+ service: {
15
+ entrypoint: 'astro/assets/services/noop',
16
+ },
17
+ },
18
+ integrations: [
19
+ react(),
20
+ clerk({
21
+ afterSignInUrl: '/',
22
+ afterSignUpUrl: '/',
23
+ }),
24
+ ],
25
+ vite: {
26
+ plugins: [
27
+ VitePWA({
28
+ registerType: 'autoUpdate',
29
+ includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'mask-icon.svg'],
30
+ manifest: {
31
+ name: 'ATSDC Stack App',
32
+ short_name: 'ATSDC',
33
+ description: 'Progressive Web App built with the ATSDC Stack',
34
+ theme_color: '#ffffff',
35
+ background_color: '#ffffff',
36
+ display: 'standalone',
37
+ icons: [
38
+ {
39
+ src: 'pwa-192x192.png',
40
+ sizes: '192x192',
41
+ type: 'image/png',
42
+ },
43
+ {
44
+ src: 'pwa-512x512.png',
45
+ sizes: '512x512',
46
+ type: 'image/png',
47
+ },
48
+ {
49
+ src: 'pwa-512x512.png',
50
+ sizes: '512x512',
51
+ type: 'image/png',
52
+ purpose: 'any maskable',
53
+ },
54
+ ],
55
+ },
56
+ workbox: {
57
+ globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
58
+ runtimeCaching: [
59
+ {
60
+ urlPattern: /^https:\/\/api\./i,
61
+ handler: 'NetworkFirst',
62
+ options: {
63
+ cacheName: 'api-cache',
64
+ expiration: {
65
+ maxEntries: 50,
66
+ maxAgeSeconds: 60 * 60 * 24, // 24 hours
67
+ },
68
+ },
69
+ },
70
+ ],
71
+ },
72
+ }),
73
+ ],
74
+ css: {
75
+ preprocessorOptions: {
76
+ scss: {
77
+ api: 'modern-compiler',
78
+ additionalData: `@use "@/styles/variables/globals.scss" as *;`,
79
+ },
80
+ },
81
+ },
82
+ },
83
+ });