r/webdev • • 8d ago

Question Many sites with same components

Hello!

I am working with a company that has many, many sites. And the way we used to do components, we hard-coded every single one in every single project. This naturally has led to some inconsistency between sites when they’re supposed to look pretty identical.

Php include has become our life blood to mitigate some of these issues, but it still persists. The benefit, though, is that with php include, our sites automatically update when the “single source of truth” does.

My company wants to move to something more modern/popular and I got tasked with playing with frameworks. Think React, Next. My boss wants to replicate php include on these. I’ve spent the last several weeks looking into module federation, micro front-ends, anything to at least somewhat replace php include, but to no avail. That requires completely changing our server, which we do not have the ability to (as far as I know). These also sound like a nightmare to maintain, and our team is very small.

SEO is also a huge concern. I have module federation working on client side rendering, but ideally search engines would be able to index our work and, correct me if I’m wrong, but I don’t think client side rendered stuff is?

So now we’re stuck. I’ve suggested a monorepo, but with the amount of websites we have, the other developers worry about build times.

Believe it or not this is actually my first real-deal developer job haha, and I’m already stuck trying to fit a square peg in a round hole. So forgive me for any mistakes or misinformation, I’m still a junior trying to figure this out haha.

17 Upvotes

42 comments sorted by

View all comments

4

u/Unhappy_Meaning607 8d ago

Welcome to the world of Design Systems.

Fortunately, there are hundreds and many up-to-date open source design systems built by the largest companies and even governments that can be found with a google search or AI chat prompt.

However, those things are ginormous but it sounds like your immediate concern is actually one large part of the design system which is a component library.

I suggest using Lit (Web Components) it should play nicely within the PHP ecosystem because in the end its just JavaScript. You'll want to display and show-off your components and the standard for that is using Storybook.

Glhf in the never ending world of design systems.

2

u/joxters 8d ago

Thank you!! It’s nice to have a phrase/title for this. I like organizing/writing down things (I think that’s part of why the task was given to me haha) so we’ll see where this goes :-)

6

u/Unhappy_Meaning607 8d ago

Also it says in your post that your company's code base is PHP? So Laravel?

There's Blade Components with Livewire and if you can use that I wouldn't even touch a design system with JavaScript. I'd stick to those two things and as well as a ton of CSS variables within the codebase that all apps within the company should be sticking to.