#Best solution for checks like unique username

6 messages · Page 1 of 1 (latest)

mossy stirrup
#

Right now I am building an app with Vite React and zod, react-hook-form.

I have a form that does not check uniqueness on the username, but if I add a check, what would be the "best practice"? My Convext backend checks if already exists, I'm just wondering where to add the check on the frontend.

red turretBOT
#

Thanks for posting in #1088161997662724167.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.

    - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
    - Use [search.convex.dev](https://search.convex.dev) to search Docs, Stack, and Discord all at once.
    - Additionally, you can post your questions in the Convex Community's #1228095053885476985 channel to receive a response from AI.
    - Avoid tagging staff unless specifically instructed.

    Thank you!
mossy stirrup
#

Would it be best to add the check directly into the Zod schema?

robust basin
#

I'd check with a Convex query, one called api.users.usernameExists.

mossy stirrup
robust basin