From 977dd6da87fa76d0ab8c8fc3e5f352c1918e176a Mon Sep 17 00:00:00 2001 From: adi-IL Date: Sat, 22 Aug 2026 03:32:22 +0530 Subject: [PATCH 1/3] fix: provide browser login snippet in dev-session Print a DevTools console one-liner when dev:session runs interactively, and document the workflow on the sign-in empty state and setup docs. Fixes #100 --- README.md | 3 ++- apps/api/scripts/dev-session.ts | 11 ++++++++++- apps/app/app/(landing)/sign-in/page.tsx | 6 ++++-- docs/setup.md | 4 ++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c761ebff6..4f6247d94 100644 --- a/README.md +++ b/README.md @@ -335,7 +335,8 @@ Scope any of them with a Turborepo filter: `bun run dev --filter=api`. Because sign-in goes through an identity provider, there is no way to get a session from a terminal — `dev:session` writes the rows Better Auth would have written and prints the cookie it -would have set. It refuses to run with `NODE_ENV=production`. +would have set, along with a console snippet to log in directly on `http://localhost:3000`. +It refuses to run with `NODE_ENV=production`. ## Deploying diff --git a/apps/api/scripts/dev-session.ts b/apps/api/scripts/dev-session.ts index 8df9b3dd5..d0b60e8ef 100644 --- a/apps/api/scripts/dev-session.ts +++ b/apps/api/scripts/dev-session.ts @@ -62,6 +62,15 @@ await db.session.upsert({ update: { expiresAt }, }); -console.log(`${COOKIE_NAME}=${await signCookieValue(token)}`); +const cookieValue = await signCookieValue(token); +console.log(`${COOKIE_NAME}=${cookieValue}`); + +if (process.stdout.isTTY) { + console.log("\nTo sign in on http://localhost:3000:"); + console.log("Paste this in the DevTools Console (F12) and press Enter:\n"); + console.log( + ` document.cookie = "${COOKIE_NAME}=${cookieValue}; path=/; max-age=${SESSION_DAYS * 86400}"; location.href = "/";\n`, + ); +} await db.$disconnect(); diff --git a/apps/app/app/(landing)/sign-in/page.tsx b/apps/app/app/(landing)/sign-in/page.tsx index 5b0e451af..4891539c4 100644 --- a/apps/app/app/(landing)/sign-in/page.tsx +++ b/apps/app/app/(landing)/sign-in/page.tsx @@ -95,8 +95,10 @@ async function SignIn({

Set GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET — or MICROSOFT_CLIENT_ID - and MICROSOFT_CLIENT_SECRET — in the root .env file and restart. Your - own identity provider can be added from Settings once somebody is + and MICROSOFT_CLIENT_SECRET — in the root .env file and restart. For + local development without OAuth, mint a session with{" "} + bun run --filter=api dev:session. + Your own identity provider can be added from Settings once somebody is signed in.

diff --git a/docs/setup.md b/docs/setup.md index 03b8912f7..678582286 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -24,6 +24,10 @@ run needs `db:migrate` only for the seed that follows it. When the database and they do not match — reconcile with `db:migrate`, or `db:reset` when the divergence is an edited migration that has already been applied. +When developing without Google or Microsoft OAuth configured, mint a local session +with `bun run --filter=api dev:session` and paste the printed snippet into the +browser DevTools Console on `http://localhost:3000` to sign in. + ## Google Cloud - **Enable the Gmail API and the Google Calendar API** on the project. From dd99f5e5d9590ea35945d3ca8e130ab8eaf6b471 Mon Sep 17 00:00:00 2001 From: adi-IL Date: Sat, 22 Aug 2026 03:47:15 +0530 Subject: [PATCH 2/3] fix: write dev-session diagnostics to stderr and respect APP_URL --- apps/api/scripts/dev-session.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/api/scripts/dev-session.ts b/apps/api/scripts/dev-session.ts index d0b60e8ef..7964f97f2 100644 --- a/apps/api/scripts/dev-session.ts +++ b/apps/api/scripts/dev-session.ts @@ -65,10 +65,11 @@ await db.session.upsert({ const cookieValue = await signCookieValue(token); console.log(`${COOKIE_NAME}=${cookieValue}`); -if (process.stdout.isTTY) { - console.log("\nTo sign in on http://localhost:3000:"); - console.log("Paste this in the DevTools Console (F12) and press Enter:\n"); - console.log( +if (process.stderr.isTTY || process.stdout.isTTY) { + const appUrl = process.env.APP_URL ?? "http://localhost:3000"; + console.error(`\nTo sign in on ${appUrl}:`); + console.error("Paste this in the DevTools Console (F12) and press Enter:\n"); + console.error( ` document.cookie = "${COOKIE_NAME}=${cookieValue}; path=/; max-age=${SESSION_DAYS * 86400}"; location.href = "/";\n`, ); } From 1fa4496d69b71b5907f44f9b383245f0b31b764e Mon Sep 17 00:00:00 2001 From: adi-IL Date: Sat, 22 Aug 2026 04:04:08 +0530 Subject: [PATCH 3/3] fix: gate dev-session output on stderr isTTY and parse first APP_URL origin --- apps/api/scripts/dev-session.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/api/scripts/dev-session.ts b/apps/api/scripts/dev-session.ts index 7964f97f2..48ae305e6 100644 --- a/apps/api/scripts/dev-session.ts +++ b/apps/api/scripts/dev-session.ts @@ -65,8 +65,10 @@ await db.session.upsert({ const cookieValue = await signCookieValue(token); console.log(`${COOKIE_NAME}=${cookieValue}`); -if (process.stderr.isTTY || process.stdout.isTTY) { - const appUrl = process.env.APP_URL ?? "http://localhost:3000"; +if (process.stderr.isTTY) { + const appUrl = (process.env.APP_URL ?? "http://localhost:3000") + .split(",")[0] + .trim(); console.error(`\nTo sign in on ${appUrl}:`); console.error("Paste this in the DevTools Console (F12) and press Enter:\n"); console.error(