@podosoft/podokit 1.4.0 → 1.4.2
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 +1 -1
- package/dist/deploy-compose-render.js +2 -1
- package/dist/deploy-render.js +14 -8
- package/dist/lockfile.d.ts +8 -1
- package/dist/lockfile.js +22 -3
- package/dist/templates/fullstack/AGENTS.md +22 -3
- package/dist/templates/fullstack/README.md +10 -7
- package/dist/templates/fullstack/apps/api/package.json +1 -1
- package/dist/templates/fullstack/apps/api/scripts/run-migrations.mjs +29 -0
- package/dist/templates/fullstack/apps/api/src/app.extensions.ts +3 -1
- package/dist/templates/fullstack/apps/api/src/database/database.spec.ts +84 -0
- package/dist/templates/fullstack/apps/api/src/database/database.ts +50 -5
- package/dist/templates/fullstack/apps/api/src/database/pool-guard.spec.ts +2 -2
- package/dist/templates/fullstack/apps/api/src/database/run-migrations.spec.ts +118 -0
- package/dist/templates/fullstack/apps/web/Dockerfile +1 -1
- package/dist/templates/fullstack/apps/web/src/error.html +73 -0
- package/dist/templates/fullstack/apps/web/src/lib/server/api.test.ts +116 -0
- package/dist/templates/fullstack/apps/web/src/lib/server/api.ts +34 -4
- package/dist/templates/fullstack/apps/web/src/lib/server/backend-proxy.test.ts +175 -0
- package/dist/templates/fullstack/apps/web/src/lib/server/backend-proxy.ts +170 -11
- package/dist/templates/fullstack/apps/web/src/routes/healthz/+server.ts +13 -0
- package/dist/templates/fullstack/dot-env.docker.example +4 -0
- package/dist/templates/fullstack/dot-env.example +7 -0
- package/dist/templates/fullstack/infra/k3s/web-deployment.yaml +6 -3
- package/dist/templates/fullstack/tests/api/health.api.spec.ts +8 -0
- package/dist/templates/modules/admin-dashboard/files/apps/api/src/admin-sessions/admin-sessions.migration.spec.ts +32 -3
- package/dist/templates/modules/admin-dashboard/files/apps/api/src/migrations/1792060000000-IndexSessionCreatedAt.ts +19 -1
- package/dist/templates/modules/admin-dashboard/files/apps/web/src/hooks.server.test.ts +24 -1
- package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/server/runtime-context.test.ts +6 -0
- package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/server/runtime-context.ts +5 -0
- package/dist/templates/modules/admin-dashboard/files/tests/api/auth-config.api.spec.ts +167 -154
- package/dist/templates/modules/admin-dashboard/files/tests/api/auth.api.spec.ts +94 -57
- package/dist/templates/modules/admin-dashboard/files/tests/api/exclusive.api.spec.ts +75 -0
- package/dist/templates/modules/admin-dashboard/files/tests/api/site-settings.api.spec.ts +49 -39
- package/dist/templates/modules/admin-dashboard/files/tests/helpers/exclusive.ts +80 -0
- package/dist/templates/modules/admin-dashboard/files/tests/ui/account.ui.spec.ts +47 -43
- package/dist/templates/modules/admin-dashboard/files/tests/ui/appearance.ui.spec.ts +15 -11
- package/dist/templates/modules/admin-dashboard/files/tests/ui/auth.ui.spec.ts +35 -31
- package/dist/templates/modules/admin-dashboard/files/tests/ui/general-effects.ui.spec.ts +90 -76
- package/dist/templates/modules/admin-dashboard/files/tests/ui/i18n.ui.spec.ts +19 -15
- package/dist/templates/modules/admin-dashboard/files/tests/ui/oidc.ui.spec.ts +17 -3
- package/dist/templates/modules/admin-dashboard/files/tests/ui/request-budget.ui.spec.ts +15 -6
- package/dist/templates/modules/admin-dashboard/files/tests/ui/settings-dialogs.ui.spec.ts +71 -64
- package/dist/templates/modules/admin-dashboard/files/tests/ui/settings.ui.spec.ts +89 -79
- package/dist/templates/modules/admin-dashboard/files/tests/ui/two-factor.ui.spec.ts +54 -50
- package/dist/templates/modules/audit-log/module.manifest.json +1 -1
- package/dist/templates/modules/auth/files/apps/api/src/auth/auth.ts +11 -5
- package/dist/templates/modules/auth/files/apps/api/src/auth/feature-gate.spec.ts +83 -0
- package/dist/templates/modules/auth/files/apps/api/src/auth/feature-gate.ts +51 -7
- package/dist/templates/modules/auth/module.manifest.json +0 -1
- package/dist/templates/modules/file-upload/files/tests/api/chunked-uploads.api.spec.ts +12 -6
- package/dist/templates/modules/file-upload/module.manifest.json +2 -2
- package/dist/templates/todo/AGENTS.md +10 -3
- package/dist/templates/todo/README.md +10 -8
- package/package.json +1 -1
- package/dist/templates/modules/auth/files/apps/api/scripts/run-migrations.mjs +0 -14
|
@@ -27,7 +27,7 @@ Provider selection does not migrate or delete existing data.
|
|
|
27
27
|
```bash
|
|
28
28
|
{{packageManager}} install
|
|
29
29
|
cp .env.example .env
|
|
30
|
-
{{apiRun}}
|
|
30
|
+
{{apiRun}} migrate:all
|
|
31
31
|
{{rootRun}} dev # api on http://localhost:5002, web on http://localhost:5001
|
|
32
32
|
```
|
|
33
33
|
|
|
@@ -50,10 +50,17 @@ Merge added module settings from `.env.example` into an existing `.env`.
|
|
|
50
50
|
`apps/web/src/lib/server/body-limits.ts` (`APP_BODY_LIMITS`, 413
|
|
51
51
|
`PAYLOAD_TOO_LARGE`). `BODY_SIZE_LIMIT` is the ceiling for every web route, so
|
|
52
52
|
uploads larger than it must use a direct API path (`apiPaths`) instead.
|
|
53
|
+
- When the root layout or a server hook fails, such as with 503 while the API is
|
|
54
|
+
down, SvelteKit serves the app-owned `apps/web/src/error.html`. It is plain HTML
|
|
55
|
+
with inline styles: no components, app CSS, scripts, or assets, and only the
|
|
56
|
+
`%sveltekit.status%` and `%sveltekit.error.message%` placeholders.
|
|
53
57
|
- Build: `{{rootRun}} build` · Type-check/lint: `{{rootRun}} lint` · Unit tests: `{{rootRun}} test`
|
|
54
58
|
- Per workspace: `{{apiRun}} build` / `{{webRun}} build`.
|
|
55
|
-
-
|
|
56
|
-
|
|
59
|
+
- Set up the database and apply later migrations, including after adding a module, with
|
|
60
|
+
`{{apiRun}} migrate:all` (PostgreSQL or SQLite). With `auth` installed it applies the
|
|
61
|
+
Better Auth schema before the application migrations. `{{apiRun}} migration:run` runs
|
|
62
|
+
only the application migrations and never creates Better Auth tables;
|
|
63
|
+
`{{apiRun}} migration:revert` reverts the latest application migration.
|
|
57
64
|
- e2e (Playwright, ships in `tests/`): `{{rootRun}} test:e2e`.
|
|
58
65
|
- Playwright officially runs on Node, so `bunx playwright` respects its Node
|
|
59
66
|
shebang. Node LTS is a test-tool dependency only; API, web, worker, migrations,
|
|
@@ -78,7 +78,7 @@ defaults in the example and credentials only in `.env.docker`.
|
|
|
78
78
|
In a second terminal, apply the included Todo migration and use the lifecycle helpers:
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
{{packageExecutor}} @podosoft/podokit dev exec api {{apiRun}}
|
|
81
|
+
{{packageExecutor}} @podosoft/podokit dev exec api {{apiRun}} migrate:all
|
|
82
82
|
{{packageExecutor}} @podosoft/podokit dev url
|
|
83
83
|
{{packageExecutor}} @podosoft/podokit dev up -d # detached stack without source watching
|
|
84
84
|
{{packageExecutor}} @podosoft/podokit dev ps
|
|
@@ -113,7 +113,7 @@ web and API processes on the host. Prepare the project first:
|
|
|
113
113
|
```bash
|
|
114
114
|
{{packageManager}} install
|
|
115
115
|
cp .env.example .env
|
|
116
|
-
{{apiRun}}
|
|
116
|
+
{{apiRun}} migrate:all
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
For PostgreSQL, start `docker compose -f infra/docker/docker-compose.yml up -d`
|
|
@@ -131,7 +131,7 @@ Run each service in a separate terminal from the project root:
|
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
- API: http://localhost:5002 — health at `/health`, docs at `/api-docs`
|
|
134
|
-
- Web: http://localhost:5001
|
|
134
|
+
- Web: http://localhost:5001 — its own health at `/healthz`, which never calls the API
|
|
135
135
|
|
|
136
136
|
For multi-project routing, container profiles, and OAuth over a stable HTTPS
|
|
137
137
|
tunnel, see the PodoKit [development guide](https://github.com/podosoft-dev/podokit/blob/main/docs/development.md).
|
|
@@ -143,13 +143,15 @@ runs PostgreSQL migrations; SQLite uses the local migration runner. A sample
|
|
|
143
143
|
Todo repository and initial migration are included.
|
|
144
144
|
|
|
145
145
|
```bash
|
|
146
|
-
{{apiRun}}
|
|
147
|
-
{{apiRun}} migration:revert # roll back the last
|
|
146
|
+
{{apiRun}} migrate:all # set up the database and apply new migrations
|
|
147
|
+
{{apiRun}} migration:revert # roll back the last application migration
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
`migrate:all` is the one command for setup, after adding a module, and in
|
|
151
|
+
production. When `auth` is installed, it applies the Better Auth schema before
|
|
152
|
+
the application migrations, so set the module's required environment values
|
|
153
|
+
first. `{{apiRun}} migration:run` runs only the application migrations and
|
|
154
|
+
never creates Better Auth tables.
|
|
153
155
|
|
|
154
156
|
## Deploy
|
|
155
157
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podosoft/podokit",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "An opinionated Bun and Elysia full-stack TypeScript starter toolkit and CLI with SvelteKit, TailwindCSS, shadcn-svelte, Docker, and k3s.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
|
|
4
|
-
const compiledEntry = new URL("../dist/migrate.js", import.meta.url);
|
|
5
|
-
const sourceEntry = new URL("../src/migrate.ts", import.meta.url);
|
|
6
|
-
const useCompiled = process.env.NODE_ENV === "production" && existsSync(compiledEntry);
|
|
7
|
-
const entry = useCompiled ? compiledEntry : sourceEntry;
|
|
8
|
-
const subprocess = Bun.spawn([process.execPath, fileURLToPath(entry)], {
|
|
9
|
-
stdin: "inherit",
|
|
10
|
-
stdout: "inherit",
|
|
11
|
-
stderr: "inherit",
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
process.exitCode = await subprocess.exited;
|