NotionNext main flow can be simplified as:
- Data access layer (
lib/db/)
Fetches Notion data, normalizes structure, maps fields, handles cache and dedup. - Server data assembly (
lib/db/SiteDataApi.js)
ProducesallPages,tagOptions,categoryOptions,siteInfo, etc. - Routing layer (
pages/)
Handles route-level filtering, pagination, and render preparation. - Theme layer (
themes/)
Themes consume the same props contract and render different UI.
Priority (high -> low):
- Notion Config page key
- Environment variable
- Local config (
blog.config.js+conf/*.config.js)
If a sorting/filtering rule is global business logic, place it in data layer instead of duplicating it in route files.
Benefits:
- Smaller change surface
- Lower risk of missing routes
- Consistent behavior across themes
- Cache modules:
lib/cache/ - Build prefetch/concurrency:
lib/build/ - Changes here can impact CI speed and deployment stability; include validation notes.