How Can I Improve Frontend Structure in Our Internal CodeIgniter 4 App?

0
22
Asked By CuriousCoder42 On

I'm an intermediate PHP and JS programmer working on an internal CodeIgniter 4 application for my company, designed to simplify project management. Our team is more backend-focused and our project manager insists on writing all JavaScript in a single file, which I worry will lead to problems down the line. We've considered using an SPA framework like React or VueJS, but my manager thinks that would complicate things too much for our mid-sized project. I've been exploring htmx and building extensions for it, which has some team support, but I've run into issues with AlpineJS not working well with htmx. I found that Hyperscript could complicate things further. Now, I'm leaning towards using Vanilla JS for a custom htmx extension to tackle our complex forms, but I'm seeking resources or guidance to help me along the way. Any tips or books would be greatly appreciated!

4 Answers

Answered By ModularManiac On

From my experience, using vanilla JS and keeping things modular is key. Break your code into modules and consider using a tool like webpack to build your project, separating out common functions. One large JS file is definitely not the way to go! If it’s just for internal use, incorporating Bootstrap can also help manage styling easily.

Answered By TechSavvyGal On

You’re definitely on the right path with htmx! It’s a great fit for an internal app since you don’t need the overhead of a full SPA. I suggest breaking your JavaScript into smaller, modular files instead of one massive file. Also, the htmx documentation along with the book 'Hypermedia Systems' and some GitHub examples can be super helpful to get you started!

CuriousCoder42 -

Thanks for the resources! I'll check them out.

Answered By FrontEndFanatic On

Have you considered using Stimulus.js? It works great with server-rendered applications like yours and integrates well with htmx. It's a solid option for organizing your vanilla JS without going full SPA. Plus, it keeps things clean—much better than piling everything into one big file!

Answered By ViteAdventurer On

If your team is used to CodeIgniter's MVC structure, throwing in React or Vue could be tough. Consider using ES6 imports for modularizing your code—this way, you can keep your JS organized without needing extra tools. You can even use Vite with CodeIgniter for a smoother setup. Just remember, a single file for your JS is a recipe for disaster; modularizing is the way to go!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.