Starting a Laravel + React project
Introduction
I am working on a startup (if I can be so bold as to call it that) that needs a webapp and my knowledge in baseball and pitching development. But when starting out, I was confronted with a pretty large question: "What stack am I going to commit this first attempt at entrepreneurship to?" I wrote this blog in Next.js, not because a blog should be written in Next.js but because I wanted to learn the basics of frameworks that are used to build larger software on the web. So before I can get into my current project, let's discuss some of the things that lead me to not attempt Next.js a second time.
Next.js Backstory
I want to be clear, I do not have much experience in Next.js. I mean so little that all the things that I say here could be objectively wrong but were just my initial observations of the system.
With that out of the way, I had a hard time liking Next.js. I started with JS and not TS because I am new-ish to javascript and did not want to also have to learn typescript superset notations to get things to work. I also felt like the backend that Next offers is just not something that I enjoyed. I was having to JSON encode and decode and stringify and all the other things to data from the same language that it just didn't make sense to me. I understand that when I write some kind of abstraction in PHP(Laravel) that it will be tough to effectively get that data to React but actually it's been 10x easier than using JS on both the frontend and backend. I think that is a testament to Inertia but I haven't really dug into the weeds of it yet.
I also did not like the fact that I was basically tied to Vercel at the hip. I liked (mostly) working with Vercel and it's clear they made things as seamless as they could but I still had countless broken builds and for a blog that has like 3 main pages and some dynamic content from the DB on one page, it just didn't make sense that my builds were over a minute every time I had a typo and needed to push some changes. And I don't know who made this decision or if this is just how the internet works and I'm too stupid to know this yet but the fact that any time my api requests or some function expects JSON and an error occurred and I got HTML back (generally rendering a page explaining the error in DEV) frustrated me to no end. I can't see the logs that deep in Vercel's deploy logs file so I can't copy and paste the HTML into the browser and try to see what's going on. It just made debugging some of these issues harder when my 1.5 minute builds keep failing.
I know these are not big issues and, honestly, are all categorized as 'skill issues', but I did not want that same experience with my first attempt at making money on the internet.
Laravel + React
PHP runs the internet... Or at least that's what I have been told. If it was good enough to make most of the internet and I don't have to be bound to vercel when deciding how to host my application, I should be willing to try it out.
So I did, and it was pretty great from the start. Disclaimer: I didn't just jump in and start LLM prompting my way to a website (although I do use LLM's to help me figure out bugs or ask how I am supposed to do a certain thing with the medium of the internet that I have never worked in). Instead, I read pretty much all of the Laravel documentation on their website. I couldn't get through all of it because it's just so dense and has so much content that I was forgetting the basics discussed at the beginning by the time I got to the ORM and database connections section. Once I got programming, I realized that I actually kind of like PHP. I have some serious issues with not being able to find a code formatter or an LSP that will put '{'s on the correct line but that's just me being particular. PHP is a pretty simple scripting language that makes sense and I don't really mind all the '$'s everywhere. I was able to separate my frontend and backend into silos that just made sense and I knew when it was going from one to the other without having to figure out the project file structure or whatever else dictates that in Next.js.
Issues So Far
My experience with PHP/Laravel + Inertia + React has not been all pretty though. I have had major gripes about the Eloquent ORM. I see how writing your own SQL could sometimes not be the most fun but I quite enjoy SQL and I don't think anything in this project would get into the realm of 'so complex that I just want someone to do it for me'.
But maybe the reason I am not having issues with JSON encoding/decoding or stringifying stuff is because of the ORM. I will try to complete some small rewrite of this project without an ORM later on and see if I'm right about that.
Conclusion
I am having a generally pleasant time using Laravel so far, all issues fall into the 'I'm not familiar with this stuff yet' or 'ORMs are dumb and I don't like them' categories. One day I might have large differences in opinions with these but currently, I am having a blast. I can't wait to get this project up and running (might have to wait for a certain time of the year so it could be a while) and see if I can finally become a 'solopreneur' like all the cool kids talk about on Twitter.
I will probably do some updates on what may end up being a series after I get more familiar with the languages/frameworks. I hope by the end of it my opinion turns into 'I now understand why the ORM exists and all the other issues I was having and I now think everything is great!' Wouldn't that be nice?