create-apppaaaul 2.0.44 → 2.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/api-design-principles/SKILL.md +528 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/better-auth-best-practices/SKILL.md +166 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/brainstorming/SKILL.md +96 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/changelog-generator/SKILL.md +104 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/error-handling-patterns/SKILL.md +641 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/interface-design/SKILL.md +391 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/interface-design/references/critique.md +67 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/interface-design/references/example.md +86 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/interface-design/references/principles.md +235 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/interface-design/references/validation.md +48 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/SKILL.md +153 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/async-patterns.md +87 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/bundling.md +180 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/data-patterns.md +297 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/debug-tricks.md +105 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/directives.md +73 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/error-handling.md +227 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/file-conventions.md +140 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/font.md +245 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/functions.md +108 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/hydration-error.md +91 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/image.md +173 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/metadata.md +301 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/parallel-routes.md +287 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/route-handlers.md +146 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/rsc-boundaries.md +159 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/runtime-selection.md +39 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/scripts.md +141 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/self-hosting.md +371 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/next-best-practices/suspense-boundaries.md +67 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/postgresql-table-design/SKILL.md +202 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/prompt-engineering-patterns/SKILL.md +480 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/prompt-engineering-patterns/assets/few-shot-examples.json +106 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/prompt-engineering-patterns/assets/prompt-template-library.md +264 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/prompt-engineering-patterns/references/chain-of-thought.md +412 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/prompt-engineering-patterns/references/few-shot-learning.md +386 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/prompt-engineering-patterns/references/prompt-optimization.md +428 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/prompt-engineering-patterns/references/prompt-templates.md +484 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/prompt-engineering-patterns/references/system-prompts.md +195 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/prompt-engineering-patterns/scripts/optimize-prompt.py +279 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/seo-audit/SKILL.md +410 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/seo-audit/references/aeo-geo-patterns.md +285 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/seo-audit/references/ai-writing-detection.md +200 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/AGENTS.md +2934 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/SKILL.md +136 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/dist/templates/nextjs-ts-clean/project/.agents/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/dist/templates/nextjs-ts-clean/project/eslint.config.mjs +6 -8
- package/dist/templates/nextjs-ts-clean/project/package.json +1 -1
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/api-design-principles/SKILL.md +528 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/better-auth-best-practices/SKILL.md +166 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/brainstorming/SKILL.md +96 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/changelog-generator/SKILL.md +104 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/error-handling-patterns/SKILL.md +641 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/interface-design/SKILL.md +391 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/interface-design/references/critique.md +67 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/interface-design/references/example.md +86 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/interface-design/references/principles.md +235 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/interface-design/references/validation.md +48 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/SKILL.md +153 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/async-patterns.md +87 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/bundling.md +180 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/data-patterns.md +297 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/debug-tricks.md +105 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/directives.md +73 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/error-handling.md +227 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/file-conventions.md +140 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/font.md +245 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/functions.md +108 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/hydration-error.md +91 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/image.md +173 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/metadata.md +301 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/parallel-routes.md +287 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/route-handlers.md +146 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/rsc-boundaries.md +159 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/runtime-selection.md +39 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/scripts.md +141 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/self-hosting.md +371 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/next-best-practices/suspense-boundaries.md +67 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/postgresql-table-design/SKILL.md +202 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/prompt-engineering-patterns/SKILL.md +480 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/prompt-engineering-patterns/assets/few-shot-examples.json +106 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/prompt-engineering-patterns/assets/prompt-template-library.md +264 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/prompt-engineering-patterns/references/chain-of-thought.md +412 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/prompt-engineering-patterns/references/few-shot-learning.md +386 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/prompt-engineering-patterns/references/prompt-optimization.md +428 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/prompt-engineering-patterns/references/prompt-templates.md +484 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/prompt-engineering-patterns/references/system-prompts.md +195 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/prompt-engineering-patterns/scripts/optimize-prompt.py +279 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/seo-audit/SKILL.md +410 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/seo-audit/references/aeo-geo-patterns.md +285 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/seo-audit/references/ai-writing-detection.md +200 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/AGENTS.md +2934 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/SKILL.md +136 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/.agents/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/dist/templates/nextjs-ts-landing-prisma/project/eslint.config.mjs +6 -8
- package/dist/templates/nextjs-ts-landing-prisma/project/package.json +2 -2
- package/dist/templates/nextjs-ts-landing-prisma/project/pnpm-lock.yaml +6 -18
- package/package.json +1 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Use after() for Non-Blocking Operations
|
|
3
|
+
impact: MEDIUM
|
|
4
|
+
impactDescription: faster response times
|
|
5
|
+
tags: server, async, logging, analytics, side-effects
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Use after() for Non-Blocking Operations
|
|
9
|
+
|
|
10
|
+
Use Next.js's `after()` to schedule work that should execute after a response is sent. This prevents logging, analytics, and other side effects from blocking the response.
|
|
11
|
+
|
|
12
|
+
**Incorrect (blocks response):**
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { logUserAction } from '@/app/utils'
|
|
16
|
+
|
|
17
|
+
export async function POST(request: Request) {
|
|
18
|
+
// Perform mutation
|
|
19
|
+
await updateDatabase(request)
|
|
20
|
+
|
|
21
|
+
// Logging blocks the response
|
|
22
|
+
const userAgent = request.headers.get('user-agent') || 'unknown'
|
|
23
|
+
await logUserAction({ userAgent })
|
|
24
|
+
|
|
25
|
+
return new Response(JSON.stringify({ status: 'success' }), {
|
|
26
|
+
status: 200,
|
|
27
|
+
headers: { 'Content-Type': 'application/json' }
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Correct (non-blocking):**
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { after } from 'next/server'
|
|
36
|
+
import { headers, cookies } from 'next/headers'
|
|
37
|
+
import { logUserAction } from '@/app/utils'
|
|
38
|
+
|
|
39
|
+
export async function POST(request: Request) {
|
|
40
|
+
// Perform mutation
|
|
41
|
+
await updateDatabase(request)
|
|
42
|
+
|
|
43
|
+
// Log after response is sent
|
|
44
|
+
after(async () => {
|
|
45
|
+
const userAgent = (await headers()).get('user-agent') || 'unknown'
|
|
46
|
+
const sessionCookie = (await cookies()).get('session-id')?.value || 'anonymous'
|
|
47
|
+
|
|
48
|
+
logUserAction({ sessionCookie, userAgent })
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
return new Response(JSON.stringify({ status: 'success' }), {
|
|
52
|
+
status: 200,
|
|
53
|
+
headers: { 'Content-Type': 'application/json' }
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The response is sent immediately while logging happens in the background.
|
|
59
|
+
|
|
60
|
+
**Common use cases:**
|
|
61
|
+
|
|
62
|
+
- Analytics tracking
|
|
63
|
+
- Audit logging
|
|
64
|
+
- Sending notifications
|
|
65
|
+
- Cache invalidation
|
|
66
|
+
- Cleanup tasks
|
|
67
|
+
|
|
68
|
+
**Important notes:**
|
|
69
|
+
|
|
70
|
+
- `after()` runs even if the response fails or redirects
|
|
71
|
+
- Works in Server Actions, Route Handlers, and Server Components
|
|
72
|
+
|
|
73
|
+
Reference: [https://nextjs.org/docs/app/api-reference/functions/after](https://nextjs.org/docs/app/api-reference/functions/after)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Authenticate Server Actions Like API Routes
|
|
3
|
+
impact: CRITICAL
|
|
4
|
+
impactDescription: prevents unauthorized access to server mutations
|
|
5
|
+
tags: server, server-actions, authentication, security, authorization
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Authenticate Server Actions Like API Routes
|
|
9
|
+
|
|
10
|
+
**Impact: CRITICAL (prevents unauthorized access to server mutations)**
|
|
11
|
+
|
|
12
|
+
Server Actions (functions with `"use server"`) are exposed as public endpoints, just like API routes. Always verify authentication and authorization **inside** each Server Action—do not rely solely on middleware, layout guards, or page-level checks, as Server Actions can be invoked directly.
|
|
13
|
+
|
|
14
|
+
Next.js documentation explicitly states: "Treat Server Actions with the same security considerations as public-facing API endpoints, and verify if the user is allowed to perform a mutation."
|
|
15
|
+
|
|
16
|
+
**Incorrect (no authentication check):**
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
'use server'
|
|
20
|
+
|
|
21
|
+
export async function deleteUser(userId: string) {
|
|
22
|
+
// Anyone can call this! No auth check
|
|
23
|
+
await db.user.delete({ where: { id: userId } })
|
|
24
|
+
return { success: true }
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Correct (authentication inside the action):**
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
'use server'
|
|
32
|
+
|
|
33
|
+
import { verifySession } from '@/lib/auth'
|
|
34
|
+
import { unauthorized } from '@/lib/errors'
|
|
35
|
+
|
|
36
|
+
export async function deleteUser(userId: string) {
|
|
37
|
+
// Always check auth inside the action
|
|
38
|
+
const session = await verifySession()
|
|
39
|
+
|
|
40
|
+
if (!session) {
|
|
41
|
+
throw unauthorized('Must be logged in')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Check authorization too
|
|
45
|
+
if (session.user.role !== 'admin' && session.user.id !== userId) {
|
|
46
|
+
throw unauthorized('Cannot delete other users')
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
await db.user.delete({ where: { id: userId } })
|
|
50
|
+
return { success: true }
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**With input validation:**
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
'use server'
|
|
58
|
+
|
|
59
|
+
import { verifySession } from '@/lib/auth'
|
|
60
|
+
import { z } from 'zod'
|
|
61
|
+
|
|
62
|
+
const updateProfileSchema = z.object({
|
|
63
|
+
userId: z.string().uuid(),
|
|
64
|
+
name: z.string().min(1).max(100),
|
|
65
|
+
email: z.string().email()
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
export async function updateProfile(data: unknown) {
|
|
69
|
+
// Validate input first
|
|
70
|
+
const validated = updateProfileSchema.parse(data)
|
|
71
|
+
|
|
72
|
+
// Then authenticate
|
|
73
|
+
const session = await verifySession()
|
|
74
|
+
if (!session) {
|
|
75
|
+
throw new Error('Unauthorized')
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Then authorize
|
|
79
|
+
if (session.user.id !== validated.userId) {
|
|
80
|
+
throw new Error('Can only update own profile')
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Finally perform the mutation
|
|
84
|
+
await db.user.update({
|
|
85
|
+
where: { id: validated.userId },
|
|
86
|
+
data: {
|
|
87
|
+
name: validated.name,
|
|
88
|
+
email: validated.email
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
return { success: true }
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Reference: [https://nextjs.org/docs/app/guides/authentication](https://nextjs.org/docs/app/guides/authentication)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Cross-Request LRU Caching
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: caches across requests
|
|
5
|
+
tags: server, cache, lru, cross-request
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Cross-Request LRU Caching
|
|
9
|
+
|
|
10
|
+
`React.cache()` only works within one request. For data shared across sequential requests (user clicks button A then button B), use an LRU cache.
|
|
11
|
+
|
|
12
|
+
**Implementation:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { LRUCache } from 'lru-cache'
|
|
16
|
+
|
|
17
|
+
const cache = new LRUCache<string, any>({
|
|
18
|
+
max: 1000,
|
|
19
|
+
ttl: 5 * 60 * 1000 // 5 minutes
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export async function getUser(id: string) {
|
|
23
|
+
const cached = cache.get(id)
|
|
24
|
+
if (cached) return cached
|
|
25
|
+
|
|
26
|
+
const user = await db.user.findUnique({ where: { id } })
|
|
27
|
+
cache.set(id, user)
|
|
28
|
+
return user
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Request 1: DB query, result cached
|
|
32
|
+
// Request 2: cache hit, no DB query
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Use when sequential user actions hit multiple endpoints needing the same data within seconds.
|
|
36
|
+
|
|
37
|
+
**With Vercel's [Fluid Compute](https://vercel.com/docs/fluid-compute):** LRU caching is especially effective because multiple concurrent requests can share the same function instance and cache. This means the cache persists across requests without needing external storage like Redis.
|
|
38
|
+
|
|
39
|
+
**In traditional serverless:** Each invocation runs in isolation, so consider Redis for cross-process caching.
|
|
40
|
+
|
|
41
|
+
Reference: [https://github.com/isaacs/node-lru-cache](https://github.com/isaacs/node-lru-cache)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Per-Request Deduplication with React.cache()
|
|
3
|
+
impact: MEDIUM
|
|
4
|
+
impactDescription: deduplicates within request
|
|
5
|
+
tags: server, cache, react-cache, deduplication
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Per-Request Deduplication with React.cache()
|
|
9
|
+
|
|
10
|
+
Use `React.cache()` for server-side request deduplication. Authentication and database queries benefit most.
|
|
11
|
+
|
|
12
|
+
**Usage:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { cache } from 'react'
|
|
16
|
+
|
|
17
|
+
export const getCurrentUser = cache(async () => {
|
|
18
|
+
const session = await auth()
|
|
19
|
+
if (!session?.user?.id) return null
|
|
20
|
+
return await db.user.findUnique({
|
|
21
|
+
where: { id: session.user.id }
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Within a single request, multiple calls to `getCurrentUser()` execute the query only once.
|
|
27
|
+
|
|
28
|
+
**Avoid inline objects as arguments:**
|
|
29
|
+
|
|
30
|
+
`React.cache()` uses shallow equality (`Object.is`) to determine cache hits. Inline objects create new references each call, preventing cache hits.
|
|
31
|
+
|
|
32
|
+
**Incorrect (always cache miss):**
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
const getUser = cache(async (params: { uid: number }) => {
|
|
36
|
+
return await db.user.findUnique({ where: { id: params.uid } })
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// Each call creates new object, never hits cache
|
|
40
|
+
getUser({ uid: 1 })
|
|
41
|
+
getUser({ uid: 1 }) // Cache miss, runs query again
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Correct (cache hit):**
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
const getUser = cache(async (uid: number) => {
|
|
48
|
+
return await db.user.findUnique({ where: { id: uid } })
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
// Primitive args use value equality
|
|
52
|
+
getUser(1)
|
|
53
|
+
getUser(1) // Cache hit, returns cached result
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If you must pass objects, pass the same reference:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
const params = { uid: 1 }
|
|
60
|
+
getUser(params) // Query runs
|
|
61
|
+
getUser(params) // Cache hit (same reference)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Next.js-Specific Note:**
|
|
65
|
+
|
|
66
|
+
In Next.js, the `fetch` API is automatically extended with request memoization. Requests with the same URL and options are automatically deduplicated within a single request, so you don't need `React.cache()` for `fetch` calls. However, `React.cache()` is still essential for other async tasks:
|
|
67
|
+
|
|
68
|
+
- Database queries (Prisma, Drizzle, etc.)
|
|
69
|
+
- Heavy computations
|
|
70
|
+
- Authentication checks
|
|
71
|
+
- File system operations
|
|
72
|
+
- Any non-fetch async work
|
|
73
|
+
|
|
74
|
+
Use `React.cache()` to deduplicate these operations across your component tree.
|
|
75
|
+
|
|
76
|
+
Reference: [React.cache documentation](https://react.dev/reference/react/cache)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Avoid Duplicate Serialization in RSC Props
|
|
3
|
+
impact: LOW
|
|
4
|
+
impactDescription: reduces network payload by avoiding duplicate serialization
|
|
5
|
+
tags: server, rsc, serialization, props, client-components
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Avoid Duplicate Serialization in RSC Props
|
|
9
|
+
|
|
10
|
+
**Impact: LOW (reduces network payload by avoiding duplicate serialization)**
|
|
11
|
+
|
|
12
|
+
RSC→client serialization deduplicates by object reference, not value. Same reference = serialized once; new reference = serialized again. Do transformations (`.toSorted()`, `.filter()`, `.map()`) in client, not server.
|
|
13
|
+
|
|
14
|
+
**Incorrect (duplicates array):**
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
// RSC: sends 6 strings (2 arrays × 3 items)
|
|
18
|
+
<ClientList usernames={usernames} usernamesOrdered={usernames.toSorted()} />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Correct (sends 3 strings):**
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
// RSC: send once
|
|
25
|
+
<ClientList usernames={usernames} />
|
|
26
|
+
|
|
27
|
+
// Client: transform there
|
|
28
|
+
'use client'
|
|
29
|
+
const sorted = useMemo(() => [...usernames].sort(), [usernames])
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Nested deduplication behavior:**
|
|
33
|
+
|
|
34
|
+
Deduplication works recursively. Impact varies by data type:
|
|
35
|
+
|
|
36
|
+
- `string[]`, `number[]`, `boolean[]`: **HIGH impact** - array + all primitives fully duplicated
|
|
37
|
+
- `object[]`: **LOW impact** - array duplicated, but nested objects deduplicated by reference
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
// string[] - duplicates everything
|
|
41
|
+
usernames={['a','b']} sorted={usernames.toSorted()} // sends 4 strings
|
|
42
|
+
|
|
43
|
+
// object[] - duplicates array structure only
|
|
44
|
+
users={[{id:1},{id:2}]} sorted={users.toSorted()} // sends 2 arrays + 2 unique objects (not 4)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Operations breaking deduplication (create new references):**
|
|
48
|
+
|
|
49
|
+
- Arrays: `.toSorted()`, `.filter()`, `.map()`, `.slice()`, `[...arr]`
|
|
50
|
+
- Objects: `{...obj}`, `Object.assign()`, `structuredClone()`, `JSON.parse(JSON.stringify())`
|
|
51
|
+
|
|
52
|
+
**More examples:**
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
// ❌ Bad
|
|
56
|
+
<C users={users} active={users.filter(u => u.active)} />
|
|
57
|
+
<C product={product} productName={product.name} />
|
|
58
|
+
|
|
59
|
+
// ✅ Good
|
|
60
|
+
<C users={users} />
|
|
61
|
+
<C product={product} />
|
|
62
|
+
// Do filtering/destructuring in client
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Exception:** Pass derived data when transformation is expensive or client doesn't need original.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Parallel Data Fetching with Component Composition
|
|
3
|
+
impact: CRITICAL
|
|
4
|
+
impactDescription: eliminates server-side waterfalls
|
|
5
|
+
tags: server, rsc, parallel-fetching, composition
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Parallel Data Fetching with Component Composition
|
|
9
|
+
|
|
10
|
+
React Server Components execute sequentially within a tree. Restructure with composition to parallelize data fetching.
|
|
11
|
+
|
|
12
|
+
**Incorrect (Sidebar waits for Page's fetch to complete):**
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
export default async function Page() {
|
|
16
|
+
const header = await fetchHeader()
|
|
17
|
+
return (
|
|
18
|
+
<div>
|
|
19
|
+
<div>{header}</div>
|
|
20
|
+
<Sidebar />
|
|
21
|
+
</div>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function Sidebar() {
|
|
26
|
+
const items = await fetchSidebarItems()
|
|
27
|
+
return <nav>{items.map(renderItem)}</nav>
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Correct (both fetch simultaneously):**
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
async function Header() {
|
|
35
|
+
const data = await fetchHeader()
|
|
36
|
+
return <div>{data}</div>
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function Sidebar() {
|
|
40
|
+
const items = await fetchSidebarItems()
|
|
41
|
+
return <nav>{items.map(renderItem)}</nav>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default function Page() {
|
|
45
|
+
return (
|
|
46
|
+
<div>
|
|
47
|
+
<Header />
|
|
48
|
+
<Sidebar />
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Alternative with children prop:**
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
async function Header() {
|
|
58
|
+
const data = await fetchHeader()
|
|
59
|
+
return <div>{data}</div>
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function Sidebar() {
|
|
63
|
+
const items = await fetchSidebarItems()
|
|
64
|
+
return <nav>{items.map(renderItem)}</nav>
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function Layout({ children }: { children: ReactNode }) {
|
|
68
|
+
return (
|
|
69
|
+
<div>
|
|
70
|
+
<Header />
|
|
71
|
+
{children}
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default function Page() {
|
|
77
|
+
return (
|
|
78
|
+
<Layout>
|
|
79
|
+
<Sidebar />
|
|
80
|
+
</Layout>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Minimize Serialization at RSC Boundaries
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: reduces data transfer size
|
|
5
|
+
tags: server, rsc, serialization, props
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Minimize Serialization at RSC Boundaries
|
|
9
|
+
|
|
10
|
+
The React Server/Client boundary serializes all object properties into strings and embeds them in the HTML response and subsequent RSC requests. This serialized data directly impacts page weight and load time, so **size matters a lot**. Only pass fields that the client actually uses.
|
|
11
|
+
|
|
12
|
+
**Incorrect (serializes all 50 fields):**
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
async function Page() {
|
|
16
|
+
const user = await fetchUser() // 50 fields
|
|
17
|
+
return <Profile user={user} />
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
'use client'
|
|
21
|
+
function Profile({ user }: { user: User }) {
|
|
22
|
+
return <div>{user.name}</div> // uses 1 field
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Correct (serializes only 1 field):**
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
async function Page() {
|
|
30
|
+
const user = await fetchUser()
|
|
31
|
+
return <Profile name={user.name} />
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
'use client'
|
|
35
|
+
function Profile({ name }: { name: string }) {
|
|
36
|
+
return <div>{name}</div>
|
|
37
|
+
}
|
|
38
|
+
```
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FlatCompat } from "@eslint/eslintrc";
|
|
2
1
|
import { defineConfig } from "eslint/config";
|
|
3
2
|
import tseslint from "typescript-eslint";
|
|
4
3
|
import eslintJs from "@eslint/js";
|
|
@@ -9,10 +8,7 @@ import eslintPluginReactCompiler from "eslint-plugin-react-compiler";
|
|
|
9
8
|
import eslintPluginJsxA11y from "eslint-plugin-jsx-a11y";
|
|
10
9
|
import eslintPluginReact from "eslint-plugin-react";
|
|
11
10
|
import eslintPluginStylistic from "@stylistic/eslint-plugin";
|
|
12
|
-
|
|
13
|
-
const compat = new FlatCompat({
|
|
14
|
-
baseDirectory: import.meta.dirname,
|
|
15
|
-
});
|
|
11
|
+
import eslintPluginNext from "@next/eslint-plugin-next";
|
|
16
12
|
|
|
17
13
|
const languageLintingConfig = tseslint.config(
|
|
18
14
|
{
|
|
@@ -113,10 +109,9 @@ const reactA11yLintingConfig = defineConfig([
|
|
|
113
109
|
const nextLintingConfig = defineConfig([
|
|
114
110
|
{
|
|
115
111
|
files: ["**/*.{tsx,jsx}"],
|
|
116
|
-
|
|
117
|
-
compat.extends("plugin:@next/next/recommended"),
|
|
118
|
-
{
|
|
112
|
+
...eslintPluginNext.configs.recommended,
|
|
119
113
|
rules: {
|
|
114
|
+
...eslintPluginNext.configs.recommended.rules,
|
|
120
115
|
"@next/next/no-img-element": "off",
|
|
121
116
|
},
|
|
122
117
|
},
|
|
@@ -197,6 +192,9 @@ const prettierLintingConfig = defineConfig([
|
|
|
197
192
|
]);
|
|
198
193
|
|
|
199
194
|
export default defineConfig([
|
|
195
|
+
{
|
|
196
|
+
ignores: ["node_modules/**", ".next/**", "dist/**", "build/**"],
|
|
197
|
+
},
|
|
200
198
|
languageLintingConfig,
|
|
201
199
|
reactLintingConfig,
|
|
202
200
|
reactA11yLintingConfig,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"build": "next build",
|
|
8
8
|
"start": "next start",
|
|
9
9
|
"postinstall": "npx prisma generate",
|
|
10
|
-
"lint": "
|
|
10
|
+
"lint": "eslint . --fix",
|
|
11
11
|
"db:push": "npx prisma generate &&npx prisma db push",
|
|
12
12
|
"db:seed": "tsx src/scripts/db-seed.ts",
|
|
13
13
|
"db:studio": "npx prisma studio",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
65
65
|
"eslint-plugin-prettier": "^5.5.5",
|
|
66
66
|
"eslint-plugin-react": "^7.37.5",
|
|
67
|
-
"eslint-plugin-react-compiler": "
|
|
67
|
+
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
68
68
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
69
69
|
"globals": "^17.3.0",
|
|
70
70
|
"prettier": "^3.8.1",
|
|
@@ -151,8 +151,8 @@ importers:
|
|
|
151
151
|
specifier: ^7.37.5
|
|
152
152
|
version: 7.37.5(eslint@9.39.2(jiti@2.6.1))
|
|
153
153
|
eslint-plugin-react-compiler:
|
|
154
|
-
specifier:
|
|
155
|
-
version:
|
|
154
|
+
specifier: 19.1.0-rc.2
|
|
155
|
+
version: 19.1.0-rc.2(eslint@9.39.2(jiti@2.6.1))
|
|
156
156
|
eslint-plugin-react-hooks:
|
|
157
157
|
specifier: ^7.0.1
|
|
158
158
|
version: 7.0.1(eslint@9.39.2(jiti@2.6.1))
|
|
@@ -2170,8 +2170,8 @@ packages:
|
|
|
2170
2170
|
eslint-config-prettier:
|
|
2171
2171
|
optional: true
|
|
2172
2172
|
|
|
2173
|
-
eslint-plugin-react-compiler@
|
|
2174
|
-
resolution: {integrity: sha512-
|
|
2173
|
+
eslint-plugin-react-compiler@19.1.0-rc.2:
|
|
2174
|
+
resolution: {integrity: sha512-oKalwDGcD+RX9mf3NEO4zOoUMeLvjSvcbbEOpquzmzqEEM2MQdp7/FY/Hx9NzmUwFzH1W9SKTz5fihfMldpEYw==}
|
|
2175
2175
|
engines: {node: ^14.17.0 || ^16.0.0 || >= 18.0.0}
|
|
2176
2176
|
peerDependencies:
|
|
2177
2177
|
eslint: '>=7'
|
|
@@ -2478,15 +2478,9 @@ packages:
|
|
|
2478
2478
|
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
|
|
2479
2479
|
hasBin: true
|
|
2480
2480
|
|
|
2481
|
-
hermes-estree@0.20.1:
|
|
2482
|
-
resolution: {integrity: sha512-SQpZK4BzR48kuOg0v4pb3EAGNclzIlqMj3Opu/mu7bbAoFw6oig6cEt/RAi0zTFW/iW6Iz9X9ggGuZTAZ/yZHg==}
|
|
2483
|
-
|
|
2484
2481
|
hermes-estree@0.25.1:
|
|
2485
2482
|
resolution: {integrity: sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==}
|
|
2486
2483
|
|
|
2487
|
-
hermes-parser@0.20.1:
|
|
2488
|
-
resolution: {integrity: sha512-BL5P83cwCogI8D7rrDCgsFY0tdYUtmFP9XaXtl2IQjC+2Xo+4okjfXintlTxcIwl4qeGddEl28Z11kbVIw0aNA==}
|
|
2489
|
-
|
|
2490
2484
|
hermes-parser@0.25.1:
|
|
2491
2485
|
resolution: {integrity: sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==}
|
|
2492
2486
|
|
|
@@ -6163,13 +6157,13 @@ snapshots:
|
|
|
6163
6157
|
optionalDependencies:
|
|
6164
6158
|
eslint-config-prettier: 10.1.8(eslint@9.39.2(jiti@2.6.1))
|
|
6165
6159
|
|
|
6166
|
-
eslint-plugin-react-compiler@
|
|
6160
|
+
eslint-plugin-react-compiler@19.1.0-rc.2(eslint@9.39.2(jiti@2.6.1)):
|
|
6167
6161
|
dependencies:
|
|
6168
6162
|
'@babel/core': 7.29.0
|
|
6169
6163
|
'@babel/parser': 7.29.0
|
|
6170
6164
|
'@babel/plugin-proposal-private-methods': 7.18.6(@babel/core@7.29.0)
|
|
6171
6165
|
eslint: 9.39.2(jiti@2.6.1)
|
|
6172
|
-
hermes-parser: 0.
|
|
6166
|
+
hermes-parser: 0.25.1
|
|
6173
6167
|
zod: 3.25.76
|
|
6174
6168
|
zod-validation-error: 3.5.4(zod@3.25.76)
|
|
6175
6169
|
transitivePeerDependencies:
|
|
@@ -6577,14 +6571,8 @@ snapshots:
|
|
|
6577
6571
|
|
|
6578
6572
|
he@1.2.0: {}
|
|
6579
6573
|
|
|
6580
|
-
hermes-estree@0.20.1: {}
|
|
6581
|
-
|
|
6582
6574
|
hermes-estree@0.25.1: {}
|
|
6583
6575
|
|
|
6584
|
-
hermes-parser@0.20.1:
|
|
6585
|
-
dependencies:
|
|
6586
|
-
hermes-estree: 0.20.1
|
|
6587
|
-
|
|
6588
6576
|
hermes-parser@0.25.1:
|
|
6589
6577
|
dependencies:
|
|
6590
6578
|
hermes-estree: 0.25.1
|