Skip to content

Init stack more args#892

Merged
BilalG1 merged 8 commits intodevfrom
init-stack-more-args
Sep 11, 2025
Merged

Init stack more args#892
BilalG1 merged 8 commits intodevfrom
init-stack-more-args

Conversation

@BilalG1
Copy link
Collaborator

@BilalG1 BilalG1 commented Sep 11, 2025

High-level PR Summary

This PR restructures how Stack apps are initialized by moving from a single stack.ts file to a directory structure with separate client and server files (stack/client.ts and stack/server.ts). The changes update all import paths throughout the codebase and documentation to reflect this new structure. Additionally, the PR adds command-line arguments to the init-stack tool to allow specifying project ID and publishable client key during initialization, which enhances the developer experience by allowing these values to be pre-populated in the generated configuration files.

⏱️ Estimated Review Time: 1h 15m

💡 Review Order Suggestion
Order File Path
1 packages/init-stack/src/index.ts
2 packages/init-stack/package.json
3 docs/templates/getting-started/setup.mdx
4 apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/setup-page.tsx
5 docs/templates/getting-started/example-pages.mdx
6 docs/templates/getting-started/users.mdx
7 docs/templates/components/stack-handler.mdx
8 docs/templates/components/stack-provider.mdx
9 docs/templates/concepts/oauth.mdx
10 docs/templates/concepts/permissions.mdx
11 docs/templates/concepts/user-onboarding.mdx
12 docs/templates/customization/custom-pages.mdx
13 docs/templates/customization/page-examples/forgot-password.mdx
14 docs/templates/customization/page-examples/password-reset.mdx
15 docs/templates/others/supabase.mdx
16 apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client.tsx
⚠️ Inconsistent Changes Detected
File Path Warning
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client.tsx This file only removes a Separator component with no relation to the stack file structure changes or command-line arguments that are the focus of this PR.

Important

Renamed stack.ts to stack/client.ts and stack/server.ts across the codebase, updated init-stack package with new options, and adjusted documentation accordingly.

  • File Renames:
    • Rename stack.ts to stack/client.ts and stack/server.ts in setup-page.tsx, stack-handler.mdx, stack-provider.mdx, oauth.mdx, permissions.mdx, user-onboarding.mdx, custom-pages.mdx, forgot-password.mdx, password-reset.mdx, example-pages.mdx, setup.mdx, users.mdx, supabase.mdx.
  • Package Updates:
    • Add --project-id and --publishable-client-key options to init-stack in index.ts.
    • Update package.json scripts to include test-run-keys-next and test-run-keys-js for testing with project ID and client key.
  • Miscellaneous:
    • Remove Separator component from page-client.tsx.
    • Update documentation to reflect file path changes.

This description was created by Ellipsis for 27dbbc1. You can customize this summary. It will automatically update as commits are pushed.

Review by RecurseML

🔍 Review performed on 0c4958a..27dbbc1

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (3)

packages/init-stack/src/index.ts
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/setup-page.tsx
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client.tsx

⏭️ Files skipped (trigger manually) (13)
Locations Trigger Analysis
docs/templates/components/stack-handler.mdx Analyze
docs/templates/components/stack-provider.mdx Analyze
docs/templates/concepts/oauth.mdx Analyze
docs/templates/concepts/permissions.mdx Analyze
docs/templates/concepts/user-onboarding.mdx Analyze
docs/templates/customization/custom-pages.mdx Analyze
docs/templates/customization/page-examples/forgot-password.mdx Analyze
docs/templates/customization/page-examples/password-reset.mdx Analyze
docs/templates/getting-started/example-pages.mdx Analyze
docs/templates/getting-started/setup.mdx Analyze
docs/templates/getting-started/users.mdx Analyze
docs/templates/others/supabase.mdx Analyze
packages/init-stack/package.json Analyze

Need help? Join our Discord

Summary by CodeRabbit

  • Documentation
    • Updated server-side import guidance across components, concepts, and getting-started guides to reflect the correct server module path.
    • Refreshed examples in Stack Handler and Stack Provider docs for consistency with current server usage.
    • Aligned permission and user onboarding examples with server-specific imports.
    • Revised getting-started examples (setup and users) to use the server module.
    • Updated the Supabase integration snippet to follow the server import pattern.
    • No changes to public APIs or runtime behavior; examples only.

@vercel
Copy link

