Import app (the initialized FirebaseApp) from src/lib/firebase.ts.
Import getFirestore from firebase/firestore.
Inside the handleSubmit function, right before creating the document reference, call const db = getFirestore(app, "your_database_name");
This db instance (which is now guaranteed to be for the "your_database_name" database) will be used in the doc(db, "users", user.uid) and setDoc(...) calls.