mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
https://www.loom.com/share/db645a1799454ec6b0234c55ee28cee9
<!--
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**
- Multi-currency, entry-based transaction model; unified transaction
builders.
- Refund API for subscriptions and one-time purchases; Stripe invoice
handling and webhook invoice-paid processing.
- **Refactor**
- Admin UI and SDK migrated to the new transaction shape; table
rendering simplified with summary-driven columns and avatar cells.
- **Bug Fixes**
- Improved aggregation, sorting and cursor pagination across mixed
transaction sources; refund state handling.
- **Tests**
- Expanded end-to-end tests, webhook simulation helpers, and snapshot
updates.
- **Chores**
- Database migrations for subscription invoices and refundedAt fields.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Replaces AdminTransaction with a unified, entry-based Transaction
model, updates the backend route/builders, admin SDK, dashboard table,
and tests (incl. filtering and serializer tweaks).
>
> - **Backend**:
> - **Entry-based transactions**: Add `transaction-builder.ts` to build
`Transaction` objects (product grants, money transfers, item quantity
changes) with multi-currency amounts and
`effective_at_millis`/`adjusted_by`.
> - **API**: `/internal/payments/transactions` now returns
`transactionSchema`, supports filtering by `TRANSACTION_TYPES`, merges
sources, and preserves concatenated-cursor pagination.
> - **Shared (stack-shared)**:
> - Add `transactionEntrySchema`, `transactionSchema`,
`TRANSACTION_TYPES`, and `TransactionType`; remove `AdminTransaction`
surface.
> - **Admin SDK/Template**:
> - Update `listTransactions` signatures, caches, and types to use
`Transaction`/`TransactionType` across interfaces and app
implementations.
> - **Dashboard UI**:
> - Refactor transaction table to new model: iconified type, avatar
customer cells, amount/details columns, and filters for type and
customer.
> - **Tests**:
> - Update e2e snapshots to new `Transaction` shape; add tests for
type/customer filters and server-granted subscriptions; serializer now
strips `effective_at_millis`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c914d11c0f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
254 lines
7.3 KiB
YAML
254 lines
7.3 KiB
YAML
services:
|
|
|
|
# ================= PostgreSQL =================
|
|
|
|
db:
|
|
build: ../postgres-with-extensions
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: PASSWORD-PLACEHOLDER--uqfEC1hmmv
|
|
POSTGRES_DB: stackframe
|
|
POSTGRES_DELAY_MS: ${POSTGRES_DELAY_MS:-0}
|
|
ports:
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}28:5432"
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
cap_add:
|
|
- NET_ADMIN # required for the fake latency during dev
|
|
|
|
# ================= PgHero =================
|
|
|
|
pghero:
|
|
image: ankane/pghero:latest
|
|
environment:
|
|
DATABASE_URL: postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@db:5432/stackframe
|
|
ports:
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}16:8080"
|
|
|
|
# ================= PgAdmin =================
|
|
|
|
pgadmin:
|
|
image: dpage/pgadmin4
|
|
environment:
|
|
PGADMIN_DEFAULT_EMAIL: admin@example.com
|
|
PGADMIN_DEFAULT_PASSWORD: PASSWORD-PLACEHOLDER--vu9p2iy3f
|
|
PGADMIN_CONFIG_SERVER_MODE: "False"
|
|
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False"
|
|
configs:
|
|
- source: pgadmin_servers
|
|
target: /pgadmin4/servers.json
|
|
ports:
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}17:80"
|
|
|
|
# ================= Supabase Studio =================
|
|
|
|
supabase-studio:
|
|
image: supabase/studio:20241202-71e5240
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test:
|
|
[
|
|
"CMD",
|
|
"node",
|
|
"-e",
|
|
"fetch('http://studio:3000/api/profile').then((r) => {if (r.status !== 200) throw new Error(r.status)})"
|
|
]
|
|
timeout: 10s
|
|
interval: 5s
|
|
retries: 3
|
|
environment:
|
|
STUDIO_PG_META_URL: http://supabase-meta:8080
|
|
POSTGRES_PASSWORD: PASSWORD-PLACEHOLDER--uqfEC1hmmv
|
|
|
|
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
|
|
|
|
NEXT_PUBLIC_ENABLE_LOGS: true
|
|
NEXT_ANALYTICS_BACKEND_PROVIDER: postgres
|
|
ports:
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}18:3000"
|
|
|
|
supabase-meta:
|
|
image: supabase/postgres-meta:v0.84.2
|
|
restart: unless-stopped
|
|
environment:
|
|
PG_META_PORT: 8080
|
|
PG_META_DB_HOST: db
|
|
PG_META_DB_PORT: 5432
|
|
PG_META_DB_NAME: stackframe
|
|
PG_META_DB_USER: postgres
|
|
PG_META_DB_PASSWORD: PASSWORD-PLACEHOLDER--uqfEC1hmmv
|
|
|
|
|
|
# ================= Inbucket =================
|
|
|
|
inbucket:
|
|
image: inbucket/inbucket:3.1.0
|
|
ports:
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}29:2500"
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}05:9000"
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}30:1100"
|
|
volumes:
|
|
- inbucket-data:/data
|
|
|
|
# ================= OpenTelemetry & Jaeger =================
|
|
|
|
jaeger:
|
|
image: jaegertracing/all-in-one:latest
|
|
environment:
|
|
- COLLECTOR_OTLP_ENABLED=true
|
|
ports:
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}07:16686" # Jaeger UI
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}31:4318" # OTLP Endpoint
|
|
restart: always
|
|
|
|
# ================= svix =================
|
|
|
|
svix-db:
|
|
image: "docker.io/postgres:16.1"
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: PASSWORD-PLACEHOLDER--KsoIMcchtp
|
|
POSTGRES_DB: svix
|
|
volumes:
|
|
- svix-postgres-data:/var/lib/postgresql/data
|
|
|
|
svix-redis:
|
|
image: docker.io/redis:7-alpine
|
|
command: --save 60 500 --appendonly yes --appendfsync everysec --requirepass PASSWORD-PLACEHOLDER--oVn8GSD6b9
|
|
volumes:
|
|
- svix-redis-data:/data
|
|
|
|
svix-server:
|
|
image: svix/svix-server
|
|
environment:
|
|
WAIT_FOR: 'true'
|
|
SVIX_REDIS_DSN: redis://:PASSWORD-PLACEHOLDER--oVn8GSD6b9@svix-redis:6379
|
|
SVIX_DB_DSN: postgres://postgres:PASSWORD-PLACEHOLDER--KsoIMcchtp@svix-db:5432/svix
|
|
SVIX_CACHE_TYPE: memory
|
|
SVIX_JWT_SECRET: secret
|
|
SVIX_LOG_LEVEL: trace
|
|
SVIX_QUEUE_TYPE: redis
|
|
ports:
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}13:8071"
|
|
depends_on:
|
|
- svix-redis
|
|
- svix-db
|
|
|
|
# ================= Adobe S3 Mock =================
|
|
|
|
s3mock:
|
|
image: adobe/s3mock:latest
|
|
ports:
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}21:9090"
|
|
environment:
|
|
- initialBuckets=stack-storage
|
|
- root=s3mockroot
|
|
- debug=false
|
|
volumes:
|
|
- s3mock-data:/tmp/s3mock
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:9090/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
|
|
# ================= LocalStack =================
|
|
localstack:
|
|
image: localstack/localstack:4.7
|
|
ports:
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}24:4566" # LocalStack Gateway
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}50-${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}99:4510-4559" # external services port range
|
|
environment:
|
|
# LocalStack configuration: https://docs.localstack.cloud/references/configuration/
|
|
- DEBUG=${DEBUG:-0}
|
|
volumes:
|
|
- localstack-data:/var/lib/localstack
|
|
- "/var/run/docker.sock:/var/run/docker.sock"
|
|
|
|
# ================= Freestyle mock =================
|
|
|
|
freestyle-mock:
|
|
build:
|
|
context: ./freestyle-mock
|
|
dockerfile: Dockerfile
|
|
image: freestyle-mock
|
|
ports:
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}22:8080" # POST http://localhost:${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}19/execute/v1/script
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway" # noop on Docker Desktop/Orbstack, enables host.docker.internal on Linux
|
|
environment:
|
|
DENO_DIR: /deno-cache
|
|
HOST_ON_HOST: host.docker.internal
|
|
volumes:
|
|
- deno-cache:/deno-cache
|
|
|
|
# ================= Stripe =================
|
|
|
|
stripe-mock:
|
|
image: stripe/stripe-mock:v0.195.0
|
|
ports:
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}23:12111"
|
|
environment:
|
|
- STRIPE_API_KEY=sk_test_1234567890
|
|
|
|
# ================= QStash =================
|
|
|
|
qstash:
|
|
image: bgodil/qstash:latest
|
|
ports:
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}25:8080"
|
|
command: qstash dev
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway" # noop on Docker Desktop/Orbstack, enables host.docker.internal on Linux
|
|
environment:
|
|
HOST_ON_HOST: host.docker.internal
|
|
|
|
# ================= MCPJam Inspector =================
|
|
|
|
mcpjam-inspector:
|
|
image: node:20-alpine
|
|
ports:
|
|
- "${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}26:3001"
|
|
command: >
|
|
sh -c "echo '{\"mcpServers\":{\"local-stack-auth-docs\":{\"url\":\"http://host.docker.internal:${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}04/api/internal/mcp\"}}}' > /app/mcp.json && npx -y @mcpjam/inspector@latest --port 3001 --config /app/mcp.json"
|
|
working_dir: /app
|
|
volumes:
|
|
- mcpjam-inspector-data:/root
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway" # noop on Docker Desktop/Orbstack, enables host.docker.internal on Linux
|
|
environment:
|
|
HOST_ON_HOST: host.docker.internal
|
|
|
|
|
|
# ================= volumes =================
|
|
|
|
volumes:
|
|
postgres-data:
|
|
inbucket-data:
|
|
svix-redis-data:
|
|
svix-postgres-data:
|
|
s3mock-data:
|
|
deno-cache:
|
|
localstack-data:
|
|
mcpjam-inspector-data:
|
|
|
|
# ================= configs =================
|
|
|
|
configs:
|
|
pgadmin_servers:
|
|
content: |
|
|
{
|
|
"Servers": {
|
|
"1": {
|
|
"Name": "Local Postgres DB",
|
|
"Group": "Servers",
|
|
"Host": "db",
|
|
"Port": 5432,
|
|
"Username": "postgres",
|
|
"PasswordExecCommand": "echo 'PASSWORD-PLACEHOLDER--uqfEC1hmmv'",
|
|
"MaintenanceDB": "stackframe"
|
|
}
|
|
}
|
|
}
|