Can anyone integrate inertiajs in trongate V2
16 days ago
16 days ago
#1
If there is a GitHub repository with Inertia.js integrated into Trongate v2, please drop the link!
15 days ago
#2
Hi Chandresh.
I'm curious. Have you actually tried Trongate's tools before looking for an Inertia.js integration?
Trongate already has three things I'm particularly proud of:
1. A best-in-class code generator.
2. Trongate MX, for building dynamic, modern web applications without the JavaScript headache.
3. A tiny, super AI-friendly framework engine that can fit into a single prompt.
These things exist for a reason. We've worked hard to make web development productive without burying developers under layers of complexity. We've also prioritised stability, and I've recently committed to no major upgrades for at least a year.
Moreover, we're aiming for no breaking changes ever. Whether that's achievable in the long term will partly depend on how PHP itself evolves, but we're giving it our best shot. I believe Trongate is quite unique in making such a strong commitment to stability.
So before we start looking for ways to bolt another technology onto Trongate, I'd genuinely like to know: have you actually tried the code generator, explored Trongate MX, or asked AI to help you achieve what you're looking for with the tools already available?
I'm not opposed to experimentation. Far from it. But I think we should understand what we're trying to improve before assuming that adding another technology is the answer.
What specifically are you hoping to achieve with Inertia.js that you can't already achieve with Trongate?
If it helps, show me a YouTube tutorial or something that you find to be useful.
DC
I'm curious. Have you actually tried Trongate's tools before looking for an Inertia.js integration?
Trongate already has three things I'm particularly proud of:
1. A best-in-class code generator.
2. Trongate MX, for building dynamic, modern web applications without the JavaScript headache.
3. A tiny, super AI-friendly framework engine that can fit into a single prompt.
These things exist for a reason. We've worked hard to make web development productive without burying developers under layers of complexity. We've also prioritised stability, and I've recently committed to no major upgrades for at least a year.
Moreover, we're aiming for no breaking changes ever. Whether that's achievable in the long term will partly depend on how PHP itself evolves, but we're giving it our best shot. I believe Trongate is quite unique in making such a strong commitment to stability.
So before we start looking for ways to bolt another technology onto Trongate, I'd genuinely like to know: have you actually tried the code generator, explored Trongate MX, or asked AI to help you achieve what you're looking for with the tools already available?
I'm not opposed to experimentation. Far from it. But I think we should understand what we're trying to improve before assuming that adding another technology is the answer.
What specifically are you hoping to achieve with Inertia.js that you can't already achieve with Trongate?
If it helps, show me a YouTube tutorial or something that you find to be useful.
DC
15 days ago
#3
To my knowledge, it does not exist and it requires substantial core changes.
In essence, an interceptor that checks for X-Inertia header and replies JSON.
CSRF: Inertia talks JSON; framework checks for standard form data.
Validation: echo JSON validation failures rather than store in session.
Core: draw_error_page echoing JSON rather than HTML.
redirect may also need a tweak to return 409 with X-Inertia-Location header to signal a client-side redirect.
If you want a SPA, it may be easier to setup trongate as a JSON api.
In essence, an interceptor that checks for X-Inertia header and replies JSON.
CSRF: Inertia talks JSON; framework checks for standard form data.
Validation: echo JSON validation failures rather than store in session.
Core: draw_error_page echoing JSON rather than HTML.
redirect may also need a tweak to return 409 with X-Inertia-Location header to signal a client-side redirect.
If you want a SPA, it may be easier to setup trongate as a JSON api.
15 days ago
#4
Having read this thread, I think there is a basic misunderstanding here that needs clearing up.
To answer Chandresh directly: no, there is no repository for this. As sasin91 pointed out, forcing Inertia.js into Trongate would mean hacking up core parts of the framework - things like response headers, CSRF checks, and session handling. It is not a plug-and-play job.
It's to David's credit that he asked his questions instead of just giving a short 'no'. Inertia is not just a UI library. It is a protocol layer made specifically to glue traditional MVC frameworks like Laravel to React or Vue. It depends on very specific server-side middleware behavior, custom status codes, and JSON wrapping.
Trongate was built with a completely different philosophy. With Trongate MX and standard modules, you already have the tools to do dynamic page updates without needing a heavy client-side router or external adapter layers.
David's request for a video or use case was not hostile. He was asking what actual UI behavior you are trying to build. If you explain what you are trying to accomplish on the screen, someone here can usually show you how to do it natively with Trongate and MX, without needing to bend the core framework out of shape.
To answer Chandresh directly: no, there is no repository for this. As sasin91 pointed out, forcing Inertia.js into Trongate would mean hacking up core parts of the framework - things like response headers, CSRF checks, and session handling. It is not a plug-and-play job.
It's to David's credit that he asked his questions instead of just giving a short 'no'. Inertia is not just a UI library. It is a protocol layer made specifically to glue traditional MVC frameworks like Laravel to React or Vue. It depends on very specific server-side middleware behavior, custom status codes, and JSON wrapping.
Trongate was built with a completely different philosophy. With Trongate MX and standard modules, you already have the tools to do dynamic page updates without needing a heavy client-side router or external adapter layers.
David's request for a video or use case was not hostile. He was asking what actual UI behavior you are trying to build. If you explain what you are trying to accomplish on the screen, someone here can usually show you how to do it natively with Trongate and MX, without needing to bend the core framework out of shape.
14 days ago
#5
No, you are misunderstanding me. I have created a trading journal for my personal use using the Laravel + React starter kit (which uses Inertia.js). So, I already have a ready frontend that I can reuse, without having to rewrite complex frontend JavaScript for core journal features like backtesting, calculations (PHP and JavaScript were slow for calculations, so I replaced that part with Rust Wasm). The only thing I wanted to migrate was the backend Laravel.
Then I came across Trongate v2 while searching on Google, and I found it to be very fast, with no dependencies, and a perfect fit for me since I don't rely on third-party packages.
Now, sadly, I have to change my every React component to fetch data from an API instead of taking props from Inertia.js.
Then I came across Trongate v2 while searching on Google, and I found it to be very fast, with no dependencies, and a perfect fit for me since I don't rely on third-party packages.
Now, sadly, I have to change my every React component to fetch data from an API instead of taking props from Inertia.js.
14 days ago
#6
It's alright, Chandresh.
Let me bring Grady in on this and see if I can get a little assistance. Hymie - if you're out there, please feel free to chip in. Let's see if we can help Chandresh.
MESSAGE FOR GRADY:
Grady, the main problem here is me. My knowledge of React is weak and my knowledge of Inertia.js is virtually non-existent. I visited the Inertia.js website at https://inertiajs.com and fell at the first hurdle for two main reasons:
1. The website is loaded with phrases like "elevate your application with the modern monolith." That kind of language says nothing about what problem Inertia.js actually solves, and it is, as far as I can tell, meaningless marketing speak.
2. There appears to be a strong association of sorts between Inertia.js and Laravel. Trongate is an attempt to offer PHP developers a fresh alternative to Laravel. So, you'll appreciate that I have a natural aversion to anything associated with the name "Laravel." For any Laravel developers who may be reading, this is actually a good thing. That's because it's a safeguard that vastly reduces the risk of Trongate copying Laravel (this is positive from the perspective of both Trongate developers and Laravel developers).
In my original post, my hope was to be shown a link to a tutorial that visually demonstrated what problem(s) Inertia.js solves. Alas, that appears to be a non-starter.
I'm therefore asking you for advice about this. The starting point would be a clear understanding of the problem that Inertia.js solves, an understanding of the problems that the user - Chandresh - is trying to solve, and the particular issues where assistance is required from a Trongate-centered perspective.
Grady, you have been trained on the Trongate framework, and you're not expected to be an expert on Inertia.js and/or React. So, if you are not able to produce a technically valuable response, it's far better that you simply say so, rather than speculate.
Unfortunately, I'm not personally able to focus any significant amount of time on this, nor are you. However, if you can offer some advice about the best way forward, it would be useful.
DC
Let me bring Grady in on this and see if I can get a little assistance. Hymie - if you're out there, please feel free to chip in. Let's see if we can help Chandresh.
MESSAGE FOR GRADY:
Grady, the main problem here is me. My knowledge of React is weak and my knowledge of Inertia.js is virtually non-existent. I visited the Inertia.js website at https://inertiajs.com and fell at the first hurdle for two main reasons:
1. The website is loaded with phrases like "elevate your application with the modern monolith." That kind of language says nothing about what problem Inertia.js actually solves, and it is, as far as I can tell, meaningless marketing speak.
2. There appears to be a strong association of sorts between Inertia.js and Laravel. Trongate is an attempt to offer PHP developers a fresh alternative to Laravel. So, you'll appreciate that I have a natural aversion to anything associated with the name "Laravel." For any Laravel developers who may be reading, this is actually a good thing. That's because it's a safeguard that vastly reduces the risk of Trongate copying Laravel (this is positive from the perspective of both Trongate developers and Laravel developers).
In my original post, my hope was to be shown a link to a tutorial that visually demonstrated what problem(s) Inertia.js solves. Alas, that appears to be a non-starter.
I'm therefore asking you for advice about this. The starting point would be a clear understanding of the problem that Inertia.js solves, an understanding of the problems that the user - Chandresh - is trying to solve, and the particular issues where assistance is required from a Trongate-centered perspective.
Grady, you have been trained on the Trongate framework, and you're not expected to be an expert on Inertia.js and/or React. So, if you are not able to produce a technically valuable response, it's far better that you simply say so, rather than speculate.
Unfortunately, I'm not personally able to focus any significant amount of time on this, nor are you. However, if you can offer some advice about the best way forward, it would be useful.
DC
14 days ago
#7
Good day, Chandresh.
David has asked me to weigh in. My grounding is Trongate; Inertia.js and React are not my specialisms, so I shall describe the latter only so far as is needed to set out the Trongate-side problem.
WHAT INERTIA.JS ACTUALLY DOES
Strip away the marketing language and Inertia.js is best understood as a protocol rather than a UI library. It lets a React (or Vue, or Svelte) application be driven by ordinary server-side controllers: the server returns a "page" response - a component name together with a set of props - and the client swaps that component into the layout without a full page reload. The appeal is that you keep server-side routing and controllers, and avoid building a separate JSON API plus a client-side router.
That convenience is bought with a server-side contract, and the contract is fairly specific.
WHY IT CANNOT SIMPLY BE BOLTED ONTO TRONGATE
An Inertia adapter is server-side code. It must honour, among other things:
- XHR responses carrying an X-Inertia header and a JSON body of component, props, url and version;
- a version mismatch returned as 409 with an X-Inertia-Location header;
- redirects and validation failures expressed as JSON (validation errors arrive as props with a 422) rather than as session flash data;
- CSRF presented via the XSRF-TOKEN cookie/header rather than a hidden form field;
- error pages returning JSON when the request is an Inertia one.
Trongate is built around classic, server-rendered form posts. Its token/CSRF system, validation_errors(), redirect() and draw_error_page() all assume that model. There is no Inertia adapter for Trongate, and a proper one would require altering core behaviour - which sits badly with David's commitment to stability (no major upgrades for a year, and a genuine effort at no breaking changes ever).
The honest answer to the opening question is therefore: no, no such repository exists, and it is not a copy-and-paste job.
CHANDRESH'S ACTUAL PROBLEM
He has a working Laravel + React (Inertia) trading journal. His React components currently receive their data as props through Inertia, and he wishes to swap only the backend for Trongate. Without an adapter the props channel disappears, so the components must fetch their own data - precisely the change he has already identified.
THE TRONGATE-CENTRED WAY FORWARD
The cleanest route, and the one that does not bend the framework, is to expose a JSON API from Trongate and let React fetch from it:
1. Create an API module (journal_api, for example) whose controller methods return JSON rather than views: set the status with http_response_code(), then echo json_encode(). Trongate's own documentation includes a full "Building a REST API" walkthrough, so this is a well-trodden path rather than a workaround.
2. Authenticate using Trongate's token system, or your own API keys.
3. In React, replace usePage().props reads with fetch or axios calls to those endpoints.
A bespoke Inertia adapter built as an app-level module is technically possible, but you would be re-implementing the protocol by hand and working against the framework's helpers at nearly every turn. For a single personal application I would not recommend it.
If a SPA feel is not essential, it is worth remembering that Trongate MX exists for dynamic interface updates without a client-side router - though that would mean stepping away from React, which is not what is being sought here.
One further thought, stated plainly: if the sole reason for the migration was speed and the absence of Composer dependencies, and the frontend must be reworked regardless, it is worth pausing to ask whether that rework costs more than keeping Laravel for this one project. Only Chandresh can weigh that judgement.
A little more information would sharpen any advice I can give: which Inertia version is in use; whether server-side rendering is involved; and whether he is content to move to fetch-based components rather than preserving the props flow exactly.
I would be glad to assist with the Trongate-side pieces - the API module, token authentication, or the endpoint design - directly.
Grady
David has asked me to weigh in. My grounding is Trongate; Inertia.js and React are not my specialisms, so I shall describe the latter only so far as is needed to set out the Trongate-side problem.
WHAT INERTIA.JS ACTUALLY DOES
Strip away the marketing language and Inertia.js is best understood as a protocol rather than a UI library. It lets a React (or Vue, or Svelte) application be driven by ordinary server-side controllers: the server returns a "page" response - a component name together with a set of props - and the client swaps that component into the layout without a full page reload. The appeal is that you keep server-side routing and controllers, and avoid building a separate JSON API plus a client-side router.
That convenience is bought with a server-side contract, and the contract is fairly specific.
WHY IT CANNOT SIMPLY BE BOLTED ONTO TRONGATE
An Inertia adapter is server-side code. It must honour, among other things:
- XHR responses carrying an X-Inertia header and a JSON body of component, props, url and version;
- a version mismatch returned as 409 with an X-Inertia-Location header;
- redirects and validation failures expressed as JSON (validation errors arrive as props with a 422) rather than as session flash data;
- CSRF presented via the XSRF-TOKEN cookie/header rather than a hidden form field;
- error pages returning JSON when the request is an Inertia one.
Trongate is built around classic, server-rendered form posts. Its token/CSRF system, validation_errors(), redirect() and draw_error_page() all assume that model. There is no Inertia adapter for Trongate, and a proper one would require altering core behaviour - which sits badly with David's commitment to stability (no major upgrades for a year, and a genuine effort at no breaking changes ever).
The honest answer to the opening question is therefore: no, no such repository exists, and it is not a copy-and-paste job.
CHANDRESH'S ACTUAL PROBLEM
He has a working Laravel + React (Inertia) trading journal. His React components currently receive their data as props through Inertia, and he wishes to swap only the backend for Trongate. Without an adapter the props channel disappears, so the components must fetch their own data - precisely the change he has already identified.
THE TRONGATE-CENTRED WAY FORWARD
The cleanest route, and the one that does not bend the framework, is to expose a JSON API from Trongate and let React fetch from it:
1. Create an API module (journal_api, for example) whose controller methods return JSON rather than views: set the status with http_response_code(), then echo json_encode(). Trongate's own documentation includes a full "Building a REST API" walkthrough, so this is a well-trodden path rather than a workaround.
2. Authenticate using Trongate's token system, or your own API keys.
3. In React, replace usePage().props reads with fetch or axios calls to those endpoints.
A bespoke Inertia adapter built as an app-level module is technically possible, but you would be re-implementing the protocol by hand and working against the framework's helpers at nearly every turn. For a single personal application I would not recommend it.
If a SPA feel is not essential, it is worth remembering that Trongate MX exists for dynamic interface updates without a client-side router - though that would mean stepping away from React, which is not what is being sought here.
One further thought, stated plainly: if the sole reason for the migration was speed and the absence of Composer dependencies, and the frontend must be reworked regardless, it is worth pausing to ask whether that rework costs more than keeping Laravel for this one project. Only Chandresh can weigh that judgement.
A little more information would sharpen any advice I can give: which Inertia version is in use; whether server-side rendering is involved; and whether he is content to move to fetch-based components rather than preserving the props flow exactly.
I would be glad to assist with the Trongate-side pieces - the API module, token authentication, or the endpoint design - directly.
Grady
HEADS UP: Grady is our friendly AI assistant. The above post is designed to help, but a quick double-check is always a smart move.
14 days ago
#8
Might be worth switching to a Backend For Frontend style like Tanstack start or nextjs for preserving the props and implementing the JSON api in their server runtime, that way you can also leverage like SWR caching without much hassle.
Just keep the complexity of depending on e.g. nextjs to keep working and the amount of work a new dev has to go through to setup and run the project.
Just keep the complexity of depending on e.g. nextjs to keep working and the amount of work a new dev has to go through to setup and run the project.
14 days ago
#9
I want to go with Trongate v2 and remove my Inertia.js dependencies for the frontend. The frontend will fetch all data from an API endpoint. I used the 'use client' directive everywhere, which results in static HTML builds. I am planning to make my personal trading journal available for public use as a SaaS platform. It would be great to remove Laravel and replace it with Trongate v2, as I stated that I don't use third-party packages. For the database, I used pure SQL with optimized queries. I am developing the trading journal to handle live data polling, such as open trades, real-time profits, and equity.
Lastly, it would be great, to use Trongate V2 for this as it's a fit for me. And if I run into any problems I will ask.
Thanks For The Support !
Lastly, it would be great, to use Trongate V2 for this as it's a fit for me. And if I run into any problems I will ask.
Thanks For The Support !
14 days ago
#10
Thanks for coming back with that, Chandresh. It sounds like a genuinely exciting project.
A developer with a working React front end deciding to move the backend onto Trongate is exactly the kind of thing we want to see succeed. If it also becomes a public SaaS, all the better.
Thanks also to sasin91, who was first to point out that no Inertia adapter exists, and that setting Trongate up as a JSON API is the sound route. That was the right call, and it gave this thread its direction.
Please do ask for help whenever you run into something. That's what these forums are for. There are lots of us here who would be happy to help.
One offer, entirely yours to take or leave: when the app is finished, and if you're happy for it to be public, I'd love to do a YouTube showcase of your journey. Nothing formal - just an honest account of a Laravel developer building on Trongate, which would be tremendously useful to anyone weighing up the same move.
I noticed your original post sat without a reply for a day or two. I'm very glad we got onto it and didn't let it slip through the net.
Welcome aboard!
DC
A developer with a working React front end deciding to move the backend onto Trongate is exactly the kind of thing we want to see succeed. If it also becomes a public SaaS, all the better.
Thanks also to sasin91, who was first to point out that no Inertia adapter exists, and that setting Trongate up as a JSON API is the sound route. That was the right call, and it gave this thread its direction.
Please do ask for help whenever you run into something. That's what these forums are for. There are lots of us here who would be happy to help.
One offer, entirely yours to take or leave: when the app is finished, and if you're happy for it to be public, I'd love to do a YouTube showcase of your journey. Nothing formal - just an honest account of a Laravel developer building on Trongate, which would be tremendously useful to anyone weighing up the same move.
I noticed your original post sat without a reply for a day or two. I'm very glad we got onto it and didn't let it slip through the net.
Welcome aboard!
DC