Skip to content

Implement Prisma & Neon #747

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

Merged
merged 9 commits into from
Jun 20, 2025
Merged

Implement Prisma & Neon #747

merged 9 commits into from
Jun 20, 2025

Conversation

jonulak
Copy link
Contributor

@jonulak jonulak commented Jun 9, 2025

Pull Request Description

Summary:

This pull request introduces Prisma integration into the NextAuth authentication framework within the Vets Who Code app. Prisma will now handle user authentication and session management, enhancing security and performance across the platform.

Changes Made:

  • Integrated Prisma ORM for user authentication and session management data persistence.
  • Configured NextAuth to use Prisma models for user data storage and retrieval.

Required Changes

  • Addition of environment variable DATABASE_URL for Neon config
  • Creation of dev/preview branch specific Github OAuth app
  • Connect Neon & Vercel for database branching for preview deployments
  • Automated Prisma model migration for preview branches & merging

Resolves #734
Resolves #647

Copy link

vercel bot commented Jun 9, 2025

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

Name Status Preview Comments Updated (UTC)
vets-who-code-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2025 4:21pm

Copy link

github-actions bot commented Jun 9, 2025

🔍 Code Quality Score Breakdown:

  • 📖 Readability: 4/10
  • 📈 Scalability: 5/10
  • 🚀 Performance: 5/10
  • 🛠️ Maintainability: 8/10
  • ✅ Overall Score: 5.5/10

💡 Recommendations:

  • 🧹 Reduce ESLint warnings to improve readability.
  • 📦 Break up complex functions or components.
  • ⚙️ Consider splitting large files or lazy-loading.
  • 🔁 Refactor to increase your overall score next cycle.

Copy link

github-actions bot commented Jun 9, 2025

🔍 Code Quality Score Breakdown:

  • 📖 Readability: 4/10
  • 📈 Scalability: 5/10
  • 🚀 Performance: 5/10
  • 🛠️ Maintainability: 8/10
  • ✅ Overall Score: 5.5/10

💡 Recommendations:

  • 🧹 Reduce ESLint warnings to improve readability.
  • 📦 Break up complex functions or components.
  • ⚙️ Consider splitting large files or lazy-loading.
  • 🔁 Refactor to increase your overall score next cycle.

Copy link

github-actions bot commented Jun 9, 2025

🔍 Code Quality Score Breakdown:

  • 📖 Readability: 4/10
  • 📈 Scalability: 5/10
  • 🚀 Performance: 5/10
  • 🛠️ Maintainability: 8/10
  • ✅ Overall Score: 5.5/10

💡 Recommendations:

  • 🧹 Reduce ESLint warnings to improve readability.
  • 📦 Break up complex functions or components.
  • ⚙️ Consider splitting large files or lazy-loading.
  • 🔁 Refactor to increase your overall score next cycle.

