My open-source goals

Some times I do things with the best of intentions, other times I’m a dastardly manifestation of connivance … and I’m ok with that. I think the important part is that I reflect on those times and laugh about it. “What are you talking about?” may be a thought that comes to your mind. I’ll tell you. I want to my cake, and I’m going to eat it too.

A thing I often thinking about is what it is that makes it so great to be a software engineer who works in the languages that I do. PHP, Javascript … the real bad guys out there. They’re truly comrades in the party of outlaws that roam the wildwest of the web. But they’re free, in the sense that they cost nothing to learn and use, and they have no limits in regards to what you can use them for.

I guess they’re only free if you don’t value your time though – So you need to pick and choose when you want to expand your mind with new technologies and methodologies. But I digress!

My decision amounts nI needed to upskill in a multitude of areas as I prepare to move forward in my career after 7+ years on a single core product with a (mostly) same stack through that time. I decided to address a problem that I have and have seen a few times now. Laravel has no schema. It’s been almost 8 years since I looked at a Symfony 1.x product, but I really do still miss that schema.yml – and without knowing it, so do the people who aquired the product that I had developed rapidly in that time. My brain is more or less the schema documentation. The alpha and omega of what is going on both historically and presently, as well as the subtle thoughts of intention for the future – for a large part of that business.

This feels really bad. Not in a way that keeps me up at night, but in a way that I want to do my job better. Unfortunately writing a data dictionary for a monolithic application with a bunch of now redundant features and an application layer that is verbosely appropriate for the legal domain is impossible to greenlight a budget for, and honestly, even more difficult to access (from this self-proclaimed alpha-omega schema brain) the edge case defintions of fields for. There’s also 2-3 years of other developers working on it where I no longer know everything about this data model.

So there really doesn’t appear to be an off-the-shelf solution for this challenge readily available, the foreign keys are helpful but not always complete, or polymorphic relations are a bit ambiguous. Building out Laravel Nova resources could potentially reveal a few things to an advanced user, but that’s still a hard sell to the rest of the business given how much time that would take.

But I had noticed that I do have an application layer that describes how the database records actually work together through it’s models and these models have a few defined query scopes and the attributes of each record are ready to detail. So let’s leverage this.

I set out to write a class that could search by namespace each of the models in my project and create an index of their important properties. Writing this class using TDD actually proved quite difficult given that I needed to plug this into existing projects. I ended up creating a “Sample models” directory to mock an existing project and using that for writing tests.

After I had established this index generating class, I wanted a way I could just drop this into a project, or write other packages that extended this. I decided to make a Service Provider for Laravel. Along with some additional polish for custom meta that can be added inline with the models using PHP8 attributes, this became:

https://www.github.com/SmurfWorks/Model-Finder

From here I thought about this indexing tool and what I could use it for. It wasn’t open source or published yet – but I had ideas about how I could solve querying data using joins or sub-queries using the discovered relations and offering those as the only selectable relation options in a form.

At this point in time I needed to learn more about laravel packaging, how serve multiple different aspects of a package in a configurable and extendable way and most importantly, needed to take new Tailwind and Vue versions, along with the shiny new build tool – Vite.

I proceeded forward with building the interface and overcoming all of the aforementioned challenges. This resulted in the following interface. I managed to build a JSON query schema to pass to the backend and parse it as an eloquent query. Everything is going well.

Once I had this interface delivering me the requested data and was meeting the majority of my project objectives – It’s free, plug-and-play and extremely configurable and extensible – I decided it’s time to deliver. This had lived as local package in one of my projects for the last couple of weeks. It’s not perfect, or done, but I had a reason to publish it along with the model finder. Today the model finder is tagged as v1.0.0 and the project above is not yet tagged, but the first commit has been made.

https://www.github.com/SmurfWorks/Sieve

So why am I talking about this like an NZ herald article not-so-secretly calling advertisements journalism? It’s because during this recent upskilling experience I also slipped out the private development arc of my story and into open source software arc. It was a concious decision to release these two packages as open source, but has me thinking about how far I can take this simple utility now that it’s structured the way I like open source packages. Can I make something useful? Something worth paying for? Or do I just keep going with my little experiment.

I’d like to offer an application-layer generated ERD, or ERD approach to browsing a single record and it’s related data. But I’d also like to charge for these (what I believe to be) extremely valuable features. I’ve been reading up on d3.js and I’m going to have a go at making this thing.

But I really do have to stop and reassure myself about what’s fair in the OSS world. I see frameworks like Laravel being used for free to build million-dollar businesses, and then they offer a paid admin package – because why shouldn’t they get paid for useful things, that you have the power to build yourself or could drop a couple of hundred dollars on. But also, how much utility can I just give the world with my free time. Isn’t that a journey worth exploring? After all if no one buys my software, I can just open source it later and see. Which way do I go?

Trying to break the habit of working for money is a tricky one, especially when you get taken on a journey that seems to lead you back into making money. My open source goals are to walk this line and not pretend like I’m writing this software for the betterment of the community, but rather to see what makes sense when solving problems – whether they’re my own or other peoples. I need to remind myself that there is no definite end with a journey like this and I’m making it up as I go.

Let’s see how this ages.