Skip to content
This repository was archived by the owner on Jan 3, 2026. It is now read-only.

chore: Backend for onboarding. Takes the user's email and set's their section, year, and campus.#11

Open
PixelHalide wants to merge 2 commits intoManipal-Open-Source-Learning:mainfrom
PixelHalide:OnboardingBackend
Open

chore: Backend for onboarding. Takes the user's email and set's their section, year, and campus.#11
PixelHalide wants to merge 2 commits intoManipal-Open-Source-Learning:mainfrom
PixelHalide:OnboardingBackend

Conversation

@PixelHalide
Copy link

When the user signs up, A document will be created in the userData collection with the email as the primary key.

When the user completes onboarding, it finds their document via their email and updates it to store their data.

Copy link
Member

@PranavU-Coder PranavU-Coder left a comment

Choose a reason for hiding this comment

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

try implementing redis api , can't have user rewrite their mail address again in on-boarding form

also we need the the data of the user from the db since cookies or local storage isn't permanent.

and just a simple boolean value is needed from the db if the user is on-boarded or not

@FirezTheGreat
Copy link
Member

@PranavU-Coder @PixelHalide

After researching this a bit more, I think Redis would be overkill. This can be handled easily using JWT, Zustand, and a one-time fetch from the backend API.

We can create a user variable in the Zustand store to hold essential user details such as their avatar, name, email, and onboarding status. Then, we define a method in the store called refreshUser() that fetches user details from the /api/auth/me route and stores them in the user variable — but only when we explicitly call it.

We'll call refreshUser() once in App.jsx when the website initially renders. If the user’s details change later (e.g., after onboarding), we can call it again to refresh and cache the updated data in Zustand memory.

Does that sound good?

@@ -0,0 +1,71 @@
import express from 'express';
import cors from 'cors';
import { MongoClient } from 'mongodb';
Copy link
Member

Choose a reason for hiding this comment

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

can we use mongoose instead of mongodb, also where's the User Schema? we need to create that first before any further development @PixelHalide @PranavU-Coder

@FirezTheGreat
Copy link
Member

FirezTheGreat commented Jul 12, 2025

Also, please use this file structure instead of writing everything in index.js for efficiency and readability @PixelHalide . Eg -

image

@FirezTheGreat FirezTheGreat changed the title Backend for onboarding. Takes the user's email and set's their section, year, and campus. chore: Backend for onboarding. Takes the user's email and set's their section, year, and campus. Jul 12, 2025
@FirezTheGreat FirezTheGreat added backend Bug related to API / data / server logic needs review Needs code or design review labels Jul 12, 2025
@FirezTheGreat FirezTheGreat linked an issue Jul 12, 2025 that may be closed by this pull request
Copy link
Member

@FirezTheGreat FirezTheGreat left a comment

Choose a reason for hiding this comment

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

Let me know, @PixelHalide, whether we'll go ahead with mongoose or MongoDB, and if there are any updates on the User Schema and file structure.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backend Bug related to API / data / server logic needs review Needs code or design review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Unified Multi-Step Registration Flow at /auth route

3 participants