CodeIgniter Forums
Anyone using CI with React,Vue,Svelte or Marko? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Best Practices (https://forum.codeigniter.com/forum-12.html)
+--- Thread: Anyone using CI with React,Vue,Svelte or Marko? (/thread-75685.html)



Anyone using CI with React,Vue,Svelte or Marko? - tweenietomatoes - 03-05-2020

I am just wondering if there are any people out there who's using CI with JS frameworks rather than traditional web apps?

Is it easy to integrate?


RE: Anyone using CI with React,Vue,Svelte or Marko? - samyam - 03-05-2020

you can just use api from CI and build your js framework seperately


RE: Anyone using CI with React,Vue,Svelte or Marko? - zahhar - 03-06-2020

I did a couple of tries with VueJs -> nothing spectacular, it just works.

Here is good advice on Ajax calls setup for reactive frontend frameworks:
https://codeigniter4.github.io/userguide/general/ajax.html

And when you will be building your backend, you should ensure that you follow some basic architectural principles and constrains. For example, you should split all communication between FE and BE into small requests, serve each piece as JSON from dedicated controller/method, and gracefully process errors. Those pages in user guide will help you to start:
https://codeigniter4.github.io/userguide/outgoing/response.html
https://codeigniter4.github.io/userguide/outgoing/api_responses.html

Then basically all what you have to do if you are building VueJs SPA is to serve your layout that initializes VueJs, and let javascript do the rest. CI4 will not be envolved more then responding to Ajax requests coming to API methods you defined.


RE: Anyone using CI with React,Vue,Svelte or Marko? - albertleao - 03-06-2020

I use Vue with codeigniter 3.

My codeigniter app is just a json backend at this point. Having a json backend that's not coupled with the front end makes it easier to port applications too (I'm currently converting my CI app to Laravel).


RE: Anyone using CI with React,Vue,Svelte or Marko? - tweenietomatoes - 03-06-2020

Actually if i would use a fullstack or almost fullstack framework/toolkit like CI, ~especially in PHP where we can easly integrate into front end code at server-side(they're trying to advert JS as only logical thing to use in front end and lastly asp.net's blazor)~, i would not want to waste my time trying to handle JWT to auth user instead of using server-side sessions. I am not familiar with SPA user auth. Is there any recommendations?

I am thinking to use JWT in SPA and keep user token with cookie-js to persist it.


RE: Anyone using CI with React,Vue,Svelte or Marko? - Kaosweaver - 03-06-2020

We use CI with ReactJS for an application that is a SaaS for 1700 locations with thousands of concurrent users (all day long too) - we handle a boat load of POS transactions, appointments, services, etc all through the app, largely using ReactJS front end.

So, yes, it can do it very well.