0

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

2
  • Of course you can. Probably it will be easier if you use graphql.org instead of REST. For example you can divide the app to: /graphql, /graphiql, /serveUI, etc... However you can not use the same client code for React and React Native Commented Dec 10, 2016 at 0:49
  • Thankyou, Can i use this with rails? is using the same client code the best practice? Commented Dec 11, 2016 at 15:09

1 Answer 1

1

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.

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

2 Comments

Thankyou. Could you please explain what an Identity provider is?
@Omorhefereimoloame An identity provider is just any back end service which stores user credentials and can "identify" a user given credentials. In production environments it is responsible for a back end knowing that a user is legitimate. Facebook and github can even be used as identity providers by third party applications, ever see "Sign in with facebook/google/github"?

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.