Perfect is the enemy of good

Recently, I decided to rewrite my website from scratch. Naturally, I wanted to use the best technologies available. With no constraints holding me back, I decided to use them all!

Frontend Architecture

I built the frontend using React and TypeScript, which are incredible, by the way. For styling, I chose Emotion as my CSS-in-JS solution, integrating TailwindCSS via PostCSS plugins. This setup eliminates the need for unique class names and toggling between CSS and JS files. For components, I opted for Mantine, which offers a robust set of pre-built components. For state management, I selected Zustand due to its minimal boilerplate compared to Redux. React-Query manages my data fetching, providing caching and synchronization right out of the box. Next.js ties everything together as my React framework, offering server-side rendering, static site generation, and an exceptional developer experience.

Backend Infrastructure

On the backend, I use Prisma as my ORM to interact with the database. Deno serves as my runtime environment, selected for its built-in TypeScript support and robust security features. Docker and Docker Hub manage my containerization needs, making deployment consistent across environments. Kubernetes orchestrates my containers, while Istio provides advanced traffic management and security as a service mesh. Caddy Server manages incoming traffic, offering automated SSL and straightforward configuration. For data storage and messaging, I use PostgreSQL as my primary database and Kafka for implementing CQRS. ArgoCD manages my GitOps workflows and Ansible automates my infrastructure provisioning and configuration management. The application runs on EC2 instances, with Kubernetes auto-scaling to handle traffic spikes. Finally, Cloudflare protects everything, providing CDN capabilities, DDoS protection, and edge computing features.

But actually...

I used NONE of those technologies on my actual website, though I have used each of them to build production software. While I think these technologies are great, they are definitely overkill.

In reality, I reverted to using plain old PHP. Yes, just simple PHP files for each page, with include statements at the top. And oh my god, it's been a fantastic experience! I even added a view counter to each page and a comments section (with pre-moderation) just because it was super easy to implement. For the database, I used SQLite, which further simplifies everything. The most challenging part was implementing code highlighting, for which I used Phiki—a project I highly recommend.

The same principle can be applied at work, too! I probably won't do the same thing at work, but it's always good to remember that "perfect is the enemy of good." Choose dependencies wisely, vendor them if needed, use strongly-typed languages and tools, write unit tests. And, yes, remember Einstein's formula for success: A = X + Y + Z.

27
4216

Comments

keb
2025-02-04 04:21:58
Great site!
Avatar
antonmedv
Thanks! =)
chell
2025-02-04 01:09:44
php really is quite nice! last year i rewrote my own site to use a custom SSG setup based more or less entirely on PHP and (gnu) Make it's extremely janky but the end result is excellent and it's shockingly maintainable. PHP is passable as a programming language and EXCELLENT as a templating one still need to update to 8.4 though...
anonymous
2025-02-03 16:47:21
Wow! Your website is beautiful. Would you be willing to share the source code?
Avatar
antonmedv
Well. By openning this page you are already downloaded 80% of my source code. The remaining 20% is just a few PHP files to handle comments and view counts.