Skip to content

feat: add Convex authentication option to sidebar - #8

Open
bidah wants to merge 2 commits into
mainfrom
claude/issue-6-20260223-1015
Open

bidah wants to merge 2 commits into
mainfrom
claude/issue-6-20260223-1015

Conversation

@bidah

@bidah bidah commented Feb 23, 2026

Copy link
Copy Markdown
Collaborator

Closes #6

Summary

  • Add new AuthSidebarPanel component with two states: cloud-disabled (shows navigate-to-cloud prompt) and cloud-enabled (shows setup checklist + AI-driven setup)
  • Add "Authentication" sidebar item below "Cloud" on desktop and mobile
  • Add "Authentication" shortcut button inside the Cloud panel when cloud is enabled
  • AI-driven setup via append() sends a detailed Convex Auth programmatic setup prompt covering packages, schema, HTTP routes, ConvexAuthProvider, and sign-in/sign-up screens

Generated with Claude Code

- Add new AuthSidebarPanel component with two states:
  - When cloud is disabled: shows a message with a button to navigate to the Cloud panel
  - When cloud is enabled: shows setup checklist and a "Setup Authentication" button that triggers the AI to configure Convex Auth with email/password
- Add "Authentication" menu item (KeyRound icon) in the sidebar below "Cloud" on both desktop and mobile
- Update CloudSidebarPanel to show an "Authentication" shortcut section when cloud is enabled
- Update mobile-burger-menu to include Authentication in navigation items
- Wire up handleSetupAuth in page.tsx that sends a detailed Convex Auth setup prompt to the AI via append()
- Add mobile sheet for the auth panel
- Covers programmatic setup: @convex-dev/auth installation, convex/auth.ts, schema.ts, http.ts, ConvexAuthProvider, sign-in/sign-up screens

Co-authored-by: Rodrigo Figueroa <bidah@users.noreply.github.com>
@vercel

vercel Bot commented Feb 23, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
react-native-vibe-code-sdk-docs Error Error Feb 23, 2026 10:57am
react-native-vibe-code-sdk-web Error Error Feb 23, 2026 10:57am

Request Review

@bidah bidah left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@claude fix implementation left a comment.

Comment thread apps/web/app/(app)/p/[id]/page.tsx Outdated
Comment on lines +602 to +612
append({
role: 'user',
content: `Please set up Convex authentication with email/password for my Expo React Native app. Follow these steps:

1. Install the required packages: @convex-dev/auth and @auth/core
2. Create convex/auth.ts with the Password provider from @convex-dev/auth/providers/Password
3. Update convex/schema.ts to spread authTables from @convex-dev/auth/server inside defineSchema
4. Create or update convex/http.ts to add authentication HTTP routes using auth.addHttpRoutes(http)
5. Run npx @convex-dev/auth to generate JWT private key and JWKS, then configure SITE_URL as an environment variable
6. Update the root app layout (_layout.tsx) to wrap with ConvexAuthProvider from @convex-dev/auth/react-native, using expo-secure-store as the storage option
7. Create a sign-in screen and sign-up screen with email and password input fields using the useAuthActions hook

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this should not be a message but rather a api call where these steps and code is added to the codebase that is sitting on the sandbox and then commited with our git integration.

@claude

claude Bot commented Feb 23, 2026 •

Copy link
Copy Markdown

Claude finished @bidah's task in 9m 46s —— View job


Fixing Convex Auth Setup Implementation

  • Read current implementation to understand the append() usage
  • Understand how file operations and git commits work in the codebase
  • Create /api/setup-convex-auth route that writes files to sandbox and commits via git
  • Update handleSetupAuth in page.tsx to call the new API
  • Update auth-sidebar-panel.tsx to handle async setup with proper status
  • Push changes

What changed

New file: apps/web/app/(app)/api/setup-convex-auth/route.ts

Replaced the append() chat-message approach with a dedicated API route that deterministically sets up Convex Auth by writing files directly to the sandbox and committing via git — following the same pattern as the existing /api/cloud/enable route.

The API route:

  1. Authenticates the user and fetches the project
  2. Connects to the E2B sandbox
  3. Installs @convex-dev/auth, @auth/core, and expo-secure-store via bun add
  4. Writes convex/auth.ts with the Password provider
  5. Writes convex/auth.config.ts with the CONVEX_SITE_URL JWT configuration
  6. Smart-injects authTables import + spread into convex/schema.ts (reads existing file, checks for duplicates)
  7. Smart-injects auth HTTP routes into convex/http.ts (reads existing file, handles case where it doesn't exist)
  8. Updates app/_layout.tsx to replace ConvexWrapper/ConvexProvider with ConvexAuthProvider + expo-secure-store (handles three cases: cloud-enabled layout, plain ConvexProvider, or no provider)
  9. Creates app/(auth)/_layout.tsx, sign-in.tsx, and sign-up.tsx screens using useAuthActions
  10. Commits everything via git add -A && git commit

Updated: apps/web/app/(app)/p/[id]/page.tsx — handleSetupAuth now makes a fetch POST to /api/setup-convex-auth instead of calling append().

Updated: apps/web/components/auth-sidebar-panel.tsx — Handles the async flow with loading / success / error states (and a "Retry" button on failure). Also shows the next step reminder (npx @convex-dev/auth to generate JWT keys).

Updated: apps/web/components/app-sidebar.tsx — onSetupAuth type updated from () => void to () => Promise<void>.

Note: npx @convex-dev/auth (which generates JWT keys and JWKS) is an interactive CLI command that can't be run non-interactively in the sandbox. The success state in the panel reminds the user to run it manually and configure CONVEX_SITE_URL in their Convex dashboard.
|

Replace the chat message approach with a dedicated API route that
writes Convex Auth files directly to the sandbox and commits via git:

- Add /api/setup-convex-auth route that:
  - Installs @convex-dev/auth, @auth/core, expo-secure-store packages
  - Writes convex/auth.ts with Password provider
  - Writes convex/auth.config.ts with CONVEX_SITE_URL configuration
  - Smart-injects authTables into convex/schema.ts
  - Smart-injects auth HTTP routes into convex/http.ts
  - Updates app/_layout.tsx to use ConvexAuthProvider (replaces ConvexWrapper)
  - Creates app/(auth)/_layout.tsx, sign-in.tsx, and sign-up.tsx screens
  - Commits all changes via git
- Update handleSetupAuth in page.tsx to call the new API
- Update AuthSidebarPanel to handle async setup with loading/success/error states
- Update AppSidebar to use () => Promise<void> type for onSetupAuth

Co-authored-by: Rodrigo Figueroa <bidah@users.noreply.github.com>

@bidah bidah left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@claude packages should be already in the expo-template. the idea is to skip installs

This branch had an error being deployed

2 failed deployments
Preview – react-native-vibe-code-sdk-docs — fa8ba30a Deployed Feb 23, 2026 by vercel[bot]
Preview – react-native-vibe-code-sdk-web — fa8ba30a Deployed Feb 23, 2026 by vercel[bot]
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.

add auth option to convex cloud package / setup

1 participant