# What is the best design if I would like to provide one API server and multiple single page applications?

**URL:** <https://community.auth0.com/t/what-is-the-best-design-if-i-would-like-to-provide-one-api-server-and-multiple-single-page-applications/59398>\
**Category:** Get Help\
**Tags:** login\
**Created:** [March 14, 2021, 12:44pm UTC](https://community.auth0.com/t/what-is-the-best-design-if-i-would-like-to-provide-one-api-server-and-multiple-single-page-applications/59398 "2021-03-14T12:44:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hideaki.ishii1204](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hideaki.ishii1204/32/28158_2.png) [@hideaki.ishii1204](https://community.auth0.com/u/hideaki.ishii1204)\
**Post date:** [March 14, 2021, 12:44pm UTC](https://community.auth0.com/t/what-is-the-best-design-if-i-would-like-to-provide-one-api-server-and-multiple-single-page-applications/59398/1 "2021-03-14T12:44:57Z")

</div>

Hi, thank you for your awesome product!

I currently think about providing one API server and multiple SPAs using Auth0:

- Core API server
  - This is a Rails-based API
  - Verify tokens from both SPAs
  - After verifying, it stores the Auth0 metadata (`user_id` or something) in our application’s DB and uses it if needed

- SPA for users (ToC application)
  - Provide both `Login` and `Signup` features
  - Verifying emails is required
  - After a user signs up, it sends an email to verify the user’s email and put a redirect link there
  - After clicking the redirect link, the user can sign in to the application

- SPA for clients (ToB application)
  - Provide only `Login` feature and administrators would create accounts for them on Auth0 Dashboard
  - Verifying emails is not needed for them

I’m not sure I can satisfy such specifications using only one tenant (1 API and 2 SPAs).

- Is it possible to do that using only one tenant?
  - Can customize login flows for each application like the above?
  - Even if possible, is it so hard? (e.g. managing Auth0 API and building a custom Login UI by myself or something)

- If it’s impossible or not recommended, is it better to use different tenants for each application?
  - For example, creating ToC application tenant and ToB application tenant, and configuring `disable signup` for only ToB application tenant.
  - Then we might have to separate the core API endpoint for the applications

Sorry for the confusing question.  
If it’s not enough, I’ll share more information with you.

Best regards,

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [March 17, 2021, 5:41pm UTC](https://community.auth0.com/t/what-is-the-best-design-if-i-would-like-to-provide-one-api-server-and-multiple-single-page-applications/59398/3 "2021-03-17T17:41:35Z")

</div>

Hi @hideaki.ishii1204,

Welcome to the Community!

> [@hideaki.ishii1204](#):
>
> Is it possible to do that using only one tenant?

Yes, you can accomplish this with one tenant.

To configure your tenant to only allow signups for the ToC application, you could:

- Create a new Database Connection for the ToB application and disable signups.

 ![screenshot-manage.auth0.com-2021.03.17-13_04_20](https://global.discourse-cdn.com/auth0/original/3X/2/2/220cb804c2e836bf5c28bbdc837a5fae5418a5f1.png)

- In the ToB application, only enable this database connection.
- In the ToC application, enable any connections you’d like _except_ the connection you created for the ToB application.

To handle email verification, you could follow this guide for custom email handling:  
[https://auth0.com/docs/auth0-email-services/manage-email-flow](https://auth0.com/docs/auth0-email-services/manage-email-flow)

In the rule, you could check to make sure that the `context.clientID` is the Client ID of the ToC application.

---

<div class="post-metadata">

**Author:** ![hideaki.ishii1204](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hideaki.ishii1204/32/28158_2.png) [@hideaki.ishii1204](https://community.auth0.com/u/hideaki.ishii1204)\
**Post date:** [March 28, 2021, 1:44am UTC](https://community.auth0.com/t/what-is-the-best-design-if-i-would-like-to-provide-one-api-server-and-multiple-single-page-applications/59398/4 "2021-03-28T01:44:48Z")

</div>

Thank you for the awesome reply!  
I will try to create a new DB connection following your advice!

---

<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:** [April 12, 2021, 1:45am UTC](https://community.auth0.com/t/what-is-the-best-design-if-i-would-like-to-provide-one-api-server-and-multiple-single-page-applications/59398/5 "2021-04-12T01:45:18Z")

</div>

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