This topic is a must-read for everyone planning to work with Viewi.
When you build a front-end application, your architecture will look something like this:
Viewi replaces your front-end framework/library.
These libraries are explicitly written for usage on a server-side only. And they are probably full of code that will not be adequately converted and will not work in the browser. Viewi application should be isolated from the rest of the server application. It is best not to use any models, services, or other classes and functions outside your Viewi codebase.
The code for Viewi should be written with considerations:
Despite all of those limitations, you still can create SPA. They are not so critical. And Viewi offers you a lot more attractive benefits:
In Viewi, getting the data from the server is similar to getting the data in Angular or Vue js. Viewi has built-in HttpClient, which works on both sides:
More about HttpClient here.
Defining the model for your data on Viewi side is recommended, and using it in your back-end controllers/actions when you return the response. The best practice is to convert your DB entity (Active Record, etc.) to Viewi model before sending the response. Once again, keep your Viewi codebase isolated from the rest of the codebase.
Viewi is not the same as LiveView/LiveWire!
Even if you see some similarities, please, don’t be confused. Viewi is using a completely different approach.
Viewi is pretty young. There are so many features to be added. Feel welcome to discuss, ask questions, or request features here: GitHub Discussions.
And don’t forget to support Viewi. It’s important to see your interest, and it will motivate me to bring more to it.