All about the Environmental Protection Service site
This is a work in progress and general brain-dump of everything about the site. It will eventually get sorted into a more logical collection of posts.
Architecture Overview
The BIG overview
- Backend is WordPress Theme (hybrid) + ACF + Gutenberg
- Plugin handles data fetching from USGS for Water Dashboard
- Custom Rest Routes are created for frontend
- Frontend is Astro in ‘server’ mode
- Most page routes opt in to
prerender = true
- Most page routes opt in to
The Code Overview
- Monorepo stores all the code in one place
/sharedfor shared configs- /backend for all WordPress-y things
- /frontend for astro
The Deploys
Generally, the deploys work the same as other repos, but there’s an extra build/deploy that’s handled entirely by the WP Engine headless system. It needs to be aware of any secrets (stored in a .env file) for it to work properly (handled via WP Engine Headless dashboard).
Astro & WP Endpoints
Since Astro and WordPress handle routing from opposite directions, it is generally easier to just create a custom endpoint to get the data to the frontend. Here’s a list of endpoints and what they return (in a less-formal structure than JSON Schema).
namespace: cno/v1
Endpoints:
- /content
- /content/pages
- Returns all pages (used for
getStaticPaths)
- Returns all pages (used for
- /content/pages/<id>
- Returns the block markup of a specific page (so Astro can build the html properly)
- /content/pages
- /dashboard ⚠️
- currently returns water dashboard data, but probably needs to be updated to
v2/dashboards/waterto prep for things likev2/dashboards/air-quality
- currently returns water dashboard data, but probably needs to be updated to
- /nav-menus/<location>
- Returns nav menu items by location