Commit Graph

69 Commits

Author SHA1 Message Date
Konstantin Wohlwend
4f6eebd79f Update User Fundamentals 2026-05-22 16:28:43 -07:00
Aman Ganapathy
1de8a17183
Payments bulldozer txn rework (#1315)
### Object of this PR
This PR is NOT a monolithic series of fixes for the payments suite + a
complete rework. Its aims were
a) introducing and robustly testing the bulldozer db system 
b) reworking the payments underlying architecture to use bulldozer for
correctness and scalability
c) Achieving parity with the old payments system excepting a few changes
like ensuring correctness of the ledger algo
There may still be some work to do with handling refunds, decoupling the
concepts of purchases from that of products, and some other things.

### Ledger Algorithm
This has been tuned and fixed. Item removals i.e negative item quantity
changes will apply to the soonest expiring item grant i.e positive item
quantity change. This is what is best for the user. Item grants can also
expire, and when they expire we obviate whatever is left of their
original capacity (meaning after all the removals that were applied to
it). Our ledger algo is applied via Bulldozer, so automatic
re-computation is handled when a new grant/ removal is inserted in the
middle of the existing ones.

### Things we got rid of 
* No more automatic support for default products. You can use $0 plan
provisions to accomplish the same effect but it's manual
* Negative item quantity changes (i.e item removals) no longer can have
expiries



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Enhanced payment processing pipeline with improved data consistency
and state management.
  * Advanced refund handling with comprehensive transaction tracking.
* Better tracking and management of customer item quantities and owned
products.
* Improved subscription lifecycle management including period-end
handling.

* **Bug Fixes**
  * Fixed payment data integrity verification.
  * Improved handling of edge cases in refund scenarios.

* **Chores**
  * Updated cSpell configuration with additional words.
  * Expanded developer documentation for linting workflows.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Konstantin Wohlwend <n2d4xc@gmail.com>
