I’m managing a file-based DB React webapp (map.hoopers.club) and developing mobile version using React-Native. For business purposes it was decided to use SQL instead of NoSql DBs for the mobile app project.
We already have some data (courts) added by users so we migrated the data to a SQL DB and the goal is to both, webapp and mobile-app, use the same DB.
I didn’t develop the webapp myself and am not 100% comfortable with all that was developed prior. I am able to connect to the SQL DB to get the records to populate my map with courts. I think that creating a new court connecting to the SQL DB and creating new records won’t be an issue as well.
My issue is the content manager. The project has a file-based DB so Netlify-CMS was implemented to deal with manage content, so our team can edit and approve users submissions. Shifting to SQL DB, if I understood correctly, Netlify-CMS won’t work, right? Can you point me to a similar tool to create a simple content manager that is able to update SQL DB records?
I may not be following correctly, but it would generally depend on where the separation of concerns was.
If the Netlify CMS is being used to manage content that is different from the content in the SQL DB, then you could use both.
For example if you were managing the site structure and page content in the Netlify CMS, but only data for the generation of a map in the SQL database.
However if you’re trying to manage everything in the SQL DB, then Netlify CMS wouldn’t be a good fit.
I can’t advise what you should use to manage your SQL DB records, but a quick google should provide you with a range of options.
Courts that are added by users can be easily added to SQL DB. Issue is that for each submission from users we do validation via content manager. The validation updates records on our file system. But I don’t think I can update SQL DB when we create or make changes via Netlify-CMS.
I was asking because I didn’t know if Netlify provides a content manager like Netlify-CMS for relational DB.
@nathanmartin let me try to explain better the flow I’m trying to achieve, and the issues I’m encoutering. Maybe there’s an easy workaround and I’m not thinking correctly. Please bear with me as I’m not very experienced and am trying to find the best architecture for our project.
I have a react webapp where anyone online can create a record. That record is stored via netlify-functions (submit-created.js) to github by updating JSON file. We then validate its content via Netlify-CMS which, for what I understood, when you update, create or delete a record it updates the JSON on github triggering a new build.
Now we want to create a mobile app that uses the same data. It is being developed in React-Native but we are opting to go to relational db. I created the SQL DB by migrating the records we have on the webapp as file storage. All fine here.
My problem is, when a record is created via user (webapp or mobile app) we need to validate the input, thus Netlify-CMS doing it’s work perfectly and would prefer to keep it as our content creators are already used to it.
I’m thinking maybe I can update the JSON file when a record is created on the mobile app and both platforms can be up to date with the same data. BUT, when we make changes on the CMS, how could I update records on my SQL DB? Could it be done via the newly updated JSON file when main.js runs after the CMS action? Any other idea? Is it too bad of a practice to do so?
You could create an event registration that sends the data back to a netlify function to forward it to your SQL db. It’s not too different from your flow of data towards the CMS, I suppose. It might be a lot less complex to switch to a non-git based CMS altogether though…
Thanks for your solution @tomrutgers! Might be a way to quickly have something to test it out. These events are called within
I don’t know what your app.js is doing, but wherever you load the CMS, yes.
I was able to create a CMS that manages my Postgresql database. Locally I was able to read all records and through my form I was using submission-created.js to create records. But on deploy I found out that Netlify doesn’t have static IP’s. So I cant add it to Azure’s whitelist. I am not sure what workaround are there for me as I’m not looking to have security flaws in my database server.
Im open for sugestions, please.
Depending on how you’re making a connection to your database from Netlify Functions, you could possibly send some encrypted headers or information that your DB can verify.
Not the most ideal situation I guess, but the only way this is possible, I believe.
Uhhh… I have no idea how to accomplish that.
So, the quickest safest way is to actually host my node API in somewhere with static IPs, right?
Thanks for the helping out.
Yes, in that case you’d have to host it somewhere with static IPs.