vercel bot commented Sep 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
stack-backend Ready Ready Preview Comment Sep 11, 2025 5:35pm
stack-dashboard Ready Ready Preview Comment Sep 11, 2025 5:35pm
stack-demo Ready Ready Preview Comment Sep 11, 2025 5:35pm
stack-docs Ready Ready Preview Comment Sep 11, 2025 5:35pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 11, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Caution

Review failed

The pull request is closed.

Walkthrough

Documentation examples across multiple MDX files were updated to import stackServerApp from @/stack/server instead of @/stack. Only example import paths changed; no logic, control flow, or public API declarations were modified.

Changes

Cohort / File(s) Summary
Components docs
docs/templates/components/stack-handler.mdx, docs/templates/components/stack-provider.mdx
Updated example imports to use @/stack/server instead of @/stack for stackServerApp; no other changes.
Concepts docs
docs/templates/concepts/permissions.mdx, docs/templates/concepts/user-onboarding.mdx
Switched server-side example imports from @/stack to @/stack/server across server code blocks; content otherwise unchanged.
Getting started docs
docs/templates/getting-started/setup.mdx, docs/templates/getting-started/users.mdx
Repointed example imports to @/stack/server in Next.js snippets and server components; no logic edits.
Other integrations
docs/templates/others/supabase.mdx
Server action snippet now imports from @/stack/server; no control-flow changes.

Sequence Diagram(s)

(omitted — changes are only documentation import path edits, no runtime/control-flow changes to illustrate)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • N2D4

Poem

A rabbit hops through docs at night,
Tweaks imports till they fit just right.
From "@/stack" to server door,
Snippets match the app once more. 🐇✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c4958a and 650dc1f.

📒 Files selected for processing (7)
  • docs/templates/components/stack-handler.mdx (1 hunks)
  • docs/templates/components/stack-provider.mdx (1 hunks)
  • docs/templates/concepts/permissions.mdx (4 hunks)
  • docs/templates/concepts/user-onboarding.mdx (2 hunks)
  • docs/templates/getting-started/setup.mdx (2 hunks)
  • docs/templates/getting-started/users.mdx (4 hunks)
  • docs/templates/others/supabase.mdx (1 hunks)
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch init-stack-more-args

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@BilalG1 BilalG1 merged commit a03774f into dev Sep 11, 2025
8 of 13 checks passed
@BilalG1 BilalG1 deleted the init-stack-more-args branch September 11, 2025 17:20
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR modernizes the Stack Auth initialization tooling and project structure by introducing several key improvements:

Enhanced CLI Options: The init-stack package now accepts --project-id and --publishable-client-key command-line arguments, allowing users to pre-populate these critical configuration values during setup instead of manually entering them afterward. This enables automation and streamlines the developer onboarding experience.

Improved File Organization: The initialization tool now generates a cleaner project structure with separate stack/client.ts and stack/server.ts files instead of a single stack.ts file. This separation provides better organization by clearly distinguishing between client-side and server-side Stack Auth configurations, following Next.js best practices for preventing server-only code from accidentally running on the client.

Comprehensive Documentation Updates: All documentation files have been systematically updated to reflect the new file structure, with import paths changed from @/stack to @/stack/server for server-side usage and @/stack/client for client-side usage across setup guides, examples, and concept documentation.

Minor UI Refinement: The dashboard's new project page removes a redundant vertical separator between form and preview sections, likely because the different background colors already provide sufficient visual separation.

These changes integrate well with the existing codebase architecture and maintain backward compatibility while providing a more organized and automated setup experience for Stack Auth projects.

Confidence score: 4/5

  • This PR is safe to merge with moderate risk due to structural changes affecting many files
  • Score reflects comprehensive documentation updates and well-tested CLI enhancements, but file structure changes across the codebase require careful validation
  • Pay close attention to init-stack package changes and ensure all import path updates are consistent across the codebase

16 files reviewed, 6 comments

Edit Code Review Bot Settings | Greptile

@@ -33,7 +33,7 @@ Sometimes, you want to retrieve the user only if they're signed in, and redirect
Since `useUser()` is a stateful hook, you can't use it on server components. Instead, you can import `stackServerApp` from `stack/client.ts` and call `getUser()`:
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Comment mentions stack/client.ts but the actual import is from @/stack/server - this appears to be a documentation error

Suggested change
Since `useUser()` is a stateful hook, you can't use it on server components. Instead, you can import `stackServerApp` from `stack/client.ts` and call `getUser()`:
Since `useUser()` is a stateful hook, you can't use it on server components. Instead, you can import `stackServerApp` from `@/stack/server` and call `getUser()`:

This was referenced Oct 15, 2025
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