refactor(content): introduce typed ContentRepository abstraction#132
Merged
Conversation
Decouple composables from @nuxt/content so the content backend can be swapped for a headless CMS later without touching composables, pages or components. - Add provider-agnostic ContentRepository interface (utils/content/repository.ts) - Add NuxtContentAdapter encapsulating all queryCollection calls, collection-key naming and content-specific casts (utils/content/nuxtContentAdapter.ts) - Add useContentRepository() as the single backend swap point - Move FaqEntry into a dedicated domain type (types/faq.ts) - Route useBlogContent/useHomeContent/useFaqContent/useSponsoring/useTeamProfile through the repository; domain logic (i18n, release filtering, SEO/hreflang) stays in the composables Also removes a stale @nuxt/content module augmentation, fixing 4 pre-existing type errors. https://claude.ai/code/session_01JM95TEbXcXrQignrX6J7mm
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
launchpad | dfd3277 | Commit Preview URL Branch Preview URL |
May 16 2026, 10:47 AM |
…ction-layer-io8Pu # Conflicts: # composables/useBlogContent.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a provider-agnostic content access layer (
ContentRepository) to decouple the application from @nuxt/content implementation details. All content queries are now funnelled through a single adapter, making it straightforward to swap content backends in the future without touching composables or pages.Key Changes
ContentRepositoryinterface (utils/content/repository.ts) defining all content access contracts (blog articles, FAQ, team, home, sponsors)createNuxtContentAdapter()(utils/content/nuxtContentAdapter.ts) as the @nuxt/content-backed concrete implementation, encapsulating all collection-key naming and query syntaxuseContentRepository()composable that returns the active adapter instance — the single point where content backend decisions are madeContentRepositoryinstead of directqueryCollectioncalls:useBlogContent.ts: Replaced direct queries withrepo.listBlogArticles(),repo.getBlogArticleBySlug(),repo.getBlogArticleByTranslationKey(),repo.getAuthorBySlug()useHomeContent.ts: Simplified to userepo.getServerConcept(),repo.getServerConnect(),repo.getHomeCarousel()useFaqContent.ts: Now usesrepo.listFaqEntries()useTeamProfile.ts: Refactored to userepo.getTeamDocument()useSponsoring.ts: Updated to userepo.getSponsorsDocument()Localetype (utils/content/collections.ts) for type-safe locale handlingFaqEntrydomain type (types/faq.ts) to replace inline interfaceisLocaleObject), improved formatting, and simplified computed propertiesImplementation Details
blog_de, query syntax) are confined tonuxtContentAdapter.tsFaqEntrytype retainsPageCollectionItemBasecoupling at the rendering layer (for<ContentRenderer>), which a future CMS adapter would need to handlehttps://claude.ai/code/session_01JM95TEbXcXrQignrX6J7mm