Co-authored-by: Aadesh Kheria <kheriaaadesh@gmail.com>
Co-authored-by: Mantra <87142457+mantrakp04@users.noreply.github.com>
2026-04-17 22:11:21 +00:00
Konstantin Wohlwend
d63db64e19 Migrate from tsup to tsdown 2026-02-26 17:42:09 -08:00
Armaan Jain
11b6b4210b
Emails redesign (#1076) 2026-02-16 14:57:17 -08:00
BilalG1
d09a180dfe
clickhouse user sync (#1159)
Some checks failed
all-good: Did all the other checks pass? / all-good (push) Has been cancelled
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
DB migrations are backwards-compatible / Check if migrations changed (push) Has been cancelled
Docker Server Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Server Build and Run / docker (push) Has been cancelled
Runs E2E API Tests / E2E Tests (Node ${{ matrix.node-version }}, Freestyle ${{ matrix.freestyle-mode }}) (mock, 22.x) (push) Has been cancelled
Runs E2E API Tests / E2E Tests (Node ${{ matrix.node-version }}, Freestyle ${{ matrix.freestyle-mode }}) (prod, 22.x) (push) Has been cancelled
Runs E2E API Tests with custom port prefix / build (22.x) (push) Has been cancelled
Lint & build / lint_and_build (latest) (push) Has been cancelled
Dev Environment Test With Custom Base Port / restart-dev-and-test-with-custom-base-port (push) Has been cancelled
Dev Environment Test / restart-dev-and-test (push) Has been cancelled
Run setup tests with custom base port / setup-tests-with-custom-base-port (push) Has been cancelled
Run setup tests / setup-tests (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
DB migrations are backwards-compatible / Test migrations with ${{ needs.check-migrations-changed.outputs.base_branch }} branch code (push) Has been cancelled
DB migrations are backwards-compatible / No migration changes (skipped) (push) Has been cancelled
<!--

Make sure you've read the CONTRIBUTING.md guidelines:
https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md

-->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Real-time AI search with project-scoped analytics and dynamic query
execution; streaming AI responses replace the placeholder flow.
* External DB sync adds ClickHouse support: users sync, sync metadata
tracking, tenancy-aware status, and per-mapping throttling.
* AI assistant UI shows expandable tool-invocation results and streams
via the real AI pipeline.

* **Chores**
* Dashboard dependencies and workspace exclusions updated; development
OpenAI env var added; editor config flag toggled.

* **Tests**
* E2E coverage extended to validate ClickHouse user sync and analytics
queries.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: aadesh18 <110230993+aadesh18@users.noreply.github.com>
Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
2026-02-12 16:52:20 -08:00
Konsti Wohlwend
7a35751f8e
Sign up rules (#1138)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **High Risk**
> Touches core sign-up/auth flows and user restriction semantics
(including new DB constraints) and introduces dynamic rule
evaluation/logging; misconfiguration or CEL/parser bugs could block
sign-ups or incorrectly restrict users.
> 
> **Overview**
> Introduces **CEL-based sign-up rules** (config-driven) that are
evaluated during password/OTP/OAuth sign-ups and anonymous upgrades;
matching rules can reject sign-ups or mark users as admin-restricted,
and triggers are logged for analytics.
> 
> Extends `ProjectUser` with `restrictedByAdmin` plus public/private
restriction details, updates restriction computation/filtering, and
exposes these fields via user CRUD (including validation + DB constraint
enforcing consistency when unrestricted).
> 
> Adds a new dashboard **Sign-up Rules** page with a visual condition
builder (CEL <-> visual tree), drag-reorder by priority, per-rule 48h
sparkline analytics via a new hidden internal endpoint, and adds
user-page UI to view/edit manual restrictions. Also refactors ClickHouse
client initialization to require env vars (removing
`isClickhouseConfigured` checks) and adjusts CI container startup wait
time.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
2141e689e8c1b72303b805e9234f996010d0880. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Sign-up Rules: visual rule builder, in-project CRUD with drag-reorder,
per-rule analytics, backend evaluation, and admin UI.
* Admin user restrictions: dashboard controls, banners/status,
public/private admin details surfaced in user views.

* **APIs & Schema**
* Config and user schemas extended; new SignUpRejected error and sign-up
rule types added.

* **Tests**
* Extensive unit and E2E coverage for rules, parser, evaluator,
analytics, and restricted-user flows.

* **Docs**
  * Editorial guidance added to AGENTS.md.

* **Chores**
* DB statement timeout, updated clean script, minor dependency
additions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-03 11:08:24 -08:00
Konsti Wohlwend
6c22e6e511
Config sources (#1083) 2026-01-21 18:08:35 -08:00
Konsti Wohlwend
e7e792d462
Email outbox backend (#1030) 2025-12-12 10:26:38 -08:00
Daniel Jacobs
2b259a2acc
Remove no longer used vocabulary word (#1057)
Some checks failed
all-good: Did all the other checks pass? / all-good (push) Has been cancelled
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Server Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Server Test / docker (push) Has been cancelled
Runs E2E API Tests / build (22.x) (push) Has been cancelled
Runs E2E API Tests with custom port prefix / build (22.x) (push) Has been cancelled
Runs E2E API Tests with external source of truth / build (22.x) (push) Has been cancelled
Lint & build / lint_and_build (latest) (push) Has been cancelled
Dev Environment Test With Custom Base Port / restart-dev-and-test-with-custom-base-port (push) Has been cancelled
Dev Environment Test / restart-dev-and-test (push) Has been cancelled
Run setup tests / setup-tests (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
This word is no longer used since Devin got fired.
2025-12-10 09:56:16 -08:00
Konstantin Wohlwend
bcab1045d6 Page transition prefetching 2025-10-16 12:02:46 -07:00
Konstantin Wohlwend
7387f029c0 Workflow queue 2025-09-03 13:31:40 -07:00
Konsti Wohlwend
509c93e310
Data vaults (#871) 2025-08-30 23:42:56 -07:00
Konstantin Wohlwend
b086b57f47 Snappier feature request upvotes 2025-08-12 18:42:13 -07:00
Konstantin Wohlwend
19142f40a9 Featurebase integration 2025-07-30 09:32:44 -07:00
Konsti Wohlwend
7c0417d7d9
Several project config improvements (#811) 2025-07-29 04:13:46 -07:00
Konsti Wohlwend
47b7efa2b6
Widget playground (#740)
Some checks failed
all-good: Did all the other checks pass? / all-good (push) Has been cancelled
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Emulator Test / docker (push) Has been cancelled
Docker Server Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Server Test / docker (push) Has been cancelled
Runs E2E API Tests / build (22.x) (push) Has been cancelled
Lint & build / lint_and_build (latest) (push) Has been cancelled
Dev Environment Test / restart-dev-and-test (push) Has been cancelled
Run setup tests / setup-tests (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
https://github.com/user-attachments/assets/fc1edc06-7113-4ab4-be24-9141e310e127
2025-07-06 18:04:02 -07:00
Konstantin Wohlwend
fbb3f41df2 Email deliverability check 2025-06-19 15:56:26 -07:00
Konstantin Wohlwend
512e0113fc Fix flakey tests 2025-04-22 18:03:53 -07:00
Konstantin Wohlwend
7df6191dc4 Update API key regex
Some checks failed
all-good: Did all the other checks pass? / all-good (push) Has been cancelled
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Emulator Test / docker (push) Has been cancelled
Docker Server Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Server Test / docker (push) Has been cancelled
Runs E2E API Tests / build (22.x) (push) Has been cancelled
Lint & build / lint_and_build (latest) (push) Has been cancelled
Preview Docs / run (push) Has been cancelled
Dev Environment Test / restart-dev-and-test (push) Has been cancelled
Run setup tests / setup-tests (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
2025-04-07 18:08:27 -07:00
Moritz Schneider
592d259dde
Api Keys (#590)
<!--

Make sure you've read the CONTRIBUTING.md guidelines:
https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md

-->

<img width="1510" alt="image"
src="https://github.com/user-attachments/assets/99619123-6be5-4788-aebe-5fc2a9a36245"
/>

<img width="1510" alt="image"
src="https://github.com/user-attachments/assets/660677bf-f19a-4673-94c8-59ac50eb6ae5"
/>

<img width="1510" alt="image"
src="https://github.com/user-attachments/assets/11ae63c4-5813-4fd8-aa01-fa580d2103be"
/>


<!-- ELLIPSIS_HIDDEN -->


----

> [!IMPORTANT]
> Introduces API key management for users and teams, integrating with
existing project configurations and permissions, and adds comprehensive
tests and examples.
> 
>   - **API Key Management**:
> - Introduces `ProjectApiKey` model in `schema.prisma` for managing API
keys.
> - Adds `createApiKeyHandlers` in `handlers.tsx` to handle API key CRUD
operations.
>     - Implements API key creation, revocation, and validation logic.
>   - **Permissions and Configurations**:
> - Adds `allowUserApiKeys` and `allowTeamApiKeys` to `ProjectConfig` in
`schema.prisma`.
> - Updates `TeamSystemPermission` enum to include `MANAGE_API_KEYS`.
> - Ensures API key operations respect project configurations and
user/team permissions.
>   - **Testing and Examples**:
> - Adds extensive tests in `api-keys.test.ts` to cover various API key
scenarios.
>     - Updates example projects to demonstrate API key usage.
>   - **Miscellaneous**:
>     - Refactors existing code to integrate API key functionalities.
> - Updates documentation and type definitions to reflect new API key
features.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup>
for 96f60c57f0. It will automatically
update as commits are pushed.</sup>


<!-- ELLIPSIS_HIDDEN -->

---------

Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
2025-04-04 13:03:10 -07:00
devin-ai-integration[bot]
7c2bd3f701
[DEVIN: Konsti] Add devcontainer configuration for development (#570)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Konstantin Wohlwend <n2d4xc@gmail.com>
2025-04-04 01:41:32 +00:00
Konsti Wohlwend
d072df29d8
Automatically update pull request branches (#509) 2025-03-04 23:52:05 -08:00
Konsti Wohlwend
5239c10ebf
Split stack-app.ts file into multiple files (#492) 2025-03-02 21:20:42 -08:00
Konstantin Wohlwend
cbfabe00da Fix typo 2025-02-28 12:03:52 -08:00
devin-ai-integration[bot]
9a76d10c2a
[DEVIN: Konsti] Add in-source unit tests to stack-shared utilities (#485)
* Add in-source unit tests to stack-shared utilities

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Fix type checking and linting issues

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Fix lint errors in results.tsx

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Fix remaining lint errors in results.tsx

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Fix lint warnings in results.tsx

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Fix wait function mocking in results.tsx

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Fix retry function test in results.tsx

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Fix React.forwardRef mock in react.tsx test

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Fix trailing spaces in react.tsx and results.tsx

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Revert to DependenciesMap and wrap rejected promise in ignoreUnhandledRejection

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Fix

* Revert changes to known-errors.tsx constructor

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Make rotateRight call rotateLeft per review feedback

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Remove redundant @ts-expect-error directive in known-errors.tsx

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Fix import order in promises.tsx

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Fix

* Fix CI failures: add back @ts-expect-error in known-errors.tsx and revert mapResult implementation in results.tsx

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Remove unused @ts-expect-error directive in known-errors.tsx

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Add back @ts-expect-error directive with explanation in known-errors.tsx

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* Change @ts-expect-error to @ts-ignore in known-errors.tsx

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>

* be honest

* vocabulary

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Konstantin Wohlwend <n2d4xc@gmail.com>
2025-02-28 01:47:37 +00:00
Konstantin Wohlwend
fbbec19cbd Auto-format Prisma files on save 2025-02-20 17:57:16 -08:00
Konsti Wohlwend
157f722417
Vanilla JS init script (#454) 2025-02-20 15:11:06 -08:00
CactusBlue
816d64c850
In-source unit tests (#429)
Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
2025-02-14 11:47:52 -08:00
Konsti Wohlwend
f2f1b9df82
Tenancies (#418)
Co-authored-by: Zai Shi <zaishi00@outlook.com>
2025-02-07 22:54:04 -08:00
Konsti Wohlwend
3c013cc105
nicify(...) now formats multiline strings nicely (#415)
Some checks failed
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Test / docker (push) Has been cancelled
Runs E2E API Tests / build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (22.x) (push) Has been cancelled
Run setup tests / test (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
2025-02-02 19:22:06 -08:00
Zai Shi
d90128e44a added EENVELOPE error 2025-01-31 17:11:42 -08:00
Konstantin Wohlwend
a73bf97885 start-deps now waits until Postgres is ready
Some checks failed
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Test / docker (push) Has been cancelled
Runs E2E API Tests / build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (22.x) (push) Has been cancelled
Mirror main branch to main-mirror-for-wdb / lint_and_build (push) Has been cancelled
Publish Docs / run (push) Has been cancelled
Run setup tests / test (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
2025-01-27 18:25:26 -08:00
Konstantin Wohlwend
f364b6b0c5 Insert final newline on file save 2024-12-24 00:01:14 -08:00
Konstantin Wohlwend
a183bcca07 Address TODO next-release comments 2024-12-23 20:03:50 -08:00
Konstantin Wohlwend
e7044080c5 Create fewer projects in unit tests 2024-12-23 14:03:00 -08:00
Konstantin Wohlwend
415dc2df42 Remove empty profile image strings from database 2024-12-23 13:08:36 -08:00
CactusBlue
cd35e8cdc4
Dashboard Metrics (#361)
Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
2024-12-22 12:02:21 -08:00
Zai Shi
534fef5d62
Added custom SMTP email server testing on the dashboard (#376)
Some checks failed
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Test / docker (push) Has been cancelled
Runs E2E API Tests / build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (22.x) (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
2024-12-20 19:04:05 +01:00
Konstantin Wohlwend
9f73738d12 Forgiving caches 2024-12-18 22:24:07 -08:00
Konstantin Wohlwend
916f7d97af Local development debugger support 2024-12-18 17:20:17 -08:00
Zai Shi
918f205bd9
Self-host docker (#353) 2024-12-01 15:57:51 +01:00
Konsti Wohlwend
cec718f542
Identity Provider/External OAuth (#323)
Co-authored-by: moritz <moritsch@student.ethz.ch>
2024-11-30 23:27:55 -08:00
Konsti Wohlwend
3b18f09ec7
Log geoip information with events (#344) 2024-11-17 18:07:36 +01:00
Konstantin Wohlwend
7303ab83c4 Don't show "Reset" button unless a filter is applied 2024-11-17 00:07:57 +01:00
Konsti Wohlwend
057dac1a66
Next.js 15 support (#315)
Some checks failed
Runs E2E API Tests / build (20.x) (push) Has been cancelled
Runs E2E API Tests / build (22.x) (push) Has been cancelled
Lint & build / lint_and_build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (22.x) (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
Updates `examples/demo` to Next.js 15 and adds Next.js 15 support to `packages/stack`.

The other packages and apps are still running on Next.js 14 to ensure compatibility.
2024-11-08 03:12:31 +01:00
Moritz Schneider
93a1fcf7cb
Passkey support (#321)
* passkeys

* add passkey tests

---------

Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
2024-10-28 16:56:46 -07:00
Konstantin Wohlwend
6a8bd41e4b Disable Prettier in VSCode settings 2024-10-21 09:34:59 -07:00
Zai Shi
a785d47417
Project specific JWKs (#293)
* added per project signing

* added well-known/jwks.json

* fixed bugs

* fixed bugs

* fixed tests

* fixed not found error
2024-10-07 21:27:55 +02:00
Konsti Wohlwend
197c1be2b7
i18n with Quetzal (#228)
* Quetzal setup stuff

* Custom translation function

* CI

* Update stuff

* Revert components

* Various fixes

* Hook

* New IDs

* Add auto-gen info header

* Fix CI

* Fix CI

* Update translations

* Update script

* More fixes

* Overrides

* fixed quetzal

* added more translations

* added more translation

* updated translation

* added i18n docs

* updated pnpm lock

* fixed build

---------

Co-authored-by: Zai Shi <zaishi00@outlook.com>
2024-09-12 20:21:45 +02:00
Zai Shi
5700b5675b
added copy from variable (#242) 2024-09-11 22:45:20 +02:00