thanks for sharing that detail. While it is possible to run a serverless function that could theoretically connect to something like a database, serverless functions are very short lived and you wouldn’t be able to maintain a connection to a database the way you are expecting.
This information might help:
there are databases such as fauna or airtable that might work for your purposes, which is maybe worth investigating. good luck!