@yosr-ai/template-next-fullstack 0.1.0-alpha.0 → 0.1.0-alpha.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/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/features/api-trpc/files/src/server/api/context.ts +3 -5
- package/features/auth-authjs/files/src/app/api/auth/[...nextauth]/route.ts +4 -3
- package/features/deploy-docker/files/Dockerfile +2 -0
- package/features/deploy-docker-npm/files/Dockerfile +2 -0
- package/features/payments-stripe/files/src/server/billing/index.ts +5 -8
- package/files/src/app/page.tsx +1 -1
- package/package.json +1 -1
- package/rules/layout-feature.md +1 -1
- package/rules/layout-flat.md +4 -4
- package/rules/layout-layer.md +1 -1
- package/rules/project-overview.md +3 -3
- package/seed.template.json +10 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @yosr-ai/template-next-fullstack
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- A first Yosr Seed run through `create-yosr-seed` keeps the terminal, so the arrow-key menus appear instead of line prompts.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-alpha.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- An interactive Yosr Seed run closes with the next command when the gate is green, and points at `.seed/report.md` when the project was still written. On a terminal, the written folder, git, and the gate stay inside the prompt rail. The published Yosr Seed package rewrites every bundled `@yosr-ai/engine` import.
|
|
14
|
+
- Generated Yosr Seed projects record the choices made at setup and ask before departing from them. Flat aliases and unit-test paths match the layout, the home page follows the database choice, and standalone output is only for the Docker image build.
|
|
15
|
+
- Generated Yosr Seed projects pass every `ts.typeDefinitions` setting. Flat layout names `src/lib/server/` as the server-infrastructure area, with one level for `db/` and `auth/`.
|
|
16
|
+
|
|
3
17
|
## 0.1.0-alpha.0
|
|
4
18
|
|
|
5
19
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ For template authors; not rendered. Layout follows the template format spec.
|
|
|
9
9
|
- `features/orm-drizzle/`: Postgres + Drizzle overlay (replaces the in-memory notes store). `database: none` is the base without this overlay.
|
|
10
10
|
- `features/orm-prisma/`: Postgres + Prisma overlay (same role as Drizzle: schema, client, notes store via `replaces`). `prisma generate` runs on install. The generated client is not committed.
|
|
11
11
|
- `features/deploy-vercel/`: README section only.
|
|
12
|
-
- `features/deploy-docker/`: Dockerfile, `.dockerignore`, and `compose.yaml` for `deploy: docker`. `next
|
|
12
|
+
- `features/deploy-docker/`: Dockerfile, `.dockerignore`, and `compose.yaml` for `deploy: docker`. The `next-config` anchor turns on `output: "standalone"` only when `YOSR_STANDALONE=1`, which the Dockerfile sets for the image build. Local `next start` does not use standalone output. `features/deploy-docker-postgres/` adds a Postgres service to that compose file when `database` is `postgres`. The image build is a non-required gate step (`--image`).
|
|
13
13
|
- `style/errors-result/`: variant tree for `errors.pattern = result`.
|
|
14
14
|
- `rules/`: agent-rule fragments and the architecture note source.
|
|
15
15
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { insertNote } from "@domain/notes/notes-store";
|
|
2
2
|
|
|
3
|
-
export type ApiContext = {
|
|
4
|
-
insertNote: typeof insertNote;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
3
|
/** Request context. Importing the store does not open a database. */
|
|
8
|
-
export function createContext()
|
|
4
|
+
export function createContext() {
|
|
9
5
|
return { insertNote };
|
|
10
6
|
}
|
|
7
|
+
|
|
8
|
+
export type ApiContext = ReturnType<typeof createContext>;
|
|
@@ -3,9 +3,10 @@ import NextAuth from "next-auth";
|
|
|
3
3
|
|
|
4
4
|
import { authOptions } from "@server/auth/config";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
async function handler(
|
|
7
|
+
req: NextRequest,
|
|
8
|
+
context: { params: Promise<{ nextauth: string[] }> },
|
|
9
|
+
) {
|
|
9
10
|
return NextAuth(req, context, authOptions());
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -8,6 +8,8 @@ ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
|
|
8
8
|
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
9
9
|
RUN corepack enable && __seed_pmInstallCi__
|
|
10
10
|
COPY . .
|
|
11
|
+
# Standalone output is for this image only. Local `next start` leaves this unset.
|
|
12
|
+
ENV YOSR_STANDALONE=1
|
|
11
13
|
RUN __seed_pmRun__ build
|
|
12
14
|
|
|
13
15
|
FROM node:24 AS runner
|
|
@@ -8,6 +8,8 @@ ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
|
|
8
8
|
COPY package.json package-lock.json ./
|
|
9
9
|
RUN npm ci
|
|
10
10
|
COPY . .
|
|
11
|
+
# Standalone output is for this image only. Local `next start` leaves this unset.
|
|
12
|
+
ENV YOSR_STANDALONE=1
|
|
11
13
|
RUN __seed_pmRun__ build
|
|
12
14
|
|
|
13
15
|
FROM node:24 AS runner
|
|
@@ -7,13 +7,6 @@ import {
|
|
|
7
7
|
} from "./store";
|
|
8
8
|
import { stripeClient } from "./stripe";
|
|
9
9
|
|
|
10
|
-
export type BillingUpdate = {
|
|
11
|
-
stripeCustomerId: string;
|
|
12
|
-
stripeSubscriptionId: string;
|
|
13
|
-
status: string;
|
|
14
|
-
priceId: string | null;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
10
|
function asRecord(value: unknown): Record<string, unknown> | null {
|
|
18
11
|
if (typeof value !== "object" || value === null) return null;
|
|
19
12
|
return value as Record<string, unknown>;
|
|
@@ -27,7 +20,7 @@ function stringField(value: unknown, key: string): string | null {
|
|
|
27
20
|
}
|
|
28
21
|
|
|
29
22
|
/** Maps a verified subscription or checkout event onto the billing tables. */
|
|
30
|
-
export function billingUpdateFromEvent(event: Stripe.Event)
|
|
23
|
+
export function billingUpdateFromEvent(event: Stripe.Event) {
|
|
31
24
|
const object: unknown = event.data.object;
|
|
32
25
|
if (event.type === "checkout.session.completed") {
|
|
33
26
|
const stripeCustomerId = stringField(object, "customer");
|
|
@@ -66,6 +59,10 @@ export function billingUpdateFromEvent(event: Stripe.Event): BillingUpdate | nul
|
|
|
66
59
|
return { stripeCustomerId, stripeSubscriptionId, status, priceId };
|
|
67
60
|
}
|
|
68
61
|
|
|
62
|
+
export type BillingUpdate = NonNullable<
|
|
63
|
+
ReturnType<typeof billingUpdateFromEvent>
|
|
64
|
+
>;
|
|
65
|
+
|
|
69
66
|
export async function createCheckoutSession(input: {
|
|
70
67
|
userEmail: string;
|
|
71
68
|
priceId: string;
|
package/files/src/app/page.tsx
CHANGED
|
@@ -12,7 +12,7 @@ export default async function HomePage() {
|
|
|
12
12
|
<main className="mx-auto flex max-w-xl flex-col gap-6 p-8">
|
|
13
13
|
<h1 className="text-2xl font-semibold">__seed_projectName__</h1>
|
|
14
14
|
<p className="text-sm text-muted-foreground">
|
|
15
|
-
Example feature: notes,
|
|
15
|
+
Example feature: notes, __seed_homeStorage__.
|
|
16
16
|
</p>
|
|
17
17
|
<NoteForm />
|
|
18
18
|
<NoteList notes={notes} />
|
package/package.json
CHANGED
package/rules/layout-feature.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Code is grouped **by feature**:
|
|
2
2
|
|
|
3
3
|
- `__seed_domainDir__/<feature>/` holds that feature's server functions, server actions, zod schemas, and tests. Feature UI lives in `__seed_featureUiDir__/` (on the default tree, the `components/` folder inside the feature).
|
|
4
|
-
- Code shared by several features goes in `__seed_sharedDir__/`.
|
|
4
|
+
- Code shared by several features goes in `__seed_sharedDir__/`.
|
|
5
5
|
- Routes in `src/app/` stay thin: they compose feature components and call feature functions.
|
package/rules/layout-flat.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
**Flat** means one folder per area under `src/lib/` and `src/components/`, no deeper nesting.
|
|
2
2
|
|
|
3
|
-
-
|
|
4
|
-
-
|
|
5
|
-
- Don't add
|
|
3
|
+
- Notes logic is `src/lib/notes/`. Shared helpers are `src/lib/shared/`. Feature UI is `src/components/notes/`. shadcn/ui stays in `src/components/ui/`.
|
|
4
|
+
- Routes stay in `src/app/`.
|
|
5
|
+
- `src/lib/server/` is the server-infrastructure area. It has one level for `db/` and `auth/` (`src/lib/server/db/`, `src/lib/server/auth/`). Don't add a folder inside any other area, and don't nest further under `db/` or `auth/`.
|
package/rules/layout-layer.md
CHANGED
|
@@ -2,5 +2,5 @@ Code is grouped **by technical layer**:
|
|
|
2
2
|
|
|
3
3
|
- Domain logic lives in `__seed_domainDir__/<area>/` (server functions, actions, schemas).
|
|
4
4
|
- Feature UI lives in `__seed_featureUiDir__/`.
|
|
5
|
-
- Shared helpers go in `__seed_sharedDir__/`; shadcn/ui stays in `src/components/ui
|
|
5
|
+
- Shared helpers go in `__seed_sharedDir__/`; shadcn/ui stays in `src/components/ui/`.
|
|
6
6
|
- Routes in `src/app/` stay thin.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
`__seed_projectName__` is a Next.js (App Router) + TypeScript app with Tailwind CSS and shadcn/ui, generated by Yosr Seed from `__seed_templateName__@__seed_templateVersion__`. Data: __seed_storageLabel__. API style:
|
|
1
|
+
`__seed_projectName__` is a Next.js (App Router) + TypeScript app with Tailwind CSS and shadcn/ui, generated by Yosr Seed from `__seed_templateName__@__seed_templateVersion__`. Data: __seed_storageLabel__. API style: __seed_api__.
|
|
2
2
|
|
|
3
3
|
- Read `docs/architecture.md` before larger changes; it lists the folder map and where new code goes.
|
|
4
|
-
- Import across folders through the path aliases in `tsconfig.json` (
|
|
5
|
-
-
|
|
4
|
+
- Import across folders through the path aliases in `tsconfig.json` (__seed_aliasList__).
|
|
5
|
+
- `.seed/` is a record of what Yosr Seed generated. The app never reads it. It is not edited by hand. It can drift from the project after later changes such as adding a database.
|
package/seed.template.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "../../../docs/engineering/schemas/seed.template.schema.json",
|
|
3
3
|
"schemaVersion": "0.1",
|
|
4
4
|
"name": "next-fullstack",
|
|
5
|
-
"version": "0.1.0-alpha.
|
|
5
|
+
"version": "0.1.0-alpha.2",
|
|
6
6
|
"title": "Next.js full-stack (TypeScript)",
|
|
7
7
|
"description": "Prototype of Yosr Seed's first base template (Next.js + TypeScript, Tailwind + shadcn/ui, Vitest + Playwright smoke test). Implemented: base files with the ADR 0006 defaults, the orm-drizzle and orm-prisma overlays (database=postgres), database=none (base without either overlay), deploy=docker (standalone image, compose Postgres only when database=postgres), Auth.js, Clerk, tRPC, Stripe, and a recorded AI delta for domain-features. x-prototype.stubbedFeatures is empty. Dependency versions pinned from the npm registry on 2026-10-19 (Prisma adapter on 2026-10-28, Clerk on 2026-10-28, tRPC on 2026-10-29, Stripe on 2026-10-29).",
|
|
8
8
|
"license": "MIT",
|
|
@@ -59,6 +59,13 @@
|
|
|
59
59
|
"none": "memory only (no database)",
|
|
60
60
|
"postgres": "Postgres"
|
|
61
61
|
}
|
|
62
|
+
},
|
|
63
|
+
"homeStorage": {
|
|
64
|
+
"fromOption": "database",
|
|
65
|
+
"map": {
|
|
66
|
+
"none": "kept in memory",
|
|
67
|
+
"postgres": "stored in Postgres"
|
|
68
|
+
}
|
|
62
69
|
}
|
|
63
70
|
},
|
|
64
71
|
"options": [
|
|
@@ -868,7 +875,7 @@
|
|
|
868
875
|
"op": "insert",
|
|
869
876
|
"target": "next.config.ts",
|
|
870
877
|
"anchor": "next-config",
|
|
871
|
-
"content": "output: \"standalone\","
|
|
878
|
+
"content": "...(process.env.YOSR_STANDALONE === \"1\" ? { output: \"standalone\" as const } : {}),"
|
|
872
879
|
}
|
|
873
880
|
]
|
|
874
881
|
},
|
|
@@ -954,7 +961,7 @@
|
|
|
954
961
|
"flat": {
|
|
955
962
|
"pathMap": {
|
|
956
963
|
"@domain": "src/lib",
|
|
957
|
-
"@shared": "src/lib",
|
|
964
|
+
"@shared": "src/lib/shared",
|
|
958
965
|
"@server": "src/lib/server",
|
|
959
966
|
"@featureUi": "src/components/notes"
|
|
960
967
|
},
|