Skip to content

Conversation

@amshula-05
Copy link


🚀 Scalable Database Integration, Authentication, and User Progress Tracking

Overview

This PR implements a robust, production-ready database and authentication system for Notes-Aid, designed to efficiently handle 20,000+ users per month with optimal performance, security, and maintainability.


Key Features

1. Database Integration

  • Integrated a scalable PostgreSQL database (Supabase) using Prisma ORM for type-safe, performant access.
  • Connection pooling and indexing for optimal performance at scale.

2. Authentication

  • Added NextAuth.js authentication with Google OAuth for secure user login and session management.
  • Used Prisma adapter for persistent sessions and user management in the database.
  • Role-based access control (admin/user) for secure admin endpoints.

3. API Endpoints

  • Implemented secure API endpoints for:
    • User progress tracking (/api/user/progress)
    • User analytics logging (/api/user/analytics)
    • User preferences management (/api/user/preferences)
    • Admin stats dashboard (/api/admin/stats)
  • All endpoints are protected by authentication and authorization.

4. Frontend Integration

  • Linked progress tracking UI to the database for logged-in users—progress is now persistent and user-specific.
  • Custom React hooks (useDatabase, useAnalytics, usePreferences) for easy API interaction.
  • Login/logout button in the UI for user authentication.

5. Performance & Scalability

  • Designed for 20k+ users/month .
  • Efficient queries, indexing, and connection pooling for sub-100ms response times.
  • Production-ready error handling and security best practices.

6. Documentation & Maintainability

  • Added .env.example and README-DATABASE.md for easy setup and onboarding.
  • Updated README.md with a summary of new features and integration steps.
  • Code is modular, well-documented, and ready for future expansion.

###DATABASE
image
image
image
image
image


How to Use

  1. Copy .env.example to .env and fill in your credentials.
  2. Run npx prisma migrate dev to set up the database.
  3. Start the dev server with npm run dev inside the notes-aid directory.
  4. Sign in with Google to create your user account.
  5. Use the provided API endpoints and hooks in your UI.

This PR provides a scalable, secure, and maintainable foundation for Notes-Aid’s future growth and feature development.


@vercel
Copy link

vercel bot commented Jul 24, 2025

@amshula-05 is attempting to deploy a commit to the minavkaria's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

👋 Hey there! Welcome to Notes-Aid! 🚀

Thank you for submitting your first pull request. Your contribution is valuable in enhancing academic learning for everyone. 💙

✅ Our team will review your PR soon. In the meantime:

  • Ensure your changes follow the Contributing Guidelines.
  • If you are adding Notes, Comment down which subject's modules have you added in the notes.

🌟 We're grateful for your support in improving Notes-Aid. Happy coding! 💻

@amshula-05
Copy link
Author

amshula-05 commented Jul 24, 2025

Hello sir,

I have also implemented some of the features mentioned in #99.

✅ What's Added:

  • Added functionality to assign user and admin roles to students.
  • Currently, admin privileges are just a placeholder — no extra functionalities have been assigned to admins yet.

If you'd like me to:

  • Implement admin-specific functionality, or
  • Modify anything based on your expectations for admin behavior,

please let me know and I will work on it accordingly.

Additionally, if you'd like more details or images related to the database structure, I’d be happy to share them.

@MinavKaria
Copy link
Owner

@amshula-05 Thank you for the PR, I'll check the output and let you know in few days.

@vercel
Copy link

vercel bot commented Jul 28, 2025

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

Name Status Preview Comments Updated (UTC)
notes-aid ❌ Failed (Inspect) Jul 28, 2025 10:07am

@aarushsaboo
Copy link
Collaborator

@amshula-05 Can you share a video demonstrating the functionality you've added of the website( show us the output when we click on the sign up button and the authorization that's happening)

@aarushsaboo
Copy link
Collaborator

We don't need the Sign In feature as of now, thank you though.

@amshula-05
Copy link
Author

Notes-Aid.1.mp4

@amshula-05
Copy link
Author

Notes-Aid-Login-Screen.mp4

@MinavKaria MinavKaria force-pushed the main branch 8 times, most recently from 5c35ceb to 14e023d Compare September 2, 2025 15:46
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.

3 participants