@jonulak jonulak linked an issue Jun 9, 2025 that may be closed by this pull request
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR integrates Prisma with Neon into NextAuth for user authentication and session management in the Vets Who Code app.

  • Configures Prisma ORM and Neon serverless adapter using DATABASE_URL
  • Refactors NextAuth settings into a shared options.ts module with the Prisma adapter
  • Adds Prisma schema and initial migrations for authentication models

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/pages/auth/error.tsx Adjusted layout props, error lookup normalization, and styling
src/pages/api/auth/options.ts Defined NextAuth options with PrismaAdapter and GitHub callbacks
src/pages/api/auth/[...nextauth].ts Simplified API entrypoint to use shared options
src/lib/prisma.ts Initialized PrismaClient with Neon adapter and dev persistence
prisma/schema.prisma Added models for User, Account, Session, VerificationToken, etc.
prisma/migrations/* Included lock file and initial SQL migration for new models
package.json Added Prisma, Neon, NextAuth Prisma adapter, bumped dependencies
.nvmrc Updated Node version to v20
Comments suppressed due to low confidence (5)

src/pages/auth/error.tsx:60

  • Making Layout required may break pages that omit it. Consider keeping it optional or ensuring all pages define a Layout property.
    Layout: typeof Layout;

src/pages/auth/error.tsx:91

  • [nitpick] Reducing the container height from full viewport to 75vh may cause unexpected whitespace on smaller screens; please verify this aligns with the design.
<div className="tw-sm:px-6 tw-lg:px-8 tw-flex tw-min-h-[75vh] tw-flex-col tw-justify-center tw-bg-gray-50 tw-py-12">

src/pages/auth/error.tsx:132

  • The tw-text-secondary utility may not be defined in the Tailwind config. Ensure this color token exists or revert to a standard gray shade.
<p className="tw-text-sm tw-text-secondary">

src/lib/prisma.ts:9

  • If DATABASE_URL is undefined, the connection string becomes the literal "undefined". It’s safer to validate the env var and throw an error if missing.
const connectionString = `${process.env.DATABASE_URL}`;

.nvmrc:1

  • [nitpick] The version format changed from a plain number to a v-prefixed string. For consistency with other projects, consider using 20 or 20.0.0 without the v prefix.
v20

Comment on lines 70 to 71
if (errorType && errorMessages[errorType.toLowerCase()]) {
setError(errorMessages[errorType.toLowerCase()]);
Copy link
Preview

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

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

Calling toLowerCase() twice is redundant. Extract errorType.toLowerCase() to a variable for clarity and performance.

Suggested change
if (errorType && errorMessages[errorType.toLowerCase()]) {
setError(errorMessages[errorType.toLowerCase()]);
if (errorType) {
const normalizedErrorType = errorType.toLowerCase();
if (errorMessages[normalizedErrorType]) {
setError(errorMessages[normalizedErrorType]);
}

Copilot uses AI. Check for mistakes.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jonulak you review this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in 2844ee1

},
5000 // 5 second timeout
);
console.log(JSON.stringify(res.status));
Copy link
Preview

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

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

Using JSON.stringify on a numeric status is unnecessary. Consider console.log(res.status) for simplicity.

Suggested change
console.log(JSON.stringify(res.status));
console.log(res.status);

Copilot uses AI. Check for mistakes.

Copy link

🔍 Code Quality Score Breakdown:

  • 📖 Readability: 5/10
  • 📈 Scalability: 5/10
  • 🚀 Performance: 5/10
  • 🛠️ Maintainability: 8/10
  • ✅ Overall Score: 5.8/10

💡 Recommendations:

  • 🧹 Reduce ESLint warnings to improve readability.
  • 📦 Break up complex functions or components.
  • ⚙️ Consider splitting large files or lazy-loading.
  • 🔁 Refactor to increase your overall score next cycle.

Copy link

🔍 Code Quality Score Breakdown:

  • 📖 Readability: 5/10
  • 📈 Scalability: 5/10
  • 🚀 Performance: 5/10
  • 🛠️ Maintainability: 8/10
  • ✅ Overall Score: 5.8/10

💡 Recommendations:

  • 🧹 Reduce ESLint warnings to improve readability.
  • 📦 Break up complex functions or components.
  • ⚙️ Consider splitting large files or lazy-loading.
  • 🔁 Refactor to increase your overall score next cycle.

@jonulak jonulak marked this pull request as ready for review June 17, 2025 16:33
commit b56e409
Author: Jerome Hardaway <jerome@vetswhocode.io>
Date:   Tue Jun 17 18:24:35 2025 -0400

     Refactor: Replace Section component imports with EngagementModal in various containers (#781)

    - Updated imports in blog, brand, contact, course, cta, donate, event, faq, funfact, gradation, newsletter, profile, quote, register-guide, service, team, testimonial, timeline, video, and zoom-meetings containers to use EngagementModal instead of the previous Section component.
    - Added EngagementModal component with custom animations and accessibility features.
    - Introduced EngagementModal styles for improved UI/UX.

commit bc3c9d2
Author: Jerome Hardaway <jerome@vetswhocode.io>
Date:   Tue Jun 17 13:22:46 2025 -0400

     refactor: remove unused EngagementModal component and associated animations

commit 8add330
Author: Jerome Hardaway <jerome@vetswhocode.io>
Date:   Tue Jun 17 08:44:42 2025 -0400

     Add Engagement Modal with custom animations and accessibility features (#780)

    - Implemented EngagementModal component with props for headline, body, and call-to-action buttons.
    - Added custom CSS animations for emoji wiggle effect on button hover.
    - Integrated Framer Motion for smooth modal transitions.
    - Included accessibility features such as focus trapping and ESC key close functionality.
    - Added session storage logic to prevent multiple modal displays in a session.
    - Provided a development-only button to test modal functionality.

commit e4c58e6
Author: Jerome Hardaway <jerome@vetswhocode.io>
Date:   Wed Jun 11 18:44:26 2025 -0400

    refactor: streamline request body validation and Slack message formatting
Copy link

🔍 Code Quality Score Breakdown:

  • 📖 Readability: 5/10
  • 📈 Scalability: 5/10
  • 🚀 Performance: 5/10
  • 🛠️ Maintainability: 8/10
  • ✅ Overall Score: 5.8/10

💡 Recommendations:

  • 🧹 Reduce ESLint warnings to improve readability.
  • 📦 Break up complex functions or components.
  • ⚙️ Consider splitting large files or lazy-loading.
  • 🔁 Refactor to increase your overall score next cycle.

@jonulak
Copy link
Contributor Author

jonulak commented Jun 18, 2025

@jeromehardaway Changes from master are merged in, ready for review

@jonulak jonulak assigned jonulak and unassigned jonulak Jun 19, 2025
@jonulak jonulak closed this Jun 19, 2025
@jonulak jonulak reopened this Jun 19, 2025
Copy link

🔍 Code Quality Score Breakdown:

  • 📖 Readability: 5/10
  • 📈 Scalability: 5/10
  • 🚀 Performance: 5/10
  • 🛠️ Maintainability: 8/10
  • ✅ Overall Score: 5.8/10

💡 Recommendations:

  • 🧹 Reduce ESLint warnings to improve readability.
  • 📦 Break up complex functions or components.
  • ⚙️ Consider splitting large files or lazy-loading.
  • 🔁 Refactor to increase your overall score next cycle.

@jonulak jonulak merged commit 1871c93 into master Jun 20, 2025
8 checks passed
@jonulak jonulak deleted the jonulak/implement-neon-db branch June 20, 2025 20:09
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.

Implement Prisma ORM with Next.js, Next-Auth & Neon Postgres Attach Neon Databases To Web App
2 participants