stack/CLAUDE.md
CactusBlue ef6248dd87
Option for merging/blocking account creations with same email but different oauth provider (#502)
* Add SettingSelect component and sign-up mode configuration

* update schema

* update schema

* add merge oauth schema fields

* update test snapshots

* reformat the file

* add mergeOauthMethods in the UI

* Improve documentation with minor enhancements and fixes (#466)

* Improve PATCH /users/me performance

* Neon domain (#488)

* React setup docs (#491)

* chore: update package versions

* Update branding from Stack to Stack Auth in documentation (#504)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: zai@stack-auth.com <zai@stack-auth.com>

* Improve inner OAuth cookie error description

* Fix tests

* Add several spans

* Fix Next.js navigation

* chore: update package versions

* add handler config

* Fix conditional hooks in account settings page

* Add `pnpm run claude-code`

* Fixed docs image ratio (#507)

* Documentation Updates (#508)

* add links

* moar

* fix broken links

* fixed images

* updated readme

* Add Python SDK tab to docs

* Fix broken links

* Prefix `pnpm pre` before `pnpm dev`

* Automatically update pull request branches (#509)

* Give PR updater more permissions

* Ignore PR merge conflicts in GH Actions

* [DEVIN: Konsti] Add userCount property to Project table with automatic update trigger (#506)

Co-authored-by: Konstantin Wohlwend <n2d4xc@gmail.com>

* chore: update package versions

* rewrite as toMatchobject

* fix test

* test again

* fix

* update claude

* fix migrations

* fix migration

* fix types

* Update CLAUDE.md

Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>

* more instructions

* fix

* what was i on

* wew

* factor things

* correct the flow

* Update apps/backend/src/app/api/latest/auth/oauth/callback/[provider_id]/route.tsx

Very good catch

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* rename everything

* fix more

* fix typeerror

* update all the tests

* modify migration for legacy projects

* add loading state

* enable email verification for tests

* update test

* get a failing test

* the test works now

* remove debug console log

* change error

* no lowercase

* use typedToUpper/Lowercase

* capture err

* fix types

* modify error throw

* fixed

* add working tests

* documentation update

* Update apps/e2e/tests/backend/endpoints/api/v1/auth/oauth/merge-strategy.test.ts

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* remove eslint rule

* fix json args

* documentation update

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Konstantin Wohlwend <n2d4xc@gmail.com>
Co-authored-by: Zai Shi <zaishi00@outlook.com>
Co-authored-by: zai@stack-auth.com <zai@stack-auth.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
2025-03-10 21:25:12 +00:00

1.7 KiB

Development Guidelines for Stack Auth

Build/Test/Lint Commands

  • Build: pnpm build (all), pnpm build:packages (packages only), pnpm build:backend (backend)
  • Lint: pnpm lint (zero warnings allowed)
  • Typecheck: pnpm typecheck
  • Test: pnpm test (all), pnpm test:unit (unit tests), pnpm test:e2e (e2e tests)
  • Run single test: pnpm test path/to/test.test.ts or pnpm test -t "test name pattern"
  • Start dependencies: pnpm start-deps (DB, services), pnpm stop-deps (shutdown)
  • Dev mode: pnpm dev (all services) or pnpm dev:basic (backend+dashboard)
  • Prisma CLI: pnpm prisma (use instead of the prisma command)

Coding Guidelines

  • TypeScript with strict types, prefer type over interface
  • Avoid casting to any; Prefer making changes to the API so that any casts are unnecessary to access a property or method
  • 2-space indentation, spaces in braces, semicolons required
  • Return promises with return await, no floating promises
  • Proper error handling for async code with try/catch
  • Use helper functions: yupXyz() for validation, getPublicEnvVar() for env
  • Switch cases must use blocks
  • React Server Components preferred where applicable
  • No direct 'use' imports from React (use React.use instead)
  • Follow existing file structure and naming patterns

Testing Guidelines

  • Import test utilities from /apps/e2e/test/helpers.ts
  • Prefer inline snapshot testing with expect(response).toMatchInlineSnapshot(...)

Monorepo Structure

Managed with Turbo and pnpm workspaces. Core packages in packages/, apps in apps/. packages/stack is generated and will not be committed into the repository; change the files in packages/template instead.