# API to Database - architectural question

**URL:** <https://community.auth0.com/t/api-to-database-architectural-question/53626>\
**Category:** Get Help\
**Created:** [November 20, 2020, 9:08pm UTC](https://community.auth0.com/t/api-to-database-architectural-question/53626 "2020-11-20T21:08:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve\_P](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/steve_p/32/12715_2.png) [@Steve\_P](https://community.auth0.com/u/Steve_P)\
**Post date:** [November 20, 2020, 9:08pm UTC](https://community.auth0.com/t/api-to-database-architectural-question/53626/1 "2020-11-20T21:08:13Z")

</div>

Hi Folks,

currently, I’m working on a little side project which is a mobile application.  
I want to use MongoDB and most probably NodeJS/ExpressJS for my REST API.

I’ve read some articles about how to secure my API with Auth0… that’s fine so far.

Now to my open questions:

- My API has the connection String with, of course, always the same user. Is this a common approach? Do I need to separately secure this connection between NodeJS and MongoDB? If yes, can I do this with Auth0?
- I want to use Auth0 for user logon and MongoDB to store the actual data. For that I want to use an UUID to safe/query the corresponding user data into/from the database (my thoughts: when the DB gets hacked no one is able to linkt the data to the user). Can I use the user\_id attribute of Auth0 for this purpose? Does this make any sense, anyway?

Hopefully someone can answer my questions 🙂

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 23, 2020, 5:55pm UTC](https://community.auth0.com/t/api-to-database-architectural-question/53626/3 "2020-11-23T17:55:42Z")

</div>

Hi @Steve_P,

Welcome to the Community!

> [@Steve\_P](#):
>
> I want to use Auth0 for user logon and MongoDB to store the actual data.

Do you want to set up a [Custom Database](https://auth0.com/docs/connections/database/custom-db) that Auth0 connects to and houses you user’s authentication data (like password hashes and such)? Or a database you store non-auth user data (like blog posts, photos, etc) after authentication with an Auth0 DB/social connection.

> [@Steve\_P](#):
>
> For that I want to use an UUID to safe/query the corresponding user data into/from the database (my thoughts: when the DB gets hacked no one is able to linkt the data to the user). Can I use the user\_id attribute of Auth0 for this purpose? Does this make any sense, anyway?

The user\_id property is the UUID we use and is often used for making a logical connection with a user’s data on a backend DB. As for the security benefits of not storing things like email/personal data, you may be better off asking that kind of general security question on information security stack exchange.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [December 14, 2020, 4:48pm UTC](https://community.auth0.com/t/api-to-database-architectural-question/53626/4 "2020-12-14T16:48:07Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
