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 auth #36

Merged
merged 2 commits into from
Nov 10, 2024
Merged

add auth #36

merged 2 commits into from
Nov 10, 2024

Conversation

wtfdivyansh
Copy link
Contributor

@wtfdivyansh wtfdivyansh commented Nov 10, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced APIs for user management, including CRUD operations and email functionalities.
    • Added components for user sign-in and sign-up, enhancing authentication processes.
    • Implemented an AccountSwitcher component for managing user sessions.
  • Bug Fixes

    • Improved session management and CORS handling in API routes.
  • Documentation

    • Updated TypeScript configurations for better compatibility and structure.
  • Chores

    • Added new dependencies for improved functionality and validation in forms.

Copy link

vercel bot commented Nov 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
plura-api ❌ Failed (Inspect) Nov 10, 2024 3:00pm
plura-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 10, 2024 3:00pm
plura-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 10, 2024 3:00pm

Copy link

coderabbitai bot commented Nov 10, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces several new features and modifications to the API and authentication components of the application. It adds new API endpoints for user management and email handling using the Hono framework, implements session management, and enhances CORS handling. Additionally, it introduces new React components for user sign-in and sign-up, as well as utility components for form handling. The database schema is updated to support user accounts and sessions, and new TypeScript configurations are established to improve compatibility and structure.

Changes

File Path Change Summary
apps/api/app/api/[[...route]]/hello.ts New API file for user management with CRUD operations using Hono framework. Includes routes for GET, PATCH, POST, and DELETE.
apps/api/app/api/[[...route]]/mail.ts New API file for sending emails with endpoints for single and batch sending, along with health check routes.
apps/api/app/api/[[...route]]/route.ts Modified to remove direct database interactions, added session management, CORS handling, and new endpoints for session information.
apps/api/package.json Updated dependencies including Hono and Zod, removed contentlayer2.
apps/api/tsconfig.json Updated TypeScript configuration for module and resolution strategy, expanded include paths.
apps/app/package.json Added workspace dependencies for auth, db, and types.
apps/www/app/(auth)/dashboard/page.tsx New page component for user dashboard, retrieves user session data.
apps/www/app/(auth)/sign-in/page.tsx New sign-in page component with SignInComponent.
apps/www/app/(auth)/sign-up/page.tsx New sign-up page component with SignUpComponent.
apps/www/app/sign-in/[[...sign-in]]/layout.tsx Removed layout component for sign-in pages.
apps/www/app/sign-in/[[...sign-in]]/page.tsx Removed sign-in page implementation.
apps/www/components/custom/account-switcher.tsx New AccountSwitcher component for managing user sessions.
apps/www/components/custom/signInComponent.tsx New SignInComponent for user authentication using react-hook-form and Zod for validation.
apps/www/components/custom/signUpComponent.tsx New SignUpComponent for user registration with form handling and validation.
apps/www/components/ui/form.tsx New components for form handling using react-hook-form, including FormField, FormItem, FormLabel, etc.
apps/www/components/ui/label.tsx New Label component for enhanced label styling and functionality.
apps/www/lib/auth-client.ts New authentication client using better-auth library, exporting methods for sign-in, sign-up, etc.
apps/www/lib/server.ts New functions for fetching session data from API.
apps/www/package.json Updated dependencies including react-hook-form and zod, added workspace dependencies.
packages/auth/package.json New package for authentication with dependencies on better-call.
packages/auth/src/auth.ts New authentication configuration using better-auth library.
packages/database/prisma/migrations/20241110144439_auth/migration.sql Migration script creating tables for user, session, account, and verification.
packages/database/prisma/migrations/migration_lock.toml New migration lock file specifying PostgreSQL as the provider.
packages/database/prisma/schema.prisma Updated Prisma schema with new models for User, Session, Account, and Verification, along with field modifications.
packages/mail/.gitignore Updated to ignore node_modules and .env files.
packages/mail/package.json New package for mail functionality with dependencies on react-email and better-auth.
packages/mail/src/index.ts New functionality for sending, canceling, and updating emails using Resend API.
packages/mail/src/template/template.tsx New email template component for rendering HTML emails.
packages/mail/tsconfig.json New TypeScript configuration file for the mail package.
packages/types/package.json New package for types with exports mapping to mail.ts.
packages/types/src/mail.ts New Zod schemas for validating email data structures.

Possibly related PRs

  • route error fix #18: This PR involves the same route.ts file and discusses the implementation of CRUD operations for user management, which directly relates to the new API routes defined in the main PR.
  • feature/auth #33: This PR also modifies the route.ts file, focusing on the export structure of the OPTIONS method and maintaining session management, which is relevant to the changes made in the main PR regarding API route handling.
  • auth #34: Similar to feature/auth #33, this PR addresses modifications in the route.ts file, particularly concerning the handling of CORS and session management, which aligns with the changes introduced in the main PR.

🐇 In the code we weave,
New routes and forms to achieve,
Sessions managed with care,
Emails sent through the air!
With Hono and Zod in play,
We hop into a bright new day! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

vercel bot commented Nov 10, 2024

@wtfdivyansh is attempting to deploy a commit to the BlueFinZ Team on Vercel.

A member of the Team first needs to authorize it.

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.

2 participants