This is taken from two Tweets/Posts I made. Should raise some awareness in you for your code:
Many I’ve seen in SEO are building clumsy apps
One big app, one big mess
No wonder it’s full of bugs and hard to maintain
Build modules instead
One small module for each task
As small as possible
Connect them through APIs
Easy to maintain, easy to change, easy to scale
That’s how pros program
Example?
One module scrapes Google
One module parses the scraped result
Add more modules if you like
A scraper for related images
A generator for PAA pages
A scraper for related Amazon products
You get the idea
Keep it separate
The code parsing the Google result doesn’t need to know how it got scraped
The generator doesn’t need to know about the result’s HTML
It’s only interested in the data
And the Amazon module doesn’t need to know neither
It only needs to return a nice object based on a passed search
The result’s HTML changes?
No need to touch the code that does the scraping
Only code in the parsing module gets touched
Easy to test, since it’s isolated
Less likely to add complicated code
Less likely to add hard to find bugs
Simple, short, easy to understand code
👑