Here’s a project opportunity for a fun, easy open source school project. It’s a dynamic e-commerce store platform built 15 years ago that KILLS Google’s PageSpeed test, but needs some modernization.
I built this in 2002, entirely from scratch. Until 2016, it enabled a retired bicycle shop owner with little computer expertise to run a pretty active online store featuring vintage bicycle gear.
The code was also adapted for a few other clients through the years, although that work has been lost.
Over the years, the code was ported from BSD Unix to Linux, and from PHP3 to PHP5. It is now overdue for another facelift, from function-based PHP5 to object-based PHP7, and to responsive display code.
Meanwhile, the site’s homepage and product pages have the distinction of earning a perfect 100 on Google’s PageSpeed ranking. The category pages rate 99!!
This feat is a little astonishing when you consider what this site is NOT doing:
- No page or code caching of any kind
- No minified code
- No page compression
- PHP5, without speed enhancements of PHP7
- No high-end hosting… it’s just DigitalOcean
What’s the secret?
- Carefully optimized SQL queries that hit the database only once or twice per page load
- One .css file per page
- Loading .js files only on pages where needed.
- Dead-simple DOM. Only ~300 nodes!
The administrator backend is pretty fast, too.
The site is fast because it had to be: afterall, it was originally built and hosted on a $10/month BSD virtual private server account with something like a 400MHz CPU and 64MB of RAM.
As noted, if any readers have time and interest in hacking on this, let me know, and I’ll set it up a github and release the ancient, no-doubt horribly amateurish code under the GPL2. It uses MySQL, PHP, HTML 4, CSS, and a smidge of Javascript. Also, it uses a couple of custom-compiled C binaries, gcal and phoon, to produce the moonrise and moonset calendar — which also rates 100 on PageSpeed!