How do I implement a database in my code, with both commonJS and es modules?

How do I implement a database in my code, with both commonJS and es modules? I can initialize the database in server.js which is commonJS, and make functions there, but I don’t know how to access those functions in my other files. For example, in my file called html.js, which is an es module, I need to set and get things from the database.

Repl link: https://replit.com/@AdamChao1/Schedule-Bot-v2