create-atsdc-stack 1.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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(node -e:*)",
5
+ "Bash(git mv:*)",
6
+ "Bash(git add:*)"
7
+ ]
8
+ }
9
+ }
@@ -0,0 +1,342 @@
1
+ # Contributing to ATSDC Stack
2
+
3
+ Thank you for your interest in contributing to the ATSDC Stack! This document provides guidelines and instructions for contributing.
4
+
5
+ ## Code of Conduct
6
+
7
+ By participating in this project, you agree to maintain a respectful and inclusive environment for all contributors.
8
+
9
+ ## How to Contribute
10
+
11
+ ### Reporting Bugs
12
+
13
+ If you find a bug, please create an issue with:
14
+
15
+ 1. A clear, descriptive title
16
+ 2. Steps to reproduce the issue
17
+ 3. Expected behavior
18
+ 4. Actual behavior
19
+ 5. Your environment (OS, Node version, etc.)
20
+ 6. Screenshots (if applicable)
21
+
22
+ ### Suggesting Enhancements
23
+
24
+ We welcome feature requests! Please create an issue with:
25
+
26
+ 1. A clear, descriptive title
27
+ 2. Detailed description of the proposed feature
28
+ 3. Use cases and benefits
29
+ 4. Possible implementation approach (optional)
30
+
31
+ ### Pull Requests
32
+
33
+ 1. **Fork the repository**
34
+
35
+ ```bash
36
+ git clone https://github.com/yourusername/atsdc-stack.git
37
+ cd atsdc-stack
38
+ ```
39
+
40
+ 2. **Create a feature branch**
41
+
42
+ ```bash
43
+ git checkout -b feature/your-feature-name
44
+ ```
45
+
46
+ 3. **Make your changes**
47
+ - Follow the existing code style
48
+ - Write clear, concise commit messages
49
+ - Add tests if applicable
50
+ - Update documentation as needed
51
+
52
+ 4. **Test your changes**
53
+
54
+ ```bash
55
+ npm run build
56
+ npm run preview
57
+ ```
58
+
59
+ 5. **Commit your changes**
60
+
61
+ ```bash
62
+ git add .
63
+ git commit -m "feat: add amazing new feature"
64
+ ```
65
+
66
+ 6. **Push to your fork**
67
+
68
+ ```bash
69
+ git push origin feature/your-feature-name
70
+ ```
71
+
72
+ 7. **Create a Pull Request**
73
+ - Use a clear, descriptive title
74
+ - Reference any related issues
75
+ - Describe your changes in detail
76
+ - Include screenshots for UI changes
77
+
78
+ ## Development Guidelines
79
+
80
+ ### Code Style
81
+
82
+ #### TypeScript
83
+
84
+ - Use TypeScript for all new code
85
+ - Prefer interfaces over types for object shapes
86
+ - Use strict mode
87
+ - Avoid `any` - use `unknown` if necessary
88
+
89
+ ```typescript
90
+ // Good
91
+ interface User {
92
+ id: string;
93
+ name: string;
94
+ email: string;
95
+ }
96
+
97
+ // Avoid
98
+ type User = {
99
+ id: any;
100
+ name: any;
101
+ };
102
+ ```
103
+
104
+ #### SCSS Architecture
105
+
106
+ **Critical Rule**: Never use inline `<style>` tags in `.astro` files unless the component is completely self-standing and not part of the main layout.
107
+
108
+ ```astro
109
+ <!-- GOOD: External styles with data attributes (preferred) -->
110
+ ---
111
+ import '@/styles/components/button.scss';
112
+ ---
113
+ <button class="btn" data-variant="primary" data-size="lg">Click Me</button>
114
+ ```
115
+
116
+ ```astro
117
+ <!-- GOOD: External styles with class chaining (alternative) -->
118
+ ---
119
+ import '@/styles/components/button.scss';
120
+ ---
121
+ <button class="btn primary lg">Click Me</button>
122
+ ```
123
+
124
+ ```astro
125
+ <!-- BAD: Inline styles (avoid this) -->
126
+ <button class="btn">Click Me</button>
127
+ <style>
128
+ .btn { /* styles */ }
129
+ </style>
130
+ ```
131
+
132
+ **SCSS File Organization:**
133
+
134
+ - **Variables**: `src/styles/variables/globals.scss`
135
+ - **Mixins**: `src/styles/variables/mixins.scss`
136
+ - **Global styles**: `src/styles/global.scss`
137
+ - **Component styles**: `src/styles/components/[component-name].scss`
138
+ - **Page styles**: `src/styles/pages/[page-name].scss`
139
+
140
+ **Naming Conventions & Modifier Strategy:**
141
+
142
+ - Use **data attributes** for modifiers by default (preferred for state and variants)
143
+ - Use **class chaining** when data attributes aren't appropriate
144
+ - Use kebab-case for file names
145
+ - Prefix component-specific classes with component name
146
+ - Use BEM for elements only (not modifiers)
147
+
148
+ ```scss
149
+ // Component: Button
150
+ .btn {
151
+ @include button-base;
152
+
153
+ // Preferred: Data attribute modifiers
154
+ &[data-variant='primary'] { /* state/variant */ }
155
+ &[data-size='lg'] { /* size modifier */ }
156
+ &[data-state='loading'] { /* dynamic state */ }
157
+
158
+ // Alternative: Class chaining
159
+ &.primary { /* variant */ }
160
+ &.lg { /* size modifier */ }
161
+ &.loading { /* dynamic state */ }
162
+
163
+ // BEM for elements (still valid)
164
+ &__icon { /* element */ }
165
+ }
166
+ ```
167
+
168
+ **When to use data attributes vs. class chaining:**
169
+
170
+ - **Data attributes (preferred):**
171
+ - Dynamic states (loading, active, disabled)
172
+ - Variants (primary, secondary, success, danger)
173
+ - Configuration (size, padding, alignment)
174
+ - Semantic modifiers that describe state
175
+
176
+ - **Class chaining (when appropriate):**
177
+ - CSS-only solutions without JavaScript
178
+ - When data attributes feel verbose
179
+ - Simple utility classes
180
+ - When working with third-party libraries
181
+
182
+ #### Database Schema
183
+
184
+ - Use NanoID for primary keys
185
+ - Always define Zod schemas for validation
186
+ - Include timestamps (createdAt, updatedAt)
187
+ - Use descriptive column names
188
+
189
+ ```typescript
190
+ // Good
191
+ export const posts = pgTable('posts', {
192
+ id: varchar('id', { length: 21 })
193
+ .primaryKey()
194
+ .$defaultFn(() => nanoid()),
195
+ title: varchar('title', { length: 255 }).notNull(),
196
+ createdAt: timestamp('created_at').defaultNow().notNull(),
197
+ });
198
+
199
+ // Corresponding Zod schema
200
+ export const createPostSchema = z.object({
201
+ title: z.string().min(1).max(255),
202
+ });
203
+ ```
204
+
205
+ #### API Routes
206
+
207
+ - Always validate input with Zod
208
+ - Use proper HTTP status codes
209
+ - Return consistent response formats
210
+ - Handle errors gracefully
211
+
212
+ ```typescript
213
+ export const POST: APIRoute = async ({ request }) => {
214
+ try {
215
+ const body = await request.json();
216
+ const validated = schema.parse(body);
217
+
218
+ // ... process request
219
+
220
+ return new Response(
221
+ JSON.stringify({ data: result }),
222
+ { status: 200 }
223
+ );
224
+ } catch (error) {
225
+ if (error instanceof z.ZodError) {
226
+ return new Response(
227
+ JSON.stringify({ error: 'Validation error', details: error.errors }),
228
+ { status: 400 }
229
+ );
230
+ }
231
+ // ... handle other errors
232
+ }
233
+ };
234
+ ```
235
+
236
+ ### Commit Message Guidelines
237
+
238
+ We follow [Conventional Commits](https://www.conventionalcommits.org/):
239
+
240
+ ```text
241
+ type(scope): subject
242
+
243
+ body
244
+
245
+ footer
246
+ ```
247
+
248
+ **Types:**
249
+
250
+ - `feat`: New feature
251
+ - `fix`: Bug fix
252
+ - `docs`: Documentation changes
253
+ - `style`: Code style changes (formatting, etc.)
254
+ - `refactor`: Code refactoring
255
+ - `test`: Adding or updating tests
256
+ - `chore`: Maintenance tasks
257
+
258
+ **Examples:**
259
+
260
+ ```text
261
+ feat(auth): add OAuth integration with Google
262
+ fix(db): resolve connection pool timeout issue
263
+ docs(readme): update installation instructions
264
+ style(scss): reorganize component styles
265
+ refactor(api): simplify error handling
266
+ ```
267
+
268
+ ### Testing
269
+
270
+ - Test your changes locally before submitting
271
+ - Ensure the build passes: `npm run build`
272
+ - Check TypeScript types: `npx astro check`
273
+ - Test database migrations if applicable
274
+
275
+ ### Documentation
276
+
277
+ - Update README.md if you change functionality
278
+ - Add JSDoc comments to functions and components
279
+ - Update INSTALLATION.md for setup changes
280
+ - Include inline comments for complex logic
281
+
282
+ ## Project Structure Conventions
283
+
284
+ ```text
285
+ src/
286
+ ├── components/ # Reusable Astro components
287
+ │ └── ComponentName.astro
288
+ ├── db/ # Database layer
289
+ │ ├── client.ts # Database client
290
+ │ ├── schema.ts # Drizzle schemas
291
+ │ └── validations.ts # Zod schemas
292
+ ├── layouts/ # Layout components
293
+ │ └── Layout.astro
294
+ ├── pages/ # Routes and pages
295
+ │ ├── api/ # API routes
296
+ │ │ └── endpoint.ts
297
+ │ └── index.astro
298
+ └── styles/ # SCSS files
299
+ ├── components/ # Component styles
300
+ ├── pages/ # Page styles
301
+ ├── variables/
302
+ │ ├── globals.scss
303
+ │ └── mixins.scss
304
+ └── global.scss
305
+ ```
306
+
307
+ ## Adding New Dependencies
308
+
309
+ When adding a new dependency:
310
+
311
+ 1. Justify the need - avoid dependency bloat
312
+ 2. Check license compatibility (MIT preferred)
313
+ 3. Verify it's actively maintained
314
+ 4. Consider bundle size impact
315
+ 5. Update package.json and documentation
316
+
317
+ ## Release Process
318
+
319
+ Maintainers will handle releases:
320
+
321
+ 1. Update version in package.json
322
+ 2. Update CHANGELOG.md
323
+ 3. Create a git tag
324
+ 4. Publish to npm
325
+
326
+ ## Questions?
327
+
328
+ If you have questions:
329
+
330
+ 1. Check existing issues and discussions
331
+ 2. Review the documentation
332
+ 3. Create a new issue with the `question` label
333
+
334
+ ## Recognition
335
+
336
+ Contributors will be recognized in:
337
+
338
+ - README.md contributors section
339
+ - Release notes
340
+ - Project documentation
341
+
342
+ Thank you for contributing to ATSDC Stack!
@@ -0,0 +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!