Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Guest Mode Support #31

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add Guest Mode Support #31

wants to merge 4 commits into from

Conversation

VDuda
Copy link
Member

@VDuda VDuda commented Feb 13, 2025

Overview

This PR implements guest mode functionality, allowing users to interact with the application without requiring authentication. It includes a unified authentication system that handles both guest and authenticated users seamlessly.

Commits

  • f7d63d2 - feat: implement guest mode support
  • feb6dc3 - refactor: implement unified auth system for guest and clerk users

Key Changes

Authentication System

  • Created custom useAuth hook to handle both guest and Clerk authentication
  • Implemented unified auth utilities that work for both auth modes
  • Prevented Clerk initialization during guest mode for better performance
  • Updated components to use the new auth system

Guest Mode Infrastructure

  • Added guest user support to Prisma schema with migrations
  • Implemented guest session management with secure cookie handling
  • Created guest banner component for clear user feedback
  • Modified notebook routes to support guest user access

UI/UX Improvements

  • Updated user navigation with guest-specific UI elements
  • Added clear visual indicators for guest mode
  • Maintained consistent UX across both auth modes

Technical Notes

  • Guest sessions expire after 1 week
  • Guest data is preserved in the database but isolated from authenticated users
  • Clerk is only initialized for non-guest users
  • Migration includes new fields: sessionId and isGuest for User model

- Create custom useAuth hook to handle both guest and clerk auth
- Update auth utilities to support both auth modes
- Modify components to use unified auth system
- Prevent Clerk initialization during guest mode
- Update user navigation with guest-specific UI
- Add guest user support to prisma schema
- Create guest session management utilities
- Add guest banner component
- Update package dependencies
- Add database migration for guest user support
- Update build script for guest mode
- Modify notebook routes to handle guest users
- Remove direct Clerk auth usage from pages
- Add proper error handling around Clerk auth calls
- Update auth utility to handle both guest and Clerk modes gracefully
- Simplify notebook fetching and caching in home page
- Add try/catch blocks for robust auth failure handling
- Remove direct Clerk auth usage from pages
- Add proper error handling around Clerk auth calls
- Update auth utility to handle both guest and Clerk modes gracefully
- Simplify notebook fetching and caching in home page
- Add try/catch blocks for robust auth failure handling
- Update middleware configuration for proper Clerk integration
- Keep public routes and static file exclusions in middleware
- Ensure proper guest session handling in middleware
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