Reputation: 33
One will be a standard react web application.
the other will be a react native application.
How would i structure it? I am using rails for the backend (api?).
They would have the same core features but the RN app will have some extra features.
There will be image uploads if that helps.
I'm a react beginner
Upvotes: 0
Views: 618
Reputation: 284
The backend shouldn't care about what front ends you have written that access it, you could write 10 different front ends with each accessing a different feature but all using the same backend.
The only concern here is making sure that you properly authenticate / verify clients for security reasons and have a good security policy for accessing data from the backend.
An example from my work, we have a backend service which handles all the typical things a backend handles, database, security, api, etc. Our application is a "dispatching" application which allows a "dispatcher" to create and assign jobs to their drivers and manage their trucks (fleet). Then we have a RN application for the drivers to use on the go where they can complete their jobs and upload images about the job. The we have a web application which is actually served by the backend itself that acts as the interface for "dispatchers" to assign jobs to drivers. (The backend serving the web application directly might be frowned upon, typically people like to keep their backend as nothing more than an api that is accessed and all interfaces are separate. This is just a result of us building on an existing project over time).
All of our authentication goes through a separate service called the Identity Provider(IDP), the RN app goes to the IDP to authenticate drivers, and the web app goes there as well to authenticate dispatchers. We also have several other web applications that offer separate services but still communicate with the core dispatching backend, each of those can be seen as a front end as well.
So yes, it is very possible, and is done every day. The browser web application is just like another target platform, iOS, android, browser, maybe you even want a native windows program? They're all technically the same thing and use the same backend.
Upvotes: 1