Description
Scaffold the base folder structure for the web project according to the agreed architecture. No components, no layout, no placeholder UI.
Folders to create
components/ - reusable UI components
components/ui/ - shadcn components only
app/api/ - Next.js route handlers
lib/ - third party configs and utility functions
hooks/ - custom React hooks
types/ - shared TypeScript types (API responses, common types)
services/ - reusable backend caller methods as classes, using fetch (no axios)
services/actions/ - Next.js server actions
Architecture rules (add as a comment or README in each folder)
- Never use axios, use native fetch for edge compatibility
- Services must be classes
- Server actions go under
services/actions/
- shadcn components go under
components/ui/ only
- Custom hooks go under
hooks/, never inline in components
- Types shared across features go under
types/
- Always consider SEO, use
generateMetadata where relevant
Caching strategy (decision required)
Next.js 16 introduced cacheComponents in next.config.ts. When enabled, all data fetching is dynamic by default unless explicitly cached with the use cache directive at the page, component, or function level. This replaces the old model where fetches were cached by default.
The team must decide before writing any data fetching code:
Option A: enable cacheComponents: true
- Data fetching is dynamic by default (always fresh)
- Use
use cache explicitly on components or functions that should be cached
- Pairs with
cacheLife and cacheTag for fine-grained control
- Recommended for apps with user-specific or frequently changing data
// next.config.ts
const nextConfig: NextConfig = {
cacheComponents: true,
}
// cache a specific server component or function
'use cache'
export async function getVideos() { ... }
Option B: do not enable cacheComponents
- Stick with the previous Next.js caching model
- fetch requests are cached by default, opt out with
cache: 'no-store'
- Less explicit but more familiar
Given that this platform serves personalized, user-specific content (child profiles, playlists, access policies), Option A is recommended. But the decision must be agreed on by the team before any data fetching is written.
Reference: https://nextjs.org/docs/app/api-reference/config/next-config-js/cacheComponents
Acceptance Criteria
Description
Scaffold the base folder structure for the web project according to the agreed architecture. No components, no layout, no placeholder UI.
Folders to create
components/- reusable UI componentscomponents/ui/- shadcn components onlyapp/api/- Next.js route handlerslib/- third party configs and utility functionshooks/- custom React hookstypes/- shared TypeScript types (API responses, common types)services/- reusable backend caller methods as classes, using fetch (no axios)services/actions/- Next.js server actionsArchitecture rules (add as a comment or README in each folder)
services/actions/components/ui/onlyhooks/, never inline in componentstypes/generateMetadatawhere relevantCaching strategy (decision required)
Next.js 16 introduced
cacheComponentsinnext.config.ts. When enabled, all data fetching is dynamic by default unless explicitly cached with theuse cachedirective at the page, component, or function level. This replaces the old model where fetches were cached by default.The team must decide before writing any data fetching code:
Option A: enable
cacheComponents: trueuse cacheexplicitly on components or functions that should be cachedcacheLifeandcacheTagfor fine-grained controlOption B: do not enable
cacheComponentscache: 'no-store'Given that this platform serves personalized, user-specific content (child profiles, playlists, access policies), Option A is recommended. But the decision must be agreed on by the team before any data fetching is written.
Reference: https://nextjs.org/docs/app/api-reference/config/next-config-js/cacheComponents
Acceptance Criteria
.gitkeepor a short explanatory comment filenext.config.tsreflects the agreed caching strategy