Skip to content

docs: add ADR 003 - deployment architecture for MVP#5

Merged
Nether403 merged 1 commit into
mainfrom
docs/adr-003-deployment-architecture
May 12, 2026
Merged

docs: add ADR 003 - deployment architecture for MVP#5
Nether403 merged 1 commit into
mainfrom
docs/adr-003-deployment-architecture

Conversation

@Nether403

@Nether403 Nether403 commented May 12, 2026

Copy link
Copy Markdown
Owner

Summary

Captures the Phase 8 architecture decisions so execution can be mechanical rather than design-on-the-fly.

Decisions

Area Choice
Hosting Split web + API on Railway via the CLI, subdomain routing (stackfast.app + api.stackfast.app)
Database Existing Neon Postgres, separate production and staging branches, Drizzle migrations forward-only
Rate limiting Upstash Redis via @upstash/ratelimit, replacing the in-memory Map flagged as TODO in apps/api/src/index.ts. Fails open on Redis outage
Auth cookies Cross-origin with SameSite=None; Secure, cookie domain .stackfast.app so API and web share sessions
Error tracking Sentry kept in scope, wired behind a SENTRY_DSN feature flag so it's a no-op if the DSN is missing
Secrets Railway env vars only; .env.example lists every variable that exists in any environment
Rollback Railway one-click rollback for web, two-phase schema migrations so any deploy can roll back without DDL surgery

Roadmap updates

  • Phase 8 section now links ADR 003 and picks up Better Auth + GitHub OAuth (per ADR 001) instead of the obsolete "Neon Auth via Neon Console" line
  • Upstash migration added as an explicit deliverable
  • Sentry deliverable clarified as "wired behind SENTRY_DSN feature flag"

Non-goals (deferred to v1.x)

  • Zero-downtime blue/green deploys
  • Multi-region failover
  • Custom CDN
  • Preview environments per PR

Out of scope for this PR

  • No code or config changes; this is documentation only.
  • Phase 8 execution (Railway provisioning, Upstash wiring, Sentry SDK, DNS cutover) will land as a separate PR driven by the Phase 8 spec.

Open in Devin Review

Summary by cubic

Adds ADR 003 that defines the MVP deployment architecture and updates the Phase 8 roadmap to link and align. ADR sets split Railway web/API with subdomains (stackfast.app/api.stackfast.app), Neon Postgres branches with forward-only Drizzle migrations, Upstash Redis rate limiting via @upstash/ratelimit (fail-open), cross-origin cookies (SameSite=None; Secure, domain .stackfast.app), Sentry behind SENTRY_DSN, Railway env vars, and a rollback plan.

Written for commit f62db37. Summary will update on new commits.

Captures the Phase 8 architecture decisions so execution can be
mechanical rather than design-on-the-fly.

Decisions
- Hosting: split web + API on Railway, subdomain routing
  (stackfast.app + api.stackfast.app). Railway CLI is how the
  operator already interacts with the account.
- Database: existing Neon Postgres, separate production and
  staging branches; Drizzle migrations forward-only in prod.
- Rate limiting: Upstash Redis via @upstash/ratelimit, replacing
  the in-memory Map flagged as TODO in apps/api/src/index.ts.
  Fails open on Redis outage.
- Auth cookies: cross-origin with SameSite=None + Secure, cookie
  domain .stackfast.app so API and web share sessions.
- Error tracking: Sentry is the choice if enabled; treated as
  nice-to-have rather than a hard MVP requirement.
- Secrets: Railway env vars only, documented in .env.example.
- Rollback: Railway one-click for web, two-phase schema migrations
  so any deploy can roll back without DDL surgery.

Also adds a Phase-8 task outline the spec will expand on.

Roadmap
- Corrects the Phase 8 auth line to reference Better Auth + GitHub
  OAuth (per ADR 001), not "Neon Auth via Neon Console".
- Adds the Upstash rate-limit migration to the deliverable checklist.
- Links to ADR 003 at the top of Phase 8.

No code or config changes. Phase 8 execution and the Phase 8 spec
follow in separate PRs.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="ROADMAP.md">

<violation number="1" location="ROADMAP.md:252">
P2: This deliverable omits staging branch provisioning, which conflicts with ADR 003’s required production + staging Neon branch setup.</violation>
</file>

<file name="docs/decisions/003-deployment-architecture.md">

<violation number="1" location="docs/decisions/003-deployment-architecture.md:21">
P2: This ADR changes Phase 8 auth to Better Auth, but phase-gate docs still require Neon Auth. Update the gate docs to keep deployment requirements consistent.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread ROADMAP.md
- [ ] Neon Postgres provisioned and connected
- [ ] Neon Auth configured with GitHub OAuth via Neon Console
- [ ] Web + API deployed to Railway (via Railway CLI)
- [ ] Neon Postgres production branch provisioned and connected

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This deliverable omits staging branch provisioning, which conflicts with ADR 003’s required production + staging Neon branch setup.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At ROADMAP.md, line 252:

<comment>This deliverable omits staging branch provisioning, which conflicts with ADR 003’s required production + staging Neon branch setup.</comment>

<file context>
@@ -242,15 +242,21 @@ Build a registry that's genuinely useful for 2026 technology decisions.
-- [ ] Neon Postgres provisioned and connected
-- [ ] Neon Auth configured with GitHub OAuth via Neon Console
+- [ ] Web + API deployed to Railway (via Railway CLI)
+- [ ] Neon Postgres production branch provisioned and connected
+- [ ] Better Auth + GitHub OAuth configured (ADR 001)
+- [ ] Upstash Redis provisioned, rate limiter migrated off in-memory `Map`
</file context>
Suggested change
- [ ] Neon Postgres production branch provisioned and connected
- [ ] Neon Postgres production + staging branches provisioned and connected

+ React 18), six shared packages.
- **Database:** Neon Postgres. See ADR 001 — auth data lives in our own
Postgres via Better Auth.
- **Auth:** Better Auth with GitHub OAuth (ADR 001). Cookies are

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This ADR changes Phase 8 auth to Better Auth, but phase-gate docs still require Neon Auth. Update the gate docs to keep deployment requirements consistent.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/decisions/003-deployment-architecture.md, line 21:

<comment>This ADR changes Phase 8 auth to Better Auth, but phase-gate docs still require Neon Auth. Update the gate docs to keep deployment requirements consistent.</comment>

<file context>
@@ -0,0 +1,257 @@
+  + React 18), six shared packages.
+- **Database:** Neon Postgres. See ADR 001 — auth data lives in our own
+  Postgres via Better Auth.
+- **Auth:** Better Auth with GitHub OAuth (ADR 001). Cookies are
+  `SameSite=Lax` by default; cross-origin cookies require `Secure` +
+  `SameSite=None` and matching `allowedOrigins`.
</file context>

@Nether403 Nether403 merged commit 88b0b27 into main May 12, 2026
2 checks passed
@Nether403 Nether403 deleted the docs/adr-003-deployment-architecture branch May 12, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant