0

I'm building a project that includes both a mobile app (built with Jetpack Compose) and a web app (built with React.js). I want to know the correct architectural approach:

Should both platforms connect to the same backend (e.g., Express.js) and store data in the same database (like MongoDB)?

Or is it recommended to separate them — like having different APIs or even different databases?

This is more of a best-practices question around full-stack architecture for multi-platform apps.

So far, I’ve planned to build a single backend using Node.js + Express and have both the mobile app and website interact with the same API and database.

I just want to confirm whether this is a good/common practice or if it can lead to scaling or security issues later.

I expected that using one backend for both platforms is simpler and keeps everything in sync, but wanted to get community input before finalizing the approach.

2
  • What would be the advantages of duplicating your data in the backend? APIs are usually frontend-agnostic, so there wouldn't be a disadvantage to use both a website and a mobile app as the frontend. Commented Jun 26 at 9:09
  • Ankur, try to follow Domain Driven Design, create a simple architecture of your system, you are mixing presentation layer with domain layer. You can have a microservice with an API that is providing information for many applications apps websites in the presentation layer. The best system is the one that reflects business problem domain. Commented Jun 27 at 15:03

2 Answers 2

1

Working with a single back-end + database will always be the better solution. Not only does it reduce errors but also creates a better structure in general. This way you only have to code something once and it makes you think about it twice.

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
1

It depends on your needs. But most of the time single endpoint is enough.

Making different APIs for mobile and web complicates later. Inconsistent data, race conditions will embrace you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.