also looking at this
chore: wip stx improvements
#1649
241 files
+19022
-1323
| @@ -9,7 +9,7 @@ | ||
| 9 | 9 | - [x] Implement `.env` file loader using `Bun.env` |
| 10 | 10 | - [x] Implement `validateEnv()` with startup error reporting |
| 11 | 11 | - [x] Migrate `env.ts` helpers (`isProduction`, `isDevelopment`) into this package |
| 12 | - [ ] Add re-export shim in core `stx` package for backwards compat | |
| 12 | - [x] Add re-export shim in core `stx` package for backwards compat | |
| 13 | 13 | - [x] Add `@stacksjs/config` to root `tsconfig.json` paths |
| 14 | 14 | - [x] Add to workspace in root `package.json` |
| 15 | 15 | - [x] Write tests for all env types, defaults, required fields, validation |
| @@ -24,8 +24,8 @@ | ||
| 24 | 24 | - [x] Extract SPA client script from `stx/src/client/index.ts` |
| 25 | 25 | - [x] Implement nested layout resolution (`_layout.stx` chain) |
| 26 | 26 | - [x] Implement route type generation (`.stx/route-types.d.ts`) |
| 27 | - [ ] Update `dev-server.ts` and `bun-plugin/src/serve.ts` to import from `@stacksjs/router` | |
| 28 | - [ ] Add re-export shims in core `stx` for backwards compat | |
| 27 | - [x] Update `dev-server.ts` and `bun-plugin/src/serve.ts` to import from `@stacksjs/router` | |
| 28 | - [x] Add re-export shims in core `stx` for backwards compat | |
| 29 | 29 | - [x] Write tests for: file scanning, pattern matching, dynamic params, middleware chain, layout nesting, named routes |
| 30 | 30 | - [x] Add to `tsconfig.json` paths and workspace |
| 31 | 31 | |
| @@ -37,8 +37,8 @@ | ||
| 37 | 37 | - [x] Implement `useAsyncData()` and `useFetch()` composables |
| 38 | 38 | - [x] Implement loader result caching with stale-while-revalidate |
| 39 | 39 | - [x] Implement safe serialization (handle Dates, BigInt, etc.) |
| 40 | - [ ] Integrate loader execution into dev-server request pipeline | |
| 41 | - [ ] Integrate actions with `@form` directive | |
| 40 | - [x] Integrate loader execution into dev-server request pipeline | |
| 41 | - [x] Integrate actions with `@form` directive | |
| 42 | 42 | - [x] Write tests for loaders, actions, composables, caching, serialization |
| 43 | 43 | - [x] Add to `tsconfig.json` paths and workspace |
| 44 | 44 | |
| @@ -49,8 +49,8 @@ | ||
| 49 | 49 | - [x] Implement `bunServerAdapter` with compression, static file serving, TLS |
| 50 | 50 | - [x] Implement `staticAdapter` wrapping existing SSG |
| 51 | 51 | - [x] Extract platform detection from `edge-runtime.ts` |
| 52 | - [ ] Integrate with production build pipeline | |
| 53 | - [ ] Add `stx deploy` CLI command | |
| 52 | - [x] Integrate with production build pipeline | |
| 53 | - [x] Add `stx deploy` CLI command | |
| 54 | 54 | - [x] Write tests for each adapter |
| 55 | 55 | - [x] Add to `tsconfig.json` paths and workspace |
| 56 | 56 | |
| @@ -60,61 +60,61 @@ | ||
| 60 | 60 | |
| 61 | 61 | ### 5. `@stacksjs/db` — Database & ORM |
| 62 | 62 | |
| 63 | - [ ] Create `packages/db/` with standard package structure | |
| 64 | - [ ] Extract `QueryBuilder`, `Model`, adapters from `database.ts` | |
| 65 | - [ ] Implement `defineTable()` schema builder | |
| 66 | - [ ] Implement `TableBuilder` with all column types | |
| 67 | - [ ] Implement migration runner | |
| 68 | - [ ] Implement auto-migrate for development | |
| 69 | - [ ] Implement database seeder | |
| 70 | - [ ] Add re-export shim in core `stx` package | |
| 71 | - [ ] Write comprehensive tests | |
| 72 | - [ ] Add to `tsconfig.json` paths and workspace | |
| 63 | - [x] Create `packages/db/` with standard package structure | |
| 64 | - [x] Extract `QueryBuilder`, `Model`, adapters from `database.ts` | |
| 65 | - [x] Implement `defineTable()` schema builder | |
| 66 | - [x] Implement `TableBuilder` with all column types | |
| 67 | - [x] Implement migration runner | |
| 68 | - [x] Implement auto-migrate for development | |
| 69 | - [x] Implement database seeder | |
| 70 | - [x] Add re-export shim in core `stx` package | |
| 71 | - [x] Write comprehensive tests | |
| 72 | - [x] Add to `tsconfig.json` paths and workspace | |
| 73 | 73 | |
| 74 | 74 | ### 6. `@stacksjs/auth` — Authentication & Authorization |
| 75 | 75 | |
| 76 | - [ ] Create `packages/auth/` with standard package structure | |
| 77 | - [ ] Implement session management (create, validate, destroy) | |
| 78 | - [ ] Implement password hashing (bcrypt via Bun) | |
| 79 | - [ ] Implement OAuth flow (GitHub, Google providers) | |
| 80 | - [ ] Implement auth/guest middleware | |
| 81 | - [ ] Implement permissions system | |
| 82 | - [ ] Create scaffold templates (login, register, forgot-password, reset-password) | |
| 83 | - [ ] Extract CSRF logic from `forms.ts` | |
| 84 | - [ ] Wire up `@auth`/`@guest`/`@can` directive backends | |
| 85 | - [ ] Write tests for all auth flows | |
| 86 | - [ ] Add to `tsconfig.json` paths and workspace | |
| 76 | - [x] Create `packages/auth/` with standard package structure | |
| 77 | - [x] Implement session management (create, validate, destroy) | |
| 78 | - [x] Implement password hashing (bcrypt via Bun) | |
| 79 | - [x] Implement OAuth flow (GitHub, Google providers) | |
| 80 | - [x] Implement auth/guest middleware | |
| 81 | - [x] Implement permissions system | |
| 82 | - [x] Create scaffold templates (login, register, forgot-password, reset-password) | |
| 83 | - [x] Extract CSRF logic from `forms.ts` | |
| 84 | - [x] Wire up `@auth`/`@guest`/`@can` directive backends | |
| 85 | - [x] Write tests for all auth flows | |
| 86 | - [x] Add to `tsconfig.json` paths and workspace | |
| 87 | 87 | |
| 88 | 88 | ### 7. `@stacksjs/api` — File-Based API Routes + Type-Safe RPC |
| 89 | 89 | |
| 90 | - [ ] Create `packages/api/` with standard package structure | |
| 91 | - [ ] Implement `defineHandler()` with method, input validation, middleware | |
| 92 | - [ ] Implement file-based API route scanning | |
| 93 | - [ ] Implement typed RPC client generation | |
| 94 | - [ ] Integrate API route handling into dev-server | |
| 95 | - [ ] Write tests | |
| 96 | - [ ] Add to workspace | |
| 90 | - [x] Create `packages/api/` with standard package structure | |
| 91 | - [x] Implement `defineHandler()` with method, input validation, middleware | |
| 92 | - [x] Implement file-based API route scanning | |
| 93 | - [x] Implement typed RPC client generation | |
| 94 | - [x] Integrate API route handling into dev-server | |
| 95 | - [x] Write tests | |
| 96 | - [x] Add to workspace | |
| 97 | 97 | |
| 98 | 98 | ### 8. `@stacksjs/forms` — Form State + Validation + Server Actions |
| 99 | 99 | |
| 100 | - [ ] Create `packages/forms/` with standard package structure | |
| 101 | - [ ] Extract `Validator` class from `forms-validation.ts` | |
| 102 | - [ ] Implement `useForm()` composable | |
| 103 | - [ ] Implement Zod schema integration | |
| 104 | - [ ] Integrate with `@form` directive and server actions | |
| 105 | - [ ] Write tests | |
| 106 | - [ ] Add to workspace | |
| 100 | - [x] Create `packages/forms/` with standard package structure | |
| 101 | - [x] Extract `Validator` class from `forms-validation.ts` | |
| 102 | - [x] Implement `useForm()` composable | |
| 103 | - [x] Implement Zod schema integration | |
| 104 | - [x] Integrate with `@form` directive and server actions | |
| 105 | - [x] Write tests | |
| 106 | - [x] Add to workspace | |
| 107 | 107 | |
| 108 | 108 | ### 9. `@stacksjs/cache` — Multi-Driver Caching |
| 109 | 109 | |
| 110 | - [ ] Create `packages/cache/` with standard package structure | |
| 111 | - [ ] Implement memory driver (LRU) | |
| 112 | - [ ] Implement file driver (from existing `caching.ts`) | |
| 113 | - [ ] Implement SQLite driver (using `bun:sqlite`) | |
| 114 | - [ ] Implement `remember()` and tag-based invalidation | |
| 115 | - [ ] Integrate with ISR | |
| 116 | - [ ] Write tests | |
| 117 | - [ ] Add to workspace | |
| 110 | - [x] Create `packages/cache/` with standard package structure | |
| 111 | - [x] Implement memory driver (LRU) | |
| 112 | - [x] Implement file driver (from existing `caching.ts`) | |
| 113 | - [x] Implement SQLite driver (using `bun:sqlite`) | |
| 114 | - [x] Implement `remember()` and tag-based invalidation | |
| 115 | - [x] Integrate with ISR | |
| 116 | - [x] Write tests | |
| 117 | - [x] Add to workspace | |
| 118 | 118 | |
| 119 | 119 | --- |
| 120 | 120 | |
| @@ -122,45 +122,45 @@ | ||
| 122 | 122 | |
| 123 | 123 | ### 10. `@stacksjs/email` — Email with STX Templates |
| 124 | 124 | |
| 125 | - [ ] Create `packages/email/` with standard package structure | |
| 126 | - [ ] Implement `sendMail()` with STX template rendering | |
| 127 | - [ ] Implement provider adapters (Resend, SES, SMTP) | |
| 128 | - [ ] Write tests | |
| 129 | - [ ] Add to workspace | |
| 125 | - [x] Create `packages/email/` with standard package structure | |
| 126 | - [x] Implement `sendMail()` with STX template rendering | |
| 127 | - [x] Implement provider adapters (Resend, SES, SMTP) | |
| 128 | - [x] Write tests | |
| 129 | - [x] Add to workspace | |
| 130 | 130 | |
| 131 | 131 | ### 11. `@stacksjs/storage` — File Storage Abstraction |
| 132 | 132 | |
| 133 | - [ ] Create `packages/storage/` with standard package structure | |
| 134 | - [ ] Implement local disk driver | |
| 135 | - [ ] Implement S3/R2 driver with signed URLs | |
| 136 | - [ ] Write tests | |
| 137 | - [ ] Add to workspace | |
| 133 | - [x] Create `packages/storage/` with standard package structure | |
| 134 | - [x] Implement local disk driver | |
| 135 | - [x] Implement S3/R2 driver with signed URLs | |
| 136 | - [x] Write tests | |
| 137 | - [x] Add to workspace | |
| 138 | 138 | |
| 139 | 139 | ### 12. `@stacksjs/testing` — Test Utilities |
| 140 | 140 | |
| 141 | - [ ] Create `packages/testing/` with standard package structure | |
| 142 | - [ ] Implement `renderTemplate()` for template testing | |
| 143 | - [ ] Implement `testLoader()` and `testAction()` helpers | |
| 144 | - [ ] Write tests | |
| 145 | - [ ] Add to workspace | |
| 141 | - [x] Create `packages/testing/` with standard package structure | |
| 142 | - [x] Implement `renderTemplate()` for template testing | |
| 143 | - [x] Implement `testLoader()` and `testAction()` helpers | |
| 144 | - [x] Write tests | |
| 145 | - [x] Add to workspace | |
| 146 | 146 | |
| 147 | 147 | ### 13. `@stacksjs/errors` — Error Boundaries & Dev Overlay |
| 148 | 148 | |
| 149 | - [ ] Create `packages/errors/` with standard package structure | |
| 150 | - [ ] Implement `defineErrorBoundary()` | |
| 151 | - [ ] Implement dev overlay HTML | |
| 152 | - [ ] Implement production fallback pages | |
| 153 | - [ ] Write tests | |
| 154 | - [ ] Add to workspace | |
| 149 | - [x] Create `packages/errors/` with standard package structure | |
| 150 | - [x] Implement `defineErrorBoundary()` | |
| 151 | - [x] Implement dev overlay HTML | |
| 152 | - [x] Implement production fallback pages | |
| 153 | - [x] Write tests | |
| 154 | - [x] Add to workspace | |
| 155 | 155 | |
| 156 | 156 | ### 14. `@stacksjs/image` — Image Optimization |
| 157 | 157 | |
| 158 | - [ ] Create `packages/image/` with standard package structure | |
| 159 | - [ ] Implement responsive image generation | |
| 160 | - [ ] Implement WebP/AVIF conversion | |
| 161 | - [ ] Implement `@img` directive | |
| 162 | - [ ] Write tests | |
| 163 | - [ ] Add to workspace | |
| 158 | - [x] Create `packages/image/` with standard package structure | |
| 159 | - [x] Implement responsive image generation | |
| 160 | - [x] Implement WebP/AVIF conversion | |
| 161 | - [x] Implement `@img` directive | |
| 162 | - [x] Write tests | |
| 163 | - [x] Add to workspace | |
| 164 | 164 | |
| 165 | 165 | --- |
| 166 | 166 | |
| @@ -168,54 +168,54 @@ | ||
| 168 | 168 | |
| 169 | 169 | ### 15. `@stacksjs/realtime` — WebSocket Channels + SSE |
| 170 | 170 | |
| 171 | - [ ] Create `packages/realtime/` with standard package structure | |
| 172 | - [ ] Implement WebSocket channel management | |
| 173 | - [ ] Implement SSE fallback | |
| 174 | - [ ] Implement `useBroadcast()` composable | |
| 175 | - [ ] Write tests | |
| 176 | - [ ] Add to workspace | |
| 171 | - [x] Create `packages/realtime/` with standard package structure | |
| 172 | - [x] Implement WebSocket channel management | |
| 173 | - [x] Implement SSE fallback | |
| 174 | - [x] Implement `useBroadcast()` composable | |
| 175 | - [x] Write tests | |
| 176 | - [x] Add to workspace | |
| 177 | 177 | |
| 178 | 178 | ### 16. `@stacksjs/queue` — Background Jobs |
| 179 | 179 | |
| 180 | - [ ] Create `packages/queue/` with standard package structure | |
| 181 | - [ ] Implement SQLite-backed job queue | |
| 182 | - [ ] Implement `defineJob()` and `dispatch()` | |
| 183 | - [ ] Implement retry logic and dead letter queue | |
| 184 | - [ ] Write tests | |
| 185 | - [ ] Add to workspace | |
| 180 | - [x] Create `packages/queue/` with standard package structure | |
| 181 | - [x] Implement SQLite-backed job queue | |
| 182 | - [x] Implement `defineJob()` and `dispatch()` | |
| 183 | - [x] Implement retry logic and dead letter queue | |
| 184 | - [x] Write tests | |
| 185 | - [x] Add to workspace | |
| 186 | 186 | |
| 187 | 187 | ### 17. `@stacksjs/search` — Full-Text Search |
| 188 | 188 | |
| 189 | - [ ] Create `packages/search/` with standard package structure | |
| 190 | - [ ] Implement SQLite FTS5 driver | |
| 191 | - [ ] Implement `defineSearchable()` and `search()` | |
| 192 | - [ ] Write tests | |
| 193 | - [ ] Add to workspace | |
| 189 | - [x] Create `packages/search/` with standard package structure | |
| 190 | - [x] Implement SQLite FTS5 driver | |
| 191 | - [x] Implement `defineSearchable()` and `search()` | |
| 192 | - [x] Write tests | |
| 193 | - [x] Add to workspace | |
| 194 | 194 | |
| 195 | 195 | ### 18. `@stacksjs/ai` — LLM Integration |
| 196 | 196 | |
| 197 | - [ ] Create `packages/ai/` with standard package structure | |
| 198 | - [ ] Implement `useAI()` with provider adapters | |
| 199 | - [ ] Implement streaming support | |
| 200 | - [ ] Write tests | |
| 201 | - [ ] Add to workspace | |
| 197 | - [x] Create `packages/ai/` with standard package structure | |
| 198 | - [x] Implement `useAI()` with provider adapters | |
| 199 | - [x] Implement streaming support | |
| 200 | - [x] Write tests | |
| 201 | - [x] Add to workspace | |
| 202 | 202 | |
| 203 | 203 | ### 19. `@stacksjs/cms` — File-Based Content Collections |
| 204 | 204 | |
| 205 | - [ ] Create `packages/cms/` with standard package structure | |
| 206 | - [ ] Implement `defineCollection()` with typed schemas | |
| 207 | - [ ] Implement `getContent()` and collection queries | |
| 208 | - [ ] Write tests | |
| 209 | - [ ] Add to workspace | |
| 205 | - [x] Create `packages/cms/` with standard package structure | |
| 206 | - [x] Implement `defineCollection()` with typed schemas | |
| 207 | - [x] Implement `getContent()` and collection queries | |
| 208 | - [x] Write tests | |
| 209 | - [x] Add to workspace | |
| 210 | 210 | |
| 211 | 211 | ### 20. `@stacksjs/analytics` — Privacy-Friendly Analytics |
| 212 | 212 | |
| 213 | - [ ] Create `packages/analytics/` with standard package structure | |
| 214 | - [ ] Implement SQLite-backed page view tracking | |
| 215 | - [ ] Implement `@analytics` directive | |
| 216 | - [ ] Implement dashboard queries | |
| 217 | - [ ] Write tests | |
| 218 | - [ ] Add to workspace | |
| 213 | - [x] Create `packages/analytics/` with standard package structure | |
| 214 | - [x] Implement SQLite-backed page view tracking | |
| 215 | - [x] Implement `@analytics` directive | |
| 216 | - [x] Implement dashboard queries | |
| 217 | - [x] Write tests | |
| 218 | - [x] Add to workspace | |
| 219 | 219 | |
| 220 | 220 | --- |
| 221 | 221 | |