Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

262
Views
How to add user in javascript file?

I am working on a web app where I want to use Authmoji ( https://authmoji.com ) for user authentication.

Authmoji provided a live example with next.js for reference. ( https://next-authmoji.vercel.app )

Here's the full source code ( https://github.com/lottamus/nextjs-authmoji )

github source code ss

Here they told us A database is not included. You can use any database you want and add it in this file.

The problem is I don't know how to add database or users in this User.js file.

here is the code

    import { v4 as uuidv4 } from "uuid";

const users = [];

export async function createUser({ phoneNumber, verifyId }) {
  const createdAt = Date.now();
  const user = {
    id: uuidv4(),
    createdAt,

    phoneNumber,
    phoneNumberVerified: false,
    verifyId, // Used to look up the user later
  };

  // This is an in memory store for users, there is no data persistence without a proper DB
  users.push(user);

  return { phoneNumber, createdAt };
}

export async function verifyPhoneNumber({ verifyId, phoneNumber }) {
  // Look up user by the verifyId
  const user = users.find(
    (user) => user.verifyId === verifyId && user.phoneNumber === phoneNumber
  );

  if (user) {
    // Set their phone number as verified
    user.phoneNumberVerified = true;
    user.verifyId = null;
  }

  return user;
}

authmoji Documentation reference link ( https://docs.authmoji.com/ZG9jOjE2NTc4NDk1-quick-start )

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!