How to Vibe Code a Next.js Boilerplate Repository - Complete Guide 2025
Master vibe coding to create production-ready Next.js boilerplates. Complete step-by-step guide from brainstorming to deployment using AI assistance and structured documentation.
Daniel Kliewer
Author, Sovereign AI


How to Vibe Code a Next.js Boilerplate Repository: Complete Guide
Vibe coding revolutionizes software development by combining AI assistance with structured documentation to create production-ready applications efficiently. This comprehensive guide demonstrates how to build a complete Next.js boilerplate using vibe coding techniques, from initial brainstorming to final deployment.
What is Vibe Coding?
Vibe coding transforms traditional development by leveraging AI tools and systematic documentation to accelerate project creation. Instead of coding line-by-line, developers use AI assistance, structured prompts, and comprehensive documentation to build robust applications quickly and efficiently.
Assembling Essential Next.js Boilerplate Best Practices
Standard Operating Procedure
I am going to start with a brainstorming prompt with just the Google browser search bar, I don't want to use up any of my free allocation to other models. This still is vibe coding since Google supplies an AI generated answer for free! And some people complain about this free inference they are giving us.
what are the best practices for creating a boilerplate next.js repo that you would want to take into consideration when setting it up for the first time, I want all of the SOP and everything that you would want a senior software engineer to know and tell someone to take into consideration while they are drafting all of the stand operation procedure to be taken into account when drafting this repo
Google's AI Generated Response
When establishing a Next.js boilerplate repository, a senior software engineer would advise considering the following best practices and standard operating procedures (SOPs):
Project Structure and Organization:
• Clear Folder Structure: Establish a logical and consistent file and folder structure (e.g., src/pages, src/components, src/lib, src/styles, src/utils). This enhances navigability and maintainability.
• Modularity: Design components and utility functions to be modular and reusable, promoting code reusability and reducing redundancy. • Co-location: Group related files and components together where it makes sense, improving discoverability and understanding.
Development Tooling and Configuration:
• TypeScript: Integrate TypeScript for type safety, improved code quality, and better developer experience.
• ESLint and Prettier: Configure ESLint for code linting and Prettier for consistent code formatting, ensuring adherence to coding standards.
• Husky and Lint-Staged: Implement pre-commit hooks with Husky and Lint-Staged to automatically run linters and formatters on staged files, preventing inconsistent code from entering the repository.
• Environment Variables: Clearly define and manage environment variables (e.g., API keys, database URLs) for different environments (development, staging, production).
Performance Optimization:
• SSR, SSG, and ISR: Understand and strategically utilize Server-Side Rendering (SSR), Static Site Generation (SSG), and Incremental Static Regeneration (ISR) based on the content's dynamism and performance requirements.
• Image Optimization: Integrate Next.js's Image component and optimize image assets for faster loading times.
• Caching Strategies: Implement effective caching mechanisms (e.g., request memorization, data cache, router cache) to minimize server load and improve user experience.
Testing and Quality Assurance:
• Testing Framework: Integrate a robust testing framework (e.g., Jest, React Testing Library) and establish a clear testing strategy (unit, integration, end-to-end tests).
• Code Coverage: Set up code coverage reporting (e.g., Codecov) to monitor and ensure adequate test coverage.
Deployment and CI/CD:
• Version Control: Utilize Git and establish a clear branching strategy (e.g., Gitflow, GitHub Flow) for managing code versions and collaboration.
• CI/CD Pipeline: Configure a Continuous Integration/Continuous Deployment (CI/CD) pipeline (e.g., GitHub Actions, Vercel) for automated builds, tests, and deployments.
Documentation and SOPs:
• README.md: Provide a comprehensive README.md with clear instructions for setup, development, testing, and deployment.
• Contributing Guidelines: Establish clear contributing guidelines for new developers joining the project.
• Architecture Documentation: Document key architectural decisions and system design.
Security Considerations:
• Secure API Handling: Implement secure practices for handling API keys, tokens, and sensitive data.
• Authentication and Authorization: Integrate robust authentication and authorization mechanisms as needed.
By adhering to these principles and establishing clear SOPs, the Next.js boilerplate will serve as a solid foundation for building scalable, maintainable, and performant applications.
AI responses may include mistakes.
Dependencies
So from this I am going to start compiling together my initial brainstorming prompt. Bascially what I do is collect context from as many sources as I can and I am going to feed all of that to NotebookLM to help us condense some of that information into a more usable prompt.
I already have a working next.js frontend running right now and I like how it works so one thing I can do to speed this up is to include all the dependencies from the package.json file in my previous version. So that is another piece of context to include which is below.
text1"dependencies": {2 "@react-three/drei": "^10.7.6",3 "@react-three/fiber": "^9.3.0",4 "@tailwindcss/typography": "^0.5.19",5 "@types/three": "^0.180.0",6 "framer-motion": "^12.23.22",7 "gray-matter": "^4.0.3",8 "next": "15.5.4",9 "next-mdx-remote": "^5.0.0",10 "next-sitemap": "^4.2.3",11 "octokit": "^5.0.3",12 "prismjs": "^1.30.0",13 "react": "19.1.0",14 "react-dom": "19.1.0",15 "react-markdown": "^10.1.0",16 "rehype-prism-plus": "^2.0.1",17 "rehype-raw": "^7.0.0",18 "remark": "^15.0.1",19 "swr": "^2.3.6",20 "three": "^0.180.0"21 },22 "devDependencies": {23 "@eslint/eslintrc": "^3",24 "@tailwindcss/postcss": "^4",25 "@testing-library/jest-dom": "^6.8.0",26 "@testing-library/react": "^16.3.0",27 "@types/jest": "^30.0.0",28 "@types/node": "^20",29 "@types/react": "^19",30 "@types/react-dom": "^19",31 "eslint": "^9",32 "eslint-config-next": "15.5.4",33 "jest": "^30.1.3",34 "jest-environment-jsdom": "^30.1.2",35 "prettier": "^3.6.2",36 "tailwindcss": "^4",37 "typescript": "^5"38 }
Optimization
Another piece is the following prompt I have written in the past to improve the SEO for my site. This is something in the end I would like to have thought of from the beginning so that is why I am including it. Basically you can think of this as assembline all the pieces you would need in order to make this if you were actually coding it.
text1Core Objectives2Add and refine SEO metadata for every page and post.3Improve semantic HTML and add structured data (JSON-LD).4Optimize images, fonts, performance & Core Web Vitals.5Generate and configure sitemap and robots.txt.6Ensure clean URLs, canonical tags, no duplicate content.7Verify improvements via logs, Lighthouse, and automated checks.8Review /pages or /app directory structure.9Detect if using Pages Router or App Router.10Identify blog post generation (Markdown, MDX, CMS, etc.).11Create a TODO.md or SEO_IMPROVEMENT_LOG.md to track progress.12Metadata System Implementation13For Pages Router:14Add/import <Head> from next/head in all pages.15For App Router (Next.js 13+):16Use export const metadata = {} or generateMetadata() for dynamic pages.17Each page must include:18Title (≤ 60 characters, keyword-focused).19Meta description (≤ 160 characters, compelling).20Open Graph tags (og:title, og:description, og:image, og:url).21Twitter Card tags.22<link rel="canonical" href="https://example.com/...">.23For dynamic routes ([slug].tsx), generate metadata from post content.243. Semantic HTML + Structured Data (JSON-LD)25Replace generic <div>s with semantic elements: <article>, <header>, <nav>, <main>, <footer>, <section>.26Add JSON-LD using <script type="application/ld+json"> for:27Blog posts → "@type": "Article"28Homepage → "@type": "WebSite"29About page → "@type": "Person" or "Organization"30Validate structured data using https://search.google.com/test/rich-results.314. Image & Media Optimization32Replace all <img> with Next.js <Image />.33Ensure:34alt text is descriptive & keyword-relevant.35Images are automatically responsive and lazy-loaded.36Prefer modern formats like WebP.375. Performance / Core Web Vitals Enhancements38Use next/font instead of external CSS font imports.39Audit third-party scripts; load via <Script strategy="lazyOnload" /> or afterInteractive.40Remove render-blocking scripts/styles.41Enable Static Site Generation wherever possible.42Use dynamic(() => import(...), { ssr: false }) where interactive-only.436. Sitemaps, robots.txt, and Crawl Control44Install and configure next-sitemap.45Generate sitemap.xml and robots.txt automatically.46Add canonical base URL in config.47Add noindex to pages like /admin, /dashboard, /drafts.487. Clean URLs & Avoid Duplicate Content49Ensure URL structure is lowercase, hyphen-separated (/blog/my-post-title).50Add 301 redirect from http → https, and non-www → www or vice versa.51Use canonical tags for paginated or duplicate content.52If pagination exists, add rel="next" and rel="prev".538. Monitoring & Validation54Add commands to run Lighthouse and output reports to /seo-reports.55Validate metadata output by crawling the site locally.56Fix 404 errors, broken links, missing alt text, wrong status codes.57Log all SEO changes in SEO_IMPROVEMENT_LOG.md.58Be isolated to one logical SEO change.59Final Requirement60When SEO optimization is complete:61Provide a summary of changes.62Provide a checklist of unresolved items.63Do NOT break any existing functionality or styling.64Ensure site builds and deploys successfully.
Documentation
Assembling the proper documentation for a project is another essential aspect to this process. So I am going to use perplexity to seach for as many links as I can to include in our NoteBookLM prompt once we eventually get there.
text1You are an expert internet researcher and software engineer with a lot of experience and you are going to look for all of the documentation that you would want an expert software engineer to have at their disposal while they are coding the absolute best boilerplate next.js repo to be used in the future. I want to use TailwindCSS, I want to use a Shadcn UI component library.23The only returnable I want from you is a list of URLs of all of this documentation.
From the search I performed I was able to compile the following set of URLs.
text1# Next.js Documentation23https://nextjs.org/docs45https://nextjs.org/docs/app/getting-started67https://nextjs.org/docs/pages/api-reference/config/typescript89https://www.geeksforgeeks.org/reactjs/next-js-routing/1011https://prismic.io/blog/nextjs-13-app-directory1213https://nextjs.org/docs/app/getting-started/project-structure1415https://nextjs.org/learn/dashboard-app1617https://nextjs.org/docs/pages/api-reference/functions/use-router1819# TailwindCSS Documentation2021https://tailwindcss.com/docs2223https://v2.tailwindcss.com/docs2425https://www.jetbrains.com/help/webstorm/tailwind-css.html2627# Shadcn UI Documentation2829https://ui.shadcn.com/docs3031https://codeparrot.ai/blogs/shadcn-ui-for-beginners-the-ultimate-guide-and-step-by-step-tutorial3233# In-Depth Guides and Tutorials3435https://www.contentful.com/blog/next-js-app-directory-guide-tutorial/3637https://bugfender.com/blog/nextjs-router/3839https://www.frontendeng.dev/blog/26-difference-between-app-and-pages-in-nextjs
Structured Documentation Creation
Using AI to Generate Project Documentation
NotebookLM serves as an intelligent documentation assistant, synthesizing research into actionable project documentation. The AI generates comprehensive prompts for creating essential project files that establish development standards and architectural guidelines.
Core Documentation Files
AI guidelines establish project standards, mandating Next.js App Router usage, React Server Components, TypeScript integration, and shadcn/ui component implementation.
Requirements documentation defines system prerequisites, core framework specifications, and mandatory features including comprehensive routing capabilities and robust error handling.
Architecture documentation outlines system design principles, emphasizing file-system based routing, nested layouts, and parallel rendering capabilities.
Implementation guidelines provide detailed setup instructions for type safety, styling strategies, and routing implementation.
Standards documentation establishes coding conventions, file organization principles, and naming conventions.
Security documentation outlines authentication strategies, data protection measures, and security best practices.
Testing documentation defines testing methodologies, including unit testing, integration testing, and end-to-end testing approaches.
Deployment documentation provides comprehensive deployment strategies, including CI/CD pipelines, hosting options, and environment-specific configuration.
Advanced Development Techniques
Context Engineering and AI Integration
Context engineering involves systematically organizing project information to maximize AI assistance effectiveness. By creating comprehensive documentation before coding, developers establish clear parameters that guide AI-generated implementations.
Multi-Stage Documentation Process
- Context Assembly: Gather comprehensive information from multiple sources
- AI Processing: Use NotebookLM to synthesize and organize information
- Documentation Generation: Create structured project documentation
- Context Enhancement: Polish and refine documentation for clarity
- Implementation Guidance: Generate detailed prompts for AI coding assistance
Key Takeaways and Best Practices
Vibe Coding Methodology
- Comprehensive Research: Gather extensive context before implementation
- Structured Documentation: Create detailed project specifications
- AI-Assisted Development: Leverage AI tools for code generation
- Systematic Implementation: Follow structured development phases
- Thorough Validation: Test and verify all functionality
Essential Success Factors
Context quality directly impacts AI assistance effectiveness. Structured documentation provides clear implementation guidelines. Systematic phase execution ensures comprehensive coverage of all requirements.

Now we can use this as a reference to build the app. If you were a real coder and not just a filthy vibe coder like me then you could use a notebook like that in order to help you along the way and refer back to documention. It really is a helpful tool. Which is why I always try to build my own version of it. You can see my latest vibe coding attempt at it here.
Let's first draft a prompt to give the notebook to start building the context we need to create for our vibe coding session. Proper preperation of documents is half the battle.
One method I use to feed context to CLIne or whichever vibe coding platform you want to use is to draft a series of files to include in the root. So in this first prompt I am going to generate the prompts needed to start fleshing out these documents.
text1You are the best software engineer who has ever lived and you are going to create the absolute best boilerplate next.js repo you possibly can. I have included all of the information you need to assemble this in this notebook. I want you to crawl through all of the information and help to draft a series of prompts which I can give you in order for you to draft the following documents:23ai_guidelines.md4This file serves as the central control document56requirements.md7Requirements Analysis89architecture.md10Architecture Design1112implementation.md13Implementation Guidelines1415testing.md16Testing Approach1718security.md19Security Considerations2021sop.md (Standard Operating Procedures)22Standard Operating Procedures
This is an excellent starting point for building the ultimate Next.js boilerplate repository. As the expert software engineer, I will draw upon the extensive details provided regarding Next.js App Router conventions, development tooling, performance optimizations, and documentation requirements to draft highly detailed prompts for each required document.
Here are the structured prompts you can use to generate the foundational documentation for your best-in-class Next.js repository:
Prompts for Documentation Generation
1. ai_guidelines.md (Central Control Document)
Prompt: Draft the ai_guidelines.md file serving as the central control document for the Next.js boilerplate. Specify that the project must strictly use the Next.js App Router to leverage modern React features. Mandate the adoption of React Server Components (RSC) as the default component type. Integrate TypeScript for robust type safety and enforce the use of Statically Typed Links by enabling typedRoutes: true in next.config.ts. Mandate Tailwind CSS for styling and the use of shadcn/ui. Emphasize that all component integration must follow the shadcn/ui Open Code philosophy rather than importing pre-compiled packages. Finally, establish that all future development prompts must strictly adhere to the documented Project Structure and Organization best practices, including colocation and the use of private folders (_folderName) for utilities.
2. requirements.md (Requirements Analysis)
Prompt: Draft the requirements.md file. Detail the fundamental software requirements for this production-ready application, including the prerequisite for Node.js v18.18.0 or later. The core application must be built using the Next.js App Router to facilitate modern features such as nested layouts and the use of React Server Components. List mandatory features based on the App Router's design principles:
- Comprehensive Routing Capabilities covering Static Routes, Nested Routes, Dynamic Routes (
[segment]), Catch-All/Optional Catch-All Routes ([...segment]/[[...segment]]), Parallel Routing (@folder), and Route Grouping ((folder)). - Robust Error Handling using the dedicated
error.jsfile for runtime errors,loading.jsfor suspense boundaries, andnot-found.jsor thenotFound()function for 404 handling. - Efficient Data Fetching using async React Server Components and server-side
fetchwith support for caching, revalidation, and request memoization. - Integration of SEO and Metadata requirements using the Next.js metadata API.
3. architecture.md (Architecture Design)
Prompt: Draft the architecture.md file outlining the system design for the boilerplate. Detail the reliance on the file-system based routing system of the Next.js App Router, where directories define routes and special files like page.js define page content. Explain how the architecture maximizes code reusability through the use of Nested Layouts (layout.js) and the component architecture. Describe the structural advantages of Colocation and the ability to structure paths without affecting the URL using Route Groups ((folderName)). Detail the usage of Parallel Routing (@slot) to render independent pages/components simultaneously within the same layout. Explain the primary data fetching paradigm: utilizing async React Server Components (RSC) to fetch data directly, noting that this allows safe performance of sensitive data requests (like database calls) without needing an intermediary API route. Finally, define the backend architecture based on Next.js Route Handlers (route.js/.ts) for developing API services supporting methods like GET, POST, PUT, DELETE, etc..
4. implementation.md (Implementation Guidelines)
Prompt: Draft the implementation.md file. Provide detailed guidelines for setting up the codebase and ensuring consistency.
- Type Safety: Enforce the use of TypeScript and ensure the inclusion of generated Next.js types in
tsconfig.json. - Styling and Components: Define the strategy using the utility-first philosophy of Tailwind CSS and mention key styling methods supported (Tailwind CSS, CSS Modules, Global CSS). Detail component implementation using shadcn/ui and its approach of providing direct component code for customization.
- Routing Implementation: Instruct developers on navigating using the
Linkcomponent for transitions and theuseRouterhook for programmatic navigation. Note that components using hooks likeuseRoutermust be declared as Client Components using the'use client'directive. - State Management: Outline implementation using the special files:
loading.js(Suspense),error.js(must be a client component), andnot-found.js(custom 404 page). - SEO/Optimization: Require using the
export const metadata = {}orgenerateMetadata()convention in the App Router for SEO metadata. Mandate strategic utilization of SSR, SSG, and ISR, along with Image and Font Optimization.
5. testing.md (Testing Approach)
Prompt: Draft the testing.md file defining the Quality Assurance strategy. Specify the integration of a robust testing framework such as Jest and React Testing Library as development dependencies. Detail the need for a clear testing strategy encompassing unit, integration, and end-to-end tests. Establish the mandatory requirement for Code Coverage reporting to ensure adequate test coverage is maintained. Ensure the plan requires testing critical Next.js features, including:
- Functionality of all major route types (Static, Dynamic, Nested, Parallel).
- Validation of programmatic navigation using the
useRouterhook methods (push,replace,prefetch). - Confirmation that the specialized files,
error.jsandnot-found.js, correctly intercept and display expected errors and 404 states.
6. security.md (Security Considerations)
Prompt: Draft the security.md file addressing key concerns for a Next.js application. Outline secure practices for handling API keys, tokens, and sensitive data. Mandate the clear definition and management of Environment Variables for different stages (development, production) using .env files. Highlight the security benefit of using React Server Components (RSC) for data fetching, as this allows direct, safe execution of sensitive operations (like database queries) on the server, preventing credentials from leaking to the client. Require the integration of robust Authentication and Authorization mechanisms, noting that features like NextAuth.js and Middleware are common components for protecting dashboard pages.
7. sop.md (Standard Operating Procedures)
Prompt: Draft the sop.md (Standard Operating Procedures) file detailing the required operational workflow and code management standards for the project.
- Version Control: Specify the utilization of Git with a clear branching strategy (e.g., Gitflow or GitHub Flow).
- Code Quality Enforcement: Establish the use of Husky and Lint-Staged to run linters and formatters (ESLint, Prettier) on staged files automatically before committing.
- Development Structure: Enforce adherence to the Next.js Project Structure, including the recommendation to use the optional
src/directory to separate application code from configuration files. - Deployment: Define the CI/CD Pipeline using services like GitHub Actions or Vercel for automated builds, testing, and deployment.
- Documentation Maintenance: Stipulate the required project documentation: a comprehensive README.md, clear Contributing Guidelines, and consistent maintenance of the Architecture Documentation.
- Next.js Utility Usage: Document the correct use of navigation elements, specifically reserving the native anchor tag (
<a/>) for external links, and using the Next.jsLinkcomponent for internal application navigation.
Now it is as simple as feeding each of these prompts in turn to NotebookLM loaded with our context to draft the accompanying files.
ai_guidelines.md
Draft the ai_guidelines.md file serving as the central control document for the Next.js boilerplate. Specify that the project must strictly use the Next.js App Router to leverage modern React features. Mandate the adoption of React Server Components (RSC) as the default component type. Integrate TypeScript for robust type safety and enforce the use of Statically Typed Links by enabling typedRoutes: true in next.config.ts. Mandate Tailwind CSS for styling and the use of shadcn/ui. Emphasize that all component integration must follow the shadcn/ui Open Code philosophy rather than importing pre-compiled packages. Finally, establish that all future development prompts must strictly adhere to the documented Project Structure and Organization best practices, including colocation and the use of private folders (_folderName) for utilities.
ai_guidelines.md
AI Development Guidelines for Next.js Boilerplate
This document serves as the central control mandate for all development work, ensuring consistency, maintainability, and optimal performance of the Next.js boilerplate. All future prompts and development implementations must strictly adhere to these principles.
1. Core Framework and Routing Mandates
The boilerplate must exclusively utilize the Next.js App Router and leverage modern React features.
1.1 App Router Requirement
The project must strictly use the Next.js App Router. This is the recommended approach for new projects and offers significant improvements over previous page routers. The App Router leverages the benefits and updates introduced in the latest version of React (React 18 and later), including the use of React canary releases built-in.
1.2 Default Component Type: React Server Components (RSC)
React Server Components (RSC) are mandated as the default component type. The App directory enforces server-side rendering by default and makes use of RSC.
- RSC Benefits: Each page under a route in the App Router is a ReactJS server component. RSC reduces the amount of client-side code that needs to be loaded, improving application performance.
- Data Fetching: For data fetching, developers should use
fetchandasyncAPIs directly within Server Components. Since RSCs perform requests on the server, sensitive data requests (like database calls) can be performed directly without needing an intermediary API route, as credentials or secrets are not leaked to the client.
2. Type Safety and Linking
TypeScript must be integrated for robust type safety and improved code quality.
2.1 Statically Typed Links
To enhance type safety when navigating between pages and prevent typos and errors when using next/link, Statically Typed Links must be enforced.
This feature requires enabling typedRoutes: true in the Next.js configuration.
Implementation in next.config.ts:
typescript1import type { NextConfig } from 'next'23const nextConfig: NextConfig = {4 typedRoutes: true, // Mandates statically typed links5}67export default nextConfig
When enabled, Next.js validates literal href strings and types next/navigation methods like push, replace, and prefetch within the App Router.
3. Styling and UI Library
3.1 Styling with Tailwind CSS
Tailwind CSS is mandated for all styling needs. Tailwind CSS uses a utility-first approach, scanning components for class names and generating corresponding styles.
3.2 UI Component Strategy: shadcn/ui and Open Code
The UI components must be sourced using shadcn/ui.
- Open Code Philosophy Mandate: Component integration must strictly follow the shadcn/ui Open Code philosophy. Shadcn/ui is explicitly not a traditional component library where pre-compiled packages are imported from NPM.
- Integration Method: Developers must integrate components by obtaining the actual component code, allowing for full transparency and easy customization. This allows developers to directly edit the source code, avoiding the need for wrapping components or writing workarounds to override styles.
- Composition: All components should share a common, composable interface, making them predictable.
4. Project Structure and Organization
All future development prompts and implementations must strictly adhere to the documented Project Structure and Organization best practices.
4.1 Colocation
Colocation is mandated for improved code structure, organization, and developer experience. Related files and components should be grouped together where it makes sense.
- In the App Router, files can be safely colocated inside route segments in the
appdirectory without accidentally being routable, as only the content returned bypage.jsorroute.jsis sent to the client.
4.2 Private Folders for Utilities
To separate implementation details from the routing logic and organize internal files consistently, the use of Private Folders is mandated for utilities, hooks, or shared components.
- Naming Convention: Private folders must be created by prefixing a folder with an underscore:
_folderName. - Routing Exclusion: Prefixing a folder with an underscore opts the folder and all its subfolders out of the routing system, signifying it as a private implementation detail.
- Use Cases: These folders are a safe place for non-routable files such as UI utilities (
_components) or data utilities (_lib).
requirements.md
text1Draft the requirements.md file. Detail the fundamental software requirements for this production-ready application, including the prerequisite for Node.js v18.18.0 or later. The core application must be built using the Next.js App Router to facilitate modern features such as nested layouts and the use of React Server Components. List mandatory features based on the App Router's design principles:23Comprehensive Routing Capabilities covering Static Routes, Nested Routes, Dynamic Routes ([segment]), Catch-All/Optional Catch-All Routes ([...segment]/[[...segment]]), Parallel Routing (@folder), and Route Grouping ((folder)).4Robust Error Handling using the dedicated error.js file for runtime errors, loading.js for suspense boundaries, and not-found.js or the notFound() function for 404 handling.5Efficient Data Fetching using async React Server Components and server-side fetch with support for caching, revalidation, and request memoization.6Integration of SEO and Metadata requirements using the Next.js metadata API.
requirements.md
1. System Prerequisites
To ensure stable development and deployment of the application, the following environment prerequisites must be met:
| Requirement | Details | Source | | :--- | :--- | :--- | | Node.js | v18.18.0 or later must be installed. Next.js installation typically requires Node.js v18.x or above. | | | Next.js | The latest stable version of Next.js should be used, with the App Router enabled during project creation. | | | Development OS | Support for macOS, Windows (including WSL), or Linux operating systems. | |
2. Core Application Framework
The application must be built as a full-stack web application using the Next.js App Router, leveraging modern React features for optimal performance and structure.
| Requirement | Details | Source |
| :--- | :--- | :--- |
| Framework | The core application must exclusively utilize the Next.js App Router. The App Router is the recommended approach for new projects, replacing the older Pages Router. | |
| Component Architecture | The application must leverage the capabilities of React Server Components (RSC), which the App Router supports. Each route page (page.js or .tsx) is, by default, a ReactJS server component. | |
| Layout Management | The application structure must utilize the App Router's file-system based routing to implement nested layouts using the dedicated layout.js (or .tsx) file convention. Layouts defined at any level wrap their child segments. | |
3. Mandatory Features based on App Router Design Principles
3.1 Comprehensive Routing Capabilities
The application must demonstrate mastery of the file-system based routing principles of the App Router. Folders define URL segments, and a route becomes public when a page or route file exists within the directory.
| Feature | Convention/Usage | Source |
| :--- | :--- | :--- |
| Static Routes | Defined by directories with known route segment names (e.g., app/about/page.tsx results in /about). | |
| Nested Routes | Created by nesting folders under the app/ directory (e.g., app/blog/authors/page.tsx results in /blog/authors). | |
| Dynamic Routes | Parameterize segments using square brackets (e.g., [segment] or [slug]). Values are accessed via the params prop in the page component. | |
| Catch-All Routes | Defined using [...segment]. This matches multiple subsequent route segments (e.g., /shop/clothing/shirts). | |
| Optional Catch-All Routes | Defined using [[...segment]]. This allows matching a variable number of segments, including zero segments (e.g., /docs or /docs/pages). | |
| Parallel Routing | Renders one or more pages in the same layout simultaneously. Named slots are defined using the @folder convention (e.g., @growth) and are received as props in the parent layout. | |
| Route Grouping | Used for organizing routes logically without affecting the URL path. Group folders are wrapped in parentheses (e.g., (marketing)). | |
3.2 Robust Error Handling and Suspense Boundaries
The application must implement robust error management using dedicated special files and functions provided by the App Router.
| Feature | Convention/Usage | Source |
| :--- | :--- | :--- |
| Runtime Error Handling | Implemented using the dedicated error.js file within a route segment. The component exported from error.js must be a client component (using 'use client'). | |
| Loading States / Suspense | Implemented using the loading.js file convention in a route segment to display loading UI (skeletons). This file automatically wraps the corresponding page in a <Suspense> boundary. | |
| 404 Not Found UI | A customized 404 page must be implemented using not-found.js under the app/ directory to handle any unmatched routes throughout the application. | |
| Programmatic 404 | The built-in notFound() function must be used within a route segment to throw the NEXT_NOT_FOUND error, which stops the current rendering process and displays the nearest not-found.js file. | |
3.3 Efficient Data Fetching
Data fetching must prioritize server-side operations using React Server Components to optimize performance and security.
| Feature | Convention/Usage | Source |
| :--- | :--- | :--- |
| Server Data Fetching | Data fetching must be performed directly using async React Server Components and the native server-side fetch function. This allows for direct, safe calls to sensitive resources (like databases) without needing an intermediary API route, as requests occur safely on the server. | |
| Caching Support | Server-side fetch requests must utilize Next.js's built-in caching features, supporting strategies similar to getStaticProps (e.g., cache: 'force-cache'). | |
| Revalidation Support | Fetch requests must support time-based revalidation to fetch data at specific intervals (similar to getStaticProps with revalidate option, e.g., next: { revalidate: 10 }). | |
| Request Memoization | The application must leverage Next.js's automatic request memoization for all fetch requests within the component tree, ensuring that duplicate requests for the same data do not incur performance penalties. | |
3.4 Integration of SEO and Metadata Requirements
Search Engine Optimization (SEO) must be integrated using the Next.js metadata API conventions specific to the App Router.
| Requirement | Convention/Usage | Source |
| :--- | :--- | :--- |
| Metadata API | Metadata requirements must be defined in layouts or pages using the Next.js export const metadata = {} object or the generateMetadata() function. | |
| Mandatory Tags | Every page must include essential SEO tags: title (keyword-focused, $\le$ 60 characters) and description (compelling, $\le$ 160 characters). | |
| Social Sharing | Implementation must include Open Graph tags (og:title, og:description, og:image, og:url) and Twitter Card tags to optimize content for social sharing. | |
| Generated Files | The application structure should account for file conventions for automatic SEO generation, such as sitemap.xml or sitemap.js (Generated Sitemap), and robots.txt or robots.js (Generated Robots file). | |
architecture.md
Draft the architecture.md file outlining the system design for the boilerplate. Detail the reliance on the file-system based routing system of the Next.js App Router, where directories define routes and special files like page.js define page content. Explain how the architecture maximizes code reusability through the use of Nested Layouts (layout.js) and the component architecture. Describe the structural advantages of Colocation and the ability to structure paths without affecting the URL using Route Groups ((folderName)). Detail the usage of Parallel Routing (@slot) to render independent pages/components simultaneously within the same layout. Explain the primary data fetching paradigm: utilizing async React Server Components (RSC) to fetch data directly, noting that this allows safe performance of sensitive data requests (like database calls) without needing an intermediary API route. Finally, define the backend architecture based on Next.js Route Handlers (route.js/.ts) for developing API services supporting methods like GET, POST, PUT, DELETE, etc..
architecture.md
System Design Overview: Next.js App Router Boilerplate
This boilerplate utilizes the Next.js App Router, which leverages advanced features of React Server Components (RSC) and a powerful file-system based routing system to build scalable, maintainable, and performant full-stack applications.
1. Routing Architecture
The core routing system is governed by a file-system based routing convention housed within the top-level app/ directory.
- Route Definition: A directory (folder) within
app/indicates a route or a route segment, and nesting folders creates nested routes. The application's root route (/) is defined by the top-levelapp/directory. - Page Content: The page content for a specific route is defined by the special file named
page.js(or.ts/.tsx) located within the corresponding route directory. A route becomes publicly accessible only when apage.jsorroute.jsfile exists within the segment. - Dynamic Routing: Dynamic route segments are defined using square brackets in the folder name, such as
[name]or[slug], allowing the creation of routes that match dynamic data.
2. Structural Organization and Reusability
The architecture maximizes code organization and reuse through colocation, nested layouts, and route grouping.
A. Colocation and Component Architecture
The Next.js App Router improves development experience through Colocation, which involves organizing and managing pages alongside other related files (like layouts and components) within the same app/ directory.
- Safety: While folders define the route structure, a route is not publicly accessible until it contains a
page.jsorroute.jsfile. This means that project files (such as UI utilities or internal logic) can be safely colocated inside route segments in theappdirectory without accidentally becoming routable paths. - Modularity: The architecture encourages building applications with a component architecture that follows a tree hierarchy, promoting modularity and reuse of components and utility functions.
B. Nested Layouts (layout.js)
The system employs Nested Layouts using the special layout.js file to maximize code reusability.
- Shared UI: The
layout.jsfile is used for defining shared UI (such as headers or navigation) across multiple child routes or segments. - Hierarchy: Layouts at any level wrap their child segments. Layout components are rendered recursively in nested routes, ensuring that the components of a child route segment are nested inside the components of its parent segment.
- Optimization: During client-side navigation between pages that share a layout, the layout does not re-render and remains interactive.
C. Route Groups ((folderName))
Route Groups allow developers to organize routes logically within the app/ directory without impacting the resulting URL path.
- Structural Advantage: Route groups are created by wrapping a folder name in parentheses, such as
(marketing)or(shop). This indicates that the folder is for organizational purposes and should not be included in the route's URL path. - Layout Scope: They are particularly useful for enabling nested layouts, allowing the creation of multiple root layouts or applying a layout to a subset of routes in a common segment.
3. Parallel Rendering
The architecture uses Parallel Routing to enhance dashboard-like features where independent sections need to render simultaneously.
- Simultaneous Rendering: Parallel Routing allows one or more pages/components to render simultaneously within the same layout.
- Named Slots: Parallel routes are defined using named slots, established with the
@slot(or@folder) convention (e.g.,@growthor@revenue). - Integration: These named slots are automatically received by the parent layout component as props and are rendered within the layout's JSX structure.
- Isolation: Each parallel route can define its own independent loading state (
loading.js) and error state (error.js). Note that these slots are not actual route segments and cannot be accessed via a dedicated route path.
4. Data Fetching Paradigm
The primary data fetching paradigm relies heavily on React Server Components (RSC).
- Server Component Direct Fetching: The App directory, enforcing server-side rendering by default, supports async React Server Components (RSC) which can use
async/awaitto directly fetch data. - Sensitive Data Requests: A key benefit is the ability to safely perform sensitive data requests (like database calls) directly in the component. Since RSCs execute all data fetching on the server, there is no risk of leaking credentials or secrets, removing the need for an intermediary API route for securing data retrieval.
- Recommendation: Next.js recommends fetching all data on the server, either via an RSC or a Route Handler.
5. Backend Architecture: Route Handlers
The backend services are developed using Next.js Route Handlers.
- API Implementation: Route Handlers implement API services, replacing the older API routes used in the Pages Router.
- File Convention: They are defined by creating a special file named
route.js(or.ts) inside the relevantappfolder (e.g.,app/api/route.js). - Supported Methods: Route Handlers leverage the Request and Response APIs and support standard HTTP methods, including: GET, POST, PUT, DELETE, PATH, HEAD, and OPTIONS.
implementation.md
text1Draft the implementation.md file. Provide detailed guidelines for setting up the codebase and ensuring consistency.23Type Safety: Enforce the use of TypeScript and ensure the inclusion of generated Next.js types in tsconfig.json.4Styling and Components: Define the strategy using the utility-first philosophy of Tailwind CSS and mention key styling methods supported (Tailwind CSS, CSS Modules, Global CSS). Detail component implementation using shadcn/ui and its approach of providing direct component code for customization.5Routing Implementation: Instruct developers on navigating using the Link component for transitions and the useRouter hook for programmatic navigation. Note that components using hooks like useRouter must be declared as Client Components using the 'use client' directive.6State Management: Outline implementation using the special files: loading.js (Suspense), error.js (must be a client component), and not-found.js (custom 404 page).7SEO/Optimization: Require using the export const metadata = {} or generateMetadata() convention in the App Router for SEO metadata. Mandate strategic utilization of SSR, SSG, and ISR, along with Image and Font Optimization.
implementation.md
This document outlines the foundational guidelines and standard operating procedures (SOPs) for setting up and maintaining the Next.js application codebase using the App Router. Adhering to these guidelines ensures code consistency, type safety, performance optimization, and maintainability.
1. Codebase Setup and Consistency
The project will use the Next.js App Router for all new development. The App Router is designed to leverage modern React features, such as Server Components, and provides improved structure and performance.
Project Organization:
- Structure: We utilize a logical and consistent file/folder structure. The primary application logic resides within the
app/directory. We may optionally use asrc/folder to separate application code from project configuration files. - Colocation: Favor colocation, grouping related components, logic, and tests within their respective route directories where it makes sense. Files placed within a route segment folder that are not special files (
page.js,route.js, etc.) are safe to be colocated without accidentally becoming routable. - Utility Folders: Use private folders (prefixed with an underscore, e.g.,
_utils,_components) for storing utility functions and shared components, although colocation generally ensures non-routability.
2. Type Safety and Development Tooling
Mandate the use of TypeScript for improved code quality, type safety, and better developer experience.
2.1 TypeScript Configuration
Next.js provides built-in TypeScript support. When configuring or verifying the project setup:
-
Enforce TypeScript: All application files must use
.tsor.tsxextensions. -
Include Generated Next.js Types: To maintain type validation, especially for features like statically typed links, developers must ensure the generated Next.js types are included in the
tsconfig.jsonfile.- Verify that
.next/types/**/*.tsis present in theincludearray oftsconfig.json:
json1// tsconfig.json excerpt2{3 "include": [4 "next-env.d.ts",5 ".next/types/**/*.ts", // This is required for generated types6 "**/*.ts",7 "**/*.tsx"8 ],9 "exclude": ["node_modules"]10} - Verify that
2.2 Tooling
Configure essential tooling such as ESLint for code linting and Prettier for consistent code formatting.
3. Styling and Component Implementation
3.1 Styling Strategy
The primary styling strategy is the utility-first philosophy of Tailwind CSS. Tailwind CSS works by scanning HTML files and components for class names and generating corresponding styles.
Supported styling methods within the application include:
- Tailwind CSS: Preferred method using utility classes.
- CSS Modules: Supported for scoped component styles.
- Global CSS: Used for defining base styles and configuration.
3.2 Component Implementation (shadcn/ui)
We will utilize shadcn/ui for high-quality, accessible components.
- Open Code Philosophy: Unlike traditional component libraries installed via NPM, shadcn/ui operates on an Open Code philosophy. Developers are handed the actual component code (distributed via a CLI).
- Customization: This approach provides full control to customize and extend components directly, making it unnecessary to wrap components or write workarounds to override styles.
- Composition: All shadcn/ui components are designed to be composable and share a common, predictable interface, promoting system consistency.
- Installation: Components are added using the command-line tool (
npx shadcn@latest add <component>).
4. Routing Implementation
The Next.js App Router uses a file-system-based routing system where folders define URL segments and special files like page.js (or .tsx) define the page contents.
4.1 Navigation Between Routes
Developers should use the following methods for navigation:
LinkComponent: For declarative navigation and smooth client-side transitions, use theLinkcomponent imported fromnext/link. TheLinkcomponent uses thehrefproperty to specify the navigation route.useRouterHook: Use theuseRouterhook (fromnext/navigation) for programmatic navigation, such as navigating after a button click or form submission. Programmatic navigation is typically handled using methods likerouter.push(url)orrouter.replace(url).
4.2 Client Component Directive
Crucially, any component utilizing React Hooks, including useRouter from next/navigation, must be explicitly declared as a Client Component.
- This declaration is achieved by adding the
'use client'directive at the top of the file, before any import statements.
5. State Management and Error Handling
The App Router provides dedicated special files for managing loading states, errors, and unhandled routes, utilizing React Suspense and Error Boundaries.
| Special File | Purpose | Requirement/Context |
| :--- | :--- | :--- |
| loading.js / .tsx | Shows a loading indicator or skeleton UI for a route segment. | Automatically wraps the component in a <Suspense> boundary. This UI triggers when an asynchronous request is detected. |
| error.js / .tsx | Catches unexpected runtime errors within a route segment or its children. | The exported React component must be a Client Component and include the 'use client' directive at the top. |
| not-found.js / .tsx | Defines a custom UI for unmatched routes, serving as a custom 404 page. | This special file must export a React component. It can also be invoked programmatically using notFound(). |
6. SEO and Performance Optimization
All pages must prioritize SEO and performance optimizations.
6.1 SEO Metadata
In the Next.js App Router, metadata handling utilizes specific conventions.
- Requirement: For defining SEO metadata, developers must use the
export const metadata = {}object or thegenerateMetadata()function. - Content: Each page must include essential metadata such as
title,meta description, Open Graph tags (e.g.,og:title,og:image), and Twitter Card tags.
6.2 Strategic Rendering and Data Fetching
Mandate the strategic utilization of server-side rendering (SSR), static site generation (SSG), and incremental static regeneration (ISR) based on content dynamism.
In the App Router, data fetching uses the standard fetch API and Async React Server Components. Next.js manages caching and rendering based on fetch options:
| Rendering Type | Next.js App Router Data Fetching equivalent | fetch Options |
| :--- | :--- | :--- |
| Static Site Generation (SSG) | Cached until manually invalidated (similar to getStaticProps). | cache: 'force-cache' (default) |
| Incremental Static Regeneration (ISR) | Cached with a specific lifetime (similar to getStaticProps with revalidate). | next: { revalidate: N } |
| Server-Side Rendering (SSR) | Refetched on every request (similar to getServerSideProps). | cache: 'no-store' |
6.3 Optimization Assets
- Image Optimization: Developers must integrate the Next.js Image component and optimize image assets for faster loading times.
- Font Optimization: Utilize Next.js Font Optimization to improve web performance.
testing.md
text1Draft the testing.md file defining the Quality Assurance strategy. Specify the integration of a robust testing framework such as Jest and React Testing Library as development dependencies. Detail the need for a clear testing strategy encompassing unit, integration, and end-to-end tests. Establish the mandatory requirement for Code Coverage reporting to ensure adequate test coverage is maintained. Ensure the plan requires testing critical Next.js features, including:23Functionality of all major route types (Static, Dynamic, Nested, Parallel).4Validation of programmatic navigation using the useRouter hook methods (push, replace, prefetch).5Confirmation that the specialized files, error.js and not-found.js, correctly intercept and display expected errors and 404 states.
testing.md:
Quality Assurance Strategy
1. Quality Assurance Strategy Overview
The Quality Assurance strategy mandates the integration of robust testing practices throughout the development lifecycle to ensure the scalability, reliability, and maintainability of the Next.js application. This strategy requires a tiered approach to testing, encompassing unit, integration, and end-to-end (E2E) tests.
2. Testing Framework and Dependencies
A robust testing framework must be integrated to facilitate comprehensive quality assurance.
2.1 Development Dependencies
The following tools shall be included in the project's devDependencies to establish a standard testing environment:
| Tool | Purpose | Source Support |
| :--- | :--- | :--- |
| Jest | Primary JavaScript testing framework. | Found listed in devDependencies as jest and related configurations (@types/jest, jest-environment-jsdom). |
| React Testing Library (RTL) | Utility for testing React components, focusing on user experience. | Found listed in devDependencies as @testing-library/react and @testing-library/jest-dom. |
2.2 Code Coverage Requirement
It is a mandatory requirement to set up and maintain code coverage reporting. Code coverage tracking must be implemented (e.g., using a service like Codecov) to monitor and ensure adequate test coverage is consistently maintained across the application.
3. Testing Strategy: Levels of Testing
A clear testing strategy must be established, partitioning testing efforts into three primary categories:
- Unit Tests: Focus on testing individual components and utility functions in isolation. For Next.js development, this includes ensuring modularity and reusability of components and logic.
- Integration Tests: Focus on verifying how different parts of the application interact, such as testing data flow between components or verifying component interactions with API mock layers.
- End-to-End (E2E) Tests: Focus on validating complete user flows from start to finish, simulating a user’s interaction with the entire application.
4. Critical Next.js Feature Testing Requirements
Given the reliance on the Next.js App Router, specific testing must be performed to confirm the correct functionality of core routing and error handling conventions.
4.1 Route Types Functionality Testing
Testing must confirm the correct behavior and accessibility of all major file-system routing patterns:
| Route Type | Next.js Convention | Testing Requirement | Source Support |
| :--- | :--- | :--- | :--- |
| Static Routes | Defined by directories containing a page.js or .tsx file (e.g., /app/page.js or /app/blog/page.js). | Validate that standard, non-dynamic paths resolve correctly and display the expected content. | |
| Dynamic Routes | Defined using folders enclosed in square brackets (e.g., [slug]). | Verify that dynamic segments resolve correctly and that the page component receives the necessary parameters (params prop) to render content based on the route segment value. | |
| Nested Routes | Created by nesting folders under the app/ directory (e.g., app/about/form/page.js). | Confirm that the nested URL structure is correctly mapped to the corresponding directory structure and that layouts are inherited or scoped correctly. | |
| Parallel Routes | Defined using named slots (@folder convention) and rendered simultaneously within the parent layout.js file. | Verify that pages defined in parallel route slots (@growth, @revenue) render correctly when accessed via the parent route (e.g., /dashboard). Also, confirm that these slots are not directly accessible as URL segments (e.g., /dashboard/@growth should not be a route). | |
4.2 Programmatic Navigation Validation
Tests must validate the functionality of programmatic navigation using the useRouter hook, which allows changing routes without the Link component:
router.push(url): Validate that this method handles client-side transitions and adds a new entry to the browser history stack, as intended for standard navigation.router.replace(url): Validate that this method performs navigation without adding a new entry to the history stack (similar to thereplaceprop onnext/link), preventing the user from navigating back to the previous page using the browser back button.router.prefetch(url): Validate that this method successfully prefetches the necessary resources for the target URL to ensure faster client-side transitions, particularly useful for non-standard navigations.
4.3 Specialized File Functionality Confirmation
Tests must confirm that special Next.js files correctly handle application errors and missing routes, which are critical aspects of error handling:
error.js(Runtime Errors): Confirm that the presence of anerror.jsfile at a route segment correctly intercepts runtime errors occurring within that segment or its children. Verification must include ensuring theerror.jscomponent is correctly defined as a client component using the'use client'directive.not-found.js(404/Missing Routes): Confirm thatnot-found.jscorrectly intercepts and displays the expected UI when an unmatched route is visited. Furthermore, tests should confirm that invoking thenotFound()function programmatically stops rendering the current segment and triggers the nearestnot-found.jsfile.
security.md
Draft the security.md file addressing key concerns for a Next.js application. Outline secure practices for handling API keys, tokens, and sensitive data. Mandate the clear definition and management of Environment Variables for different stages (development, production) using .env files. Highlight the security benefit of using React Server Components (RSC) for data fetching, as this allows direct, safe execution of sensitive operations (like database queries) on the server, preventing credentials from leaking to the client. Require the integration of robust Authentication and Authorization mechanisms, noting that features like NextAuth.js and Middleware are common components for protecting dashboard pages.
security.md
This document outlines the mandatory security practices and architecture considerations for securing this Next.js application, focusing on handling sensitive data, environment configuration, and authorization controls.
1. Handling Sensitive Information
It is mandatory to implement secure practices for handling API keys, tokens, and sensitive data. These credentials must never be exposed directly in client-side code, and their storage and access should adhere strictly to the guidelines for environment variables and server-side operations outlined below.
2. Environment Variable Management
All sensitive configuration data, such as API keys and database URLs, must be managed using Next.js Environment Variables.
Mandates for Environment Variables:
- Clear Definition and Management: Environment variables (e.g., API keys, database URLs) must be clearly defined and managed.
- Staging Differentiation: Variables must be segmented based on the application stage (development, staging, production).
- Use of
.envFiles: Next.js utilizes specific top-level files to define environment variables for different stages:.env: General environment variables..env.local: Local environment variables..env.production: Production environment variables..env.development: Development environment variables.
- Type Safety (Recommended): If TypeScript is enabled, Next.js can generate types for loaded environment variables during development for improved IntelliSense. Note that types are generated based on variables loaded at development runtime, excluding variables from
.env.production*files unless the development server is run withNODE_ENV=production.
3. Leveraging React Server Components (RSC) for Data Security
The Next.js App Router utilizes React Server Components (RSC). This architecture provides a crucial security benefit for data fetching:
- Safe Server-Side Execution: Next.js recommends fetching all data on the server via RSCs or Route Handlers.
- Preventing Credential Leakage: Because React Server Components (RSC) execute directly on the server, sensitive operations—such as direct database calls—can be safely performed. This prevents credentials or secrets from leaking to the client, thereby removing the necessity of using an intermediary API Route (Route Handler) to hide secrets when performing data fetching.
- Direct Data Fetching: RSCs enable developers to use
async/awaitandfetchdirectly within the component for data retrieval on the server.
4. Authentication and Authorization
The application must integrate robust Authentication and Authorization mechanisms to protect specific routes and resources.
Requirements:
- Protected Routes: Features like dashboard pages must be protected by authentication.
- Middleware Integration: Middleware (
middleware.ts) is a required component for authorization logic. Middleware can inspect incoming requests and implement logic (such as checking for session tokens) before a request is completed. - Authentication Framework: Features like NextAuth.js are common components used in conjunction with Middleware to enforce protected routes.
- Redirection: If a user is unauthenticated or unauthorized for a page, they must be programmatically redirected (e.g., using
router.push('/login')).
sop.md
text1Draft the sop.md (Standard Operating Procedures) file detailing the required operational workflow and code management standards for the project.23Version Control: Specify the utilization of Git with a clear branching strategy (e.g., Gitflow or GitHub Flow).4Code Quality Enforcement: Establish the use of Husky and Lint-Staged to run linters and formatters (ESLint, Prettier) on staged files automatically before committing.5Development Structure: Enforce adherence to the Next.js Project Structure, including the recommendation to use the optional src/ directory to separate application code from configuration files.6Deployment: Define the CI/CD Pipeline using services like GitHub Actions or Vercel for automated builds, testing, and deployment.7Documentation Maintenance: Stipulate the required project documentation: a comprehensive README.md, clear Contributing Guidelines, and consistent maintenance of the Architecture Documentation.8Next.js Utility Usage: Document the correct use of navigation elements, specifically reserving the native anchor tag (<a/>) for external links, and using the Next.js Link component for internal application navigation.
sop.md:
Standard Operating Procedures and Code Management Standards
This document outlines the required operational workflow and code management standards for this project, ensuring consistency, maintainability, and quality across all development phases.
1. Version Control and Branching Strategy
All source code must be managed using Git.
1.1. Platform: The official project repository is hosted on GitHub. 1.2. Branching Strategy: The project must establish and adhere to a clear branching strategy. Developers must choose and follow either the Gitflow or GitHub Flow model for managing code versions and collaboration.
2. Code Quality Enforcement
To ensure adherence to consistent coding standards and enhance code quality, automated tooling must be configured and enforced.
2.1. Linters and Formatters:
- ESLint must be configured for code linting.
- Prettier must be configured for consistent code formatting.
2.2. Pre-commit Hooks:
- Husky and Lint-Staged must be implemented to establish pre-commit hooks.
- These hooks will automatically run configured linters and formatters (ESLint, Prettier) on staged files before a commit is finalized. This process prevents inconsistent or poorly formatted code from entering the repository.
2.3. Type Safety:
- TypeScript must be integrated for improved code quality, type safety, and a better developer experience.
3. Development Structure
The project structure must adhere to Next.js conventions, prioritizing organization and code discoverability.
3.1. Next.js App Router Structure:
- The project utilizes the Next.js App Router.
- Routes are determined by directory names, and a route is made publicly accessible when a
page.js(or.ts/.tsx) orroute.jsfile is added to a route segment.
3.2. Source Directory (src/):
- It is highly recommended that the optional
src/directory be used to house the application code (including theapp/directory). - Utilizing the
src/directory helps separate application code from project configuration files (which typically reside in the root directory).
3.3. Modularity and Co-location:
- Components and utility functions must be designed to be modular and reusable to promote code reusability.
- Practice co-location by grouping related files and components together, especially within route segments in the
appdirectory, where non-routable files are safe from public access.
4. Deployment
A robust CI/CD pipeline must be configured to automate the process of building, testing, and deploying the application.
4.1. CI/CD Pipeline Services:
- A Continuous Integration/Continuous Deployment (CI/CD) pipeline must be configured using services such as GitHub Actions or Vercel.
- This pipeline will ensure automated builds, tests, and deployment.
4.2. Deployment Platform:
- The application should be deployed on Vercel.
5. Documentation Maintenance
Comprehensive documentation is required for project maintenance and onboarding new developers.
5.1. README.md:
- A comprehensive
README.mdmust be maintained. - It must include clear instructions for project setup, development, testing, and deployment.
5.2. Contributing Guidelines:
- Clear Contributing Guidelines must be established to streamline the process for new developers joining the project.
5.3. Architecture Documentation:
- Key architectural decisions and system design must be consistently documented.
6. Next.js Utility Usage: Navigation Standards
All navigation within the application must follow Next.js best practices for performance and clarity.
6.1. Internal Navigation:
- For navigation between internal routes or pages within the Next.js application, developers must use the Next.js
Linkcomponent (imported fromnext/link). - The
Linkcomponent is the best option for navigating routes, as it enables client-side navigation with built-in optimizations like prefetching.
6.2. External Navigation:
- The native anchor tag (
<a/>) must be reserved exclusively for linking and navigating to a page that is external to the application, or for invoking specific non-navigation functions.
6.3. Programmatic Navigation:
- If programmatic route changes are necessary (e.g., triggering navigation upon a button click), the
useRouterhook (fromnext/navigationin the App Router) should be utilized. - The
useRouterhook allows access to methods likerouter.push()to navigate programmatically. Note thatwindow.locationis better suited for external URLs rather thanrouter.push.
Polishing the Project Documents
Now I can simply run a command in your IDE of choice like and copy/paste the contents we have generated:
text1mkdir docs2touch docs/ai_guidelines.md3touch docs/requirements.md4touch docs/architecture.md5touch docs/implementation.md6touch docs/testing.md7touch docs/security.md8touch docs/sop.md
Now that I have all of these files in our directory and we are in the IDE we can start using CLIne or whichever AI-assistant you are using to help us build out the project.
Before we begin we can give each of these documents a polish by simply editing them all at the same time! That's right, we are going to vibe context engineer, I know context engineering is not just getting together documents to vibe code and that it involves a lot more, but for our purposes that is what I will call it.
First I am going to write a prompt in order to write out prompt for CLIne so that CLIne will go and edit all of our documents.
You are the best software eningeer in the world and your goal is to draft a CLIne prompt which will edit the following documents for the purpose of filling in context for CLIne to later code a project. So the prompt will instruct for a deliverable of another prompt except this one is for CLIne to edit the files which will then fill in the context for the project. Reference https://github.com/kliewerdaniel/workflow.git for the description of what each of the files is meant to be used for.
I used chatGPT for this and got the following prompt which I am feeding to chatGPT again to get our document editing prompt for CLIne.
text1You are a documentation editor and context‐gathering assistant working as part of a structured AI-assisted development workflow.2Your task is to edit, enhance, and fill in missing context across the following markdown files: ai_guidelines.md, requirements.md, architecture.md, implementation.md, testing.md, security.md, and sop.md.34For each file:5 1. Ensure the purpose of the file is clearly stated (based on the workflow repository’s description). 6 2. Insert placeholders or tables for project-specific information (project name, domain, stakeholders, personas, technologies, constraints, business objectives, non-functional requirements, security/risk assumptions, deployment environments, KPIs, etc.).7 3. Ask clarifying questions in the document (via “TODO” or “**?”” markers) where context is missing—so we can later fill them in.8 4. Ensure each section aligns with standards defined in the standards.md (or if no explicit standards exist yet, create a “Standards” sub-section with prompts for what the standards should cover).9 5. Cross-link between docs: e.g., link user-stories in requirements.md to components in architecture.md; link testing strategies in testing.md to features in implementation.md; reference deployment pipelines in deployment.md that assume architecture decisions from architecture.md, etc.10 6. Maintain a consistent flavour and style across all docs: use markdown headings, bullet lists, tables where helpful, and mark items clearly as “Must / Should / Could / Won’t” where applicable.11 7. Annotate any area that will later require code generation or AI prompt generation (for the later CLine coding phase) — e.g., in prompts.md, add a section “Prompt templates for CLine coding” with placeholders like [COMPONENT_NAME], [API_ENDPOINT], [TEST_SCENARIO], etc.1213Deliverable: A single merged prompt (for CLine) that instructs it to perform the editing/enrichment for all the files listed above, with clear ordering, scope, how to handle each file, what to fill in, where to ask questions, and how to prepare the project context so that the next phase (coding) is well-supported.1415Important: This prompt is not the coding phase — it’s purely the editing and context-filling phase. It should make clear to CLine the difference, and that once this is done, we will move to code generation.1617Be concise but thorough in your instruction: define the sequence in which files should be processed (typically: ai_guidelines → requirements → architecture → implementation → testing → security→ sop), how cross-linking is to be done, and what output format (markdown) is expected (overwriting or creating “filled-in” versions, while keeping original commentary sections for later review).1819Also instruct CLine to output a summary at the end listing which questions (context gaps) remain unanswered (so we can fill them manually).2021Deliver your prompt now.
This is the prompt we will give to CLIne to polish our documents:
text1✅ CLine Prompt — Documentation Editing & Context Preparation Phase23You are an AI documentation editor and context-gathering assistant working within a structured AI-assisted development workflow.45Your task is to edit, enhance, and fill in context across the following markdown files in this repository:6ai_guidelines.md, requirements.md, architecture.md, implementation.md, testing.md, security.md, and sop.md.78This phase is NOT for coding or implementation. It is only for editing documentation and gathering project context so future prompts can generate code.910⸻1112📂 Processing Order1314Process the files in this order:15 1. ai_guidelines.md16 2. requirements.md17 3. architecture.md18 4. implementation.md19 5. testing.md20 6. security.md21 7. sop.md2223⸻2425📌 For Each File — Apply the Following Instructions2627For every file listed above:2829✅ 1. Declare Purpose30 • At the top of each file, clearly state its purpose based on the workflow repository’s intent.3132✅ 2. Insert Context Placeholders & Tables3334Add missing context using markdown tables or placeholder sections for information such as:3536Field Description37Project Name TODO:38Domain / Industry TODO:39Stakeholders TODO:40Personas / Users TODO:41Technologies / Frameworks TODO:42Business Objectives TODO:43Functional Requirements TODO:44Non-functional Requirements TODO:45Constraints TODO:46Deployment Environments TODO:47Metrics / KPIs TODO:48Security / Risk Assumptions TODO:4950✅ 3. Ask Clarifying Questions5152Where context is missing, insert in-line prompts using:53 • TODO:54 • **?** next to the missing information or unclear sections.5556✅ 4. Align with Standards57 • If standards.md exists, ensure language/structure matches it.58 • If no standards apply, add a placeholder section:5960### Standards Alignment61TODO: Define how this document should follow standards for formatting, naming, architecture, security, testing, and documentation.6263✅ 5. Cross-Link Relevant Documentation64 • In requirements.md, link each user story to system components in architecture.md.65 • In architecture.md, reference implementation strategy in implementation.md.66 • In testing.md, link each test scenario to requirements and implemented features.67 • In security.md, reference risks related to architecture decisions.68 • In sop.md, reference implementation and deployment flows.6970Use relative markdown links, e.g.:71See [Component A](architecture.md#component-a)7273✅ 6. Consistent Formatting & Style74 • Use clear headings (##, ###, etc).75 • Use bullet points and tables for clarity.76 • Use MoSCoW format (Must / Should / Could / Won’t) for priority lists.7778✅ 7. Mark Sections Needed for Future Code Generation7980Add placeholders for future use during coding phase, e.g.:8182### Prompt Templates for CLine Coding (To be used later)83- Implement [COMPONENT_NAME] that connects to [API_ENDPOINT]84- Generate unit tests for [FEATURE]85- Create service for [DATA_MODEL]868788⸻8990📤 Output Requirements91 • Overwrite each markdown file with the enhanced/document-ready version.92 • Preserve original content where it is useful, but reorganize for clarity.93 • Add new sections, tables, placeholders, and TODO questions where needed.94 • At the end of the process, generate a summary file or console output listing:95 • All unanswered questions (TODOs / ?)96 • Files updated97 • Sections requiring manual input9899⸻100101⚠️ Reminder102103This prompt is only for documentation refinement and context collection. Do not write code or implementation logic yet.104Once documentation is complete, a separate prompt will initiate the coding phase.105106⸻107108Begin editing the documents now.109Output summaries and unanswered context questions once complete.
I am using vanilla VSCode for this with the CLIne extension using their free access to grok for sesssion.

The final edited files you can find in the repo under the documents directory. It even was nice enough to output a documentation-summary.md I have included below.
text1# Documentation Enhancement Summary23This summary provides an overview of the documentation editing and context preparation phase for the Next.js boilerplate project.45## Files Updated67All 7 markdown files in the `docs/` directory have been enhanced with standardized sections, context tables, cross-links, and placeholders for future AI coding prompts:89- ai_guidelines.md10- requirements.md11- architecture.md12- implementation.md13- testing.md14- security.md15- sop.md1617## Key Enhancements Applied1819### 1. Purpose Declaration20Each file now starts with a clear statement of its purpose in the project workflow.2122### 2. Project Context Table23Standardized context tables added to all files with fields like:24- Project Name25- Domain / Industry26- Stakeholders / Personas / Users27- Technologies / Frameworks28- Business Objectives29- Functional / Non-functional Requirements30- Constraints31- Deployment Environments32- Metrics / KPIs33- Security / Risk Assumptions3435### 3. Clarifying Questions and Placeholders36Embedded TODO: and ? markers where context needs specification or clarification.3738### 4. Standards Alignment Sections39TODO sections added for future definition of how each document follows standards for formatting, naming, architecture, security, testing, and documentation.4041### 5. Cross-Linking Documentation42- Requirements links to testing scenarios and implemented features.43- Architecture links to implementation strategies.44- Testing links to requirements and implementation.45- Security links to architecture decisions and SEO practices.46- SOP links to implementation and deployment flows.4748### 6. Consistent Formatting49- MoSCoW prioritization in requirements.50- Bullet points and tables for clarity.51- Clear headings and subheadings.5253### 7. Future Code Generation Templates54Added "Prompt Templates for CLine Coding" sections with specific prompts for implementing features later, such as:55- Route structures and components56- Authentication and security features57- Testing configurations58- Deployment setups5960## Unanswered Questions and TODO Items6162### ai_guidelines.md63- Business Objectives: TODO64- Functional Requirements: TODO (in context table)65- Non-functional Requirements: TODO66- Deployment Environments: TODO: Production servers, CI/CD pipelines67- Metrics / KPIs: TODO (in context table)68- Security / Risk Assumptions: TODO (in context table)69- Standards Alignment: TODO: Define how this document should follow standards...7071### requirements.md72- Functional Requirements: TODO: Define user stories and features (in context table)73- Metrics / KPIs: TODO: Page load times, error rates (in context table)74- Security / Risk Assumptions: TODO: Secure data handling, authentication needs (in context table)75- Standards Alignment: TODO: Define how this document should follow standards...7677### architecture.md78- Standards Alignment: TODO: Define how this document should follow standards...7980### implementation.md81- Standards Alignment: TODO: Define how this document should follow standards...8283### testing.md84- Standards Alignment: TODO: Define how this document should follow standards...8586### security.md87- Standards Alignment: TODO: Define how this document should follow standards...8889### sop.md90- Standards Alignment: TODO: Define how this document should follow standards...9192## Sections Requiring Manual Input93941. **Standards Definition**: All files have placeholders for defining adherence to external standards (formatting, naming, architecture, security, testing, documentation). If a `standards.md` file exists or will be created, reference it here.95962. **Detailed Functional Requirements**: The requirements.md file has a placeholder for defining specific user stories and features. Manual input needed to expand beyond the current high-level MoSCoW items.97983. **Metrics and KPIs**: Several tables have TODO items for specific measurable goals (e.g., page load times, test coverage percentages, deployment frequency).991004. **Security Risk Assumptions**: TODO items for specific risks and assumptions in requirements, architecture, and other files.1011025. **Business Objectives**: Some files have TODO for specific business objectives beyond the generic descriptions.1031046. **Deployment Environments**: Specific environments (development, staging, production) need detailed specification.105106## Next Steps107108Once this documentation phase is complete, a separate coding phase can begin using the AI coding prompts and context established here. The enhanced documentation provides a solid foundation for consistent, standards-aligned development across all project domains: requirements, architecture, implementation, testing, security, and operations.109110All documents are now prepared as "document-ready" versions with embedded context and cross-references to ensure future AI-generated code adheres to the established guidelines.
Drafting the Final CLIne Prompt
We are getting close to being ready to start coding.
Now what we need to do is write a prompt which will generate our FINAL prompt to CLIne. With this prompt we are hoping to get this with just one prompt.
For this mega prompt I use Anthropic to draft it. I think they provide the most detail but I can usually only get one good prompt out before it cuts off free access. That is why I don't just use one service but several in order to never have to pay.
I use the app to use Claude and have install a bunch of MCP servers as well as hooked up my github. This allows you to easily reference files.

Before I ask Claude I am going to formulate the prompt for it carefully and expand on the following prompt with chatGPT.
text1I want you to write a prompt for an LLM which will generate a prompt for CLIne, take what you know. You are a senior software engineer and you are building a prompt for CLIne. What you are doing is using the context in the docs folder to guide CLIne as it goes along with the coding process. The first thing you should tell CLIne to do is to create a checklist.md file in the docs folder to act as a ledger for CLIne to keep track of its progress but also for observability.23The overall goal for CLIne is to output the absolute very best boilerplate repo for next.js using all of the context in the docs folder. I want you to think of everything CLIne has to offer and to think of all of the intricacies to software development and I want you to know that you have all of the files in the docs folder to help you code this project. This is the CLIne prompt which will build the next.js boilerplate repo as outlined in the docs folder.
That gives us our prompt to give to Claude. I only expanded it because I usually only get one good generation a day for free wtih Claude and I insiste on not paying.
text1You are a senior software engineer designing a prompt for CLine to build a Next.js boilerplate repo.23Your goal: produce a single prompt that instructs CLine to:4 1. Create a new docs/checklist.md inside the docs folder. This file will act as a progress ledger/observability guide for CLine: each major step, sub-task, status, and link back to the docs context must be tracked here.5 2. Use all of the context found in the existing docs folder (ai_guidelines.md, requirements.md, architecture.md, implementation.md, testing.md, security.md, sop.md, etc) to inform the structure, architecture, tooling, conventions, and deliverables of the boilerplate.6 3. Produce a Next.js repository incorporating best practices and boilerplate parameters (folder structure, TypeScript support, linting, formatting, CI/CD, testing, deployment, security hardening, observability, performance, etc). Use referenced best-practice sources as guidance.7 4. Maintain traceability between docs context and code structure: e.g., link from requirements to implemented components, architecture decisions to folder/file naming, testing strategies to code coverage setup, deployment instructions to folder layout.8 5. Use the checklist.md as a continuous ledger: for each step (init repo, set up TypeScript, set up lint/prettier, create folder structure, create sample component, wiring CI/CD, create tests, set up security config, set up observability/monitoring, create README, etc) mark status (“Not Started / In Progress / Done”), timestamp, docs references, and next actions.9 6. Ensure the overall boilerplate is absolutely best-in-class: incorporate modern patterns (for example, TypeScript, Next.js App Router or Pages Router as appropriate, modular folder structure, environment management, performance optimization) as hinted by best-practice sources. 10 7. At the end of the generated prompt, tell CLine explicitly how to output:1112 • Create the docs/checklist.md file and update it as it works.13 • Commit code / files in the repository according to each checklist entry.14 • Provide the created boilerplate repo in a zipped format (or push instructions) once checklist is complete.1516Important: The prompt you generate for CLine should itself be clear, step-by-step, numbered, and quote placeholders like [PROJECT_NAME], [TECH_STACK], [DEPLOYMENT_TARGET] etc so that the next phase is parameterized. It should define the sequence of tasks CLine must follow, and reference the docs context at each step.1718Deliverables:19 • The prompt that you’ll feed to CLine.20 • Ensure that prompt tells CLine to create the docs/checklist.md ledger first.21 • Ensure that prompt defines how the docs folder context influences the code generation.2223Remember: This is the prompt-generation phase (you’re generating a prompt for CLine), not the code-generation phase itself.2425Output now the full prompt for CLine.
Now we have the one and final prompt hopefully for our project. As you can see this prompt does not even have a lot of the details we need to get started since we have supplied all of that in our docs folder.
CLine Prompt: Next.js Boilerplate Repository Creation with Observability Ledger
You are an expert software engineer tasked with creating a production-ready Next.js boilerplate repository. This boilerplate must adhere strictly to all guidelines, requirements, architecture patterns, implementation standards, testing strategies, security practices, and operational procedures documented in the existing docs/ folder.
Project Parameters
- PROJECT_NAME:
[nextjs-boilerplate](replace with actual project name) - TECH_STACK: Next.js (App Router), React 18+, TypeScript, Tailwind CSS, shadcn/ui
- DEPLOYMENT_TARGET:
[Vercel](replace with target platform) - NODE_VERSION:
v18.18.0or later - REPOSITORY_HOST:
[GitHub](replace with Git hosting platform)
Phase 0: Initialize Observability Ledger (CRITICAL FIRST STEP)
Before any code generation begins, you must create docs/checklist.md as your progress tracking and observability ledger.
Step 0.1: Create Checklist Structure
Create docs/checklist.md with the following structure:
markdown1# Next.js Boilerplate - Implementation Checklist & Progress Ledger23## Purpose4This document tracks the implementation progress of the Next.js boilerplate repository, ensuring full traceability between documentation context and actual code deliverables.56## Legend7- ⬜ Not Started8- 🟡 In Progress9- ✅ Done10- ❌ Blocked/Issue1112## Progress Overview13| Phase | Status | Progress | Last Updated |14|-------|--------|----------|--------------|15| Phase 0: Ledger Setup | 🟡 | 0% | [TIMESTAMP] |16| Phase 1: Repository Initialization | ⬜ | 0% | - |17| Phase 2: Core Framework Setup | ⬜ | 0% | - |18| Phase 3: Type Safety & Tooling | ⬜ | 0% | - |19| Phase 4: Styling & UI Components | ⬜ | 0% | - |20| Phase 5: Project Structure | ⬜ | 0% | - |21| Phase 6: Routing Implementation | ⬜ | 0% | - |22| Phase 7: Data Fetching & State | ⬜ | 0% | - |23| Phase 8: Testing Infrastructure | ⬜ | 0% | - |24| Phase 9: Security Hardening | ⬜ | 0% | - |25| Phase 10: CI/CD Pipeline | ⬜ | 0% | - |26| Phase 11: Performance & SEO | ⬜ | 0% | - |27| Phase 12: Documentation | ⬜ | 0% | - |28| Phase 13: Final Validation | ⬜ | 0% | - |2930---3132## Detailed Task Tracking3334[Task sections will be populated as you progress through each phase]
Step 0.2: Update Ledger After Each Task
After completing each task in subsequent phases:
- Update the task status (⬜ → 🟡 → ✅)
- Add timestamp
- Link to relevant docs context
- Note any deviations or decisions made
- List next actions
Commit the checklist after every major milestone.
Phase 1: Repository Initialization
Docs Context References:
docs/sop.md(Section 1: Version Control)docs/requirements.md(Section 1: System Prerequisites)
Task 1.1: Initialize Git Repository ⬜
Action Steps:
- Initialize a new Git repository
- Create
.gitignorefor Next.js (node_modules, .next, .env.local, etc.) - Set up initial branch structure (main/develop based on chosen Git Flow strategy)
Docs Traceability:
- Reference:
docs/sop.md- Section 1.2 Branching Strategy - Requirement: Git-based version control with GitHub hosting
Checklist Update:
markdown1### Task 1.1: Initialize Git Repository ✅2- **Status**: Done3- **Timestamp**: [YYYY-MM-DD HH:MM]4- **Docs Reference**: docs/sop.md#version-control5- **Deliverables**:6 - ✅ .git folder initialized7 - ✅ .gitignore created8 - ✅ main branch established9- **Commit**: `git commit -m "chore: initialize repository with .gitignore"`10- **Next Action**: Task 1.2
Task 1.2: Initialize Next.js Project ⬜
Action Steps:
- Run
npx create-next-app@latest [PROJECT_NAME]with following selections:- ✅ TypeScript
- ✅ ESLint
- ✅ Tailwind CSS
- ✅ App Router (MANDATORY per docs/ai_guidelines.md Section 1.1)
- ✅ src/ directory (recommended per docs/sop.md Section 3.2)
- ❌ Turbopack (optional, evaluate based on stability)
- Verify Node.js version requirement (v18.18.0+)
Docs Traceability:
- Reference:
docs/ai_guidelines.md- Section 1: Core Framework - Reference:
docs/requirements.md- Section 2: Core Application Framework - Requirement: Exclusive use of App Router
Checklist Update: Add completion details, timestamp, commit reference
Task 1.3: Configure Package.json ⬜
Action Steps:
- Update project metadata (name, version, description, author)
- Add custom scripts:
json1{2 "scripts": {3 "dev": "next dev",4 "build": "next build",5 "start": "next start",6 "lint": "next lint",7 "lint:fix": "next lint --fix",8 "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",9 "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,md}\"",10 "test": "jest",11 "test:watch": "jest --watch",12 "test:coverage": "jest --coverage",13 "type-check": "tsc --noEmit",14 "prepare": "husky install"15 }16}
Docs Traceability:
- Reference:
docs/sop.md- Section 2: Code Quality Enforcement - Reference:
docs/testing.md- Section 2: Testing Framework
Checklist Update: Track completion and commit
Phase 2: Core Framework Setup
Docs Context References:
docs/ai_guidelines.md(Section 1.2: RSC Requirement)docs/architecture.md(Section 1: Routing Architecture)
Task 2.1: Configure Next.js Config ⬜
Action Steps:
- Create/update
next.config.tswith mandatory settings:typescript1import type { NextConfig } from 'next'23const nextConfig: NextConfig = {4 typedRoutes: true, // MANDATORY per docs/ai_guidelines.md Section 2.15 reactStrictMode: true,6 // Add other configuration as needed7}89export default nextConfig
Docs Traceability:
- Reference:
docs/ai_guidelines.md- Section 2.1: Statically Typed Links - Requirement:
typedRoutes: truemust be enabled
Checklist Update: Mark complete with config snippet reference
Task 2.2: Verify App Router Structure ⬜
Action Steps:
- Confirm
app/directory exists (orsrc/app/if using src/) - Verify default
app/layout.tsxexists - Verify default
app/page.tsxexists - Ensure Server Components are default (no 'use client' in base files)
Docs Traceability:
- Reference:
docs/ai_guidelines.md- Section 1.2: Default Component Type RSC - Reference:
docs/architecture.md- Section 1: Routing Architecture - Requirement: React Server Components as default
Checklist Update: Document structure verification
Phase 3: Type Safety & Tooling
Docs Context References:
docs/implementation.md(Section 2: Type Safety)docs/sop.md(Section 2: Code Quality)
Task 3.1: Configure TypeScript ⬜
Action Steps:
- Verify/update
tsconfig.jsonincludes generated Next.js types:json1{2 "compilerOptions": {3 "target": "ES2017",4 "lib": ["dom", "dom.iterable", "esnext"],5 "allowJs": true,6 "skipLibCheck": true,7 "strict": true,8 "noEmit": true,9 "esModuleInterop": true,10 "module": "esnext",11 "moduleResolution": "bundler",12 "resolveJsonModule": true,13 "isolatedModules": true,14 "jsx": "preserve",15 "incremental": true,16 "plugins": [{ "name": "next" }],17 "paths": {18 "@/*": ["./src/*"]19 }20 },21 "include": [22 "next-env.d.ts",23 ".next/types/**/*.ts",24 "**/*.ts",25 "**/*.tsx"26 ],27 "exclude": ["node_modules"]28} - Verify
.next/types/**/*.tsis in include array
Docs Traceability:
- Reference:
docs/implementation.md- Section 2.1: TypeScript Configuration - Requirement: Include generated Next.js types for statically typed links
Checklist Update: Track TypeScript configuration
Task 3.2: Configure ESLint ⬜
Action Steps:
- Verify
.eslintrc.jsonexists with Next.js defaults - Add custom rules if needed:
json1{2 "extends": ["next/core-web-vitals", "next/typescript"],3 "rules": {4 "@typescript-eslint/no-unused-vars": "error",5 "@typescript-eslint/no-explicit-any": "warn"6 }7}
Docs Traceability:
- Reference:
docs/implementation.md- Section 2.2: Tooling - Reference:
docs/sop.md- Section 2.1: Linters and Formatters
Checklist Update: Document ESLint configuration
Task 3.3: Configure Prettier ⬜
Action Steps:
- Create
.prettierrc.json:json1{2 "semi": false,3 "trailingComma": "es5",4 "singleQuote": true,5 "tabWidth": 2,6 "useTabs": false,7 "printWidth": 1008} - Create
.prettierignore:text1node_modules2.next3out4public
Docs Traceability:
- Reference:
docs/sop.md- Section 2.1: Linters and Formatters
Checklist Update: Track Prettier setup
Task 3.4: Setup Husky & Lint-Staged ⬜
Action Steps:
- Install dependencies:
bash1npm install --save-dev husky lint-staged
- Initialize Husky:
bash1npx husky-init && npm install
- Create
.husky/pre-commit:bash1#!/usr/bin/env sh2. "$(dirname -- "$0")/_/husky.sh"3npx lint-staged - Add to
package.json:json1{2 "lint-staged": {3 "*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],4 "*.{json,md}": ["prettier --write"]5 }6}
Docs Traceability:
- Reference:
docs/sop.md- Section 2.2: Pre-commit Hooks - Requirement: Prevent poorly formatted code from entering repository
Checklist Update: Document pre-commit hook setup
Phase 4: Styling & UI Components
Docs Context References:
docs/ai_guidelines.md(Section 3: Styling and UI)docs/implementation.md(Section 3: Styling)
Task 4.1: Verify Tailwind Configuration ⬜
Action Steps:
- Verify
tailwind.config.tsexists with proper content paths:typescript1import type { Config } from 'tailwindcss'23const config: Config = {4 content: [5 './src/pages/**/*.{js,ts,jsx,tsx,mdx}',6 './src/components/**/*.{js,ts,jsx,tsx,mdx}',7 './src/app/**/*.{js,ts,jsx,tsx,mdx}',8 ],9 theme: {10 extend: {},11 },12 plugins: [],13}14export default config - Verify
app/globals.cssincludes Tailwind directives
Docs Traceability:
- Reference:
docs/ai_guidelines.md- Section 3.1: Tailwind CSS Mandate - Reference:
docs/implementation.md- Section 3.1: Styling Strategy
Checklist Update: Verify Tailwind setup
Task 4.2: Setup shadcn/ui ⬜
Action Steps:
- Initialize shadcn/ui:
bash1npx shadcn@latest init
- Select style, color scheme, etc.
- Install initial components for demonstration:
bash1npx shadcn@latest add button2npx shadcn@latest add card3npx shadcn@latest add input
- Verify components are copied to
src/components/ui/
Docs Traceability:
- Reference:
docs/ai_guidelines.md- Section 3.2: Open Code Philosophy - Reference:
docs/implementation.md- Section 3.2: Component Implementation - Requirement: Components must be source code, not NPM packages
Checklist Update: Document shadcn/ui integration
Task 4.3: Create components.json ⬜
Action Steps:
- Verify
components.jsonwas created during shadcn/ui init - Ensure it references correct paths:
json1{2 "$schema": "https://ui.shadcn.com/schema.json",3 "style": "default",4 "rsc": true,5 "tsx": true,6 "tailwind": {7 "config": "tailwind.config.ts",8 "css": "src/app/globals.css",9 "baseColor": "slate",10 "cssVariables": true11 },12 "aliases": {13 "components": "@/components",14 "utils": "@/lib/utils"15 }16}
Docs Traceability:
- Reference:
docs/ai_guidelines.md- Section 3.2: UI Component Strategy
Checklist Update: Verify components.json configuration
Phase 5: Project Structure
Docs Context References:
docs/ai_guidelines.md(Section 4: Project Structure)docs/architecture.md(Section 2: Structural Organization)docs/sop.md(Section 3: Development Structure)
Task 5.1: Create Private Folders ⬜
Action Steps:
- Create private utility folders following underscore convention:
text1src/2├── app/3├── _components/ # Shared non-routable components4├── _lib/ # Utility functions5├── _utils/ # Helper utilities6├── _hooks/ # Custom React hooks7└── _types/ # TypeScript type definitions
Docs Traceability:
- Reference:
docs/ai_guidelines.md- Section 4.2: Private Folders - Requirement: Private folders prefixed with underscore
Checklist Update: Document folder structure
Task 5.2: Create Base App Structure ⬜
Action Steps:
- Create sample route structure demonstrating best practices:
text1src/app/2├── layout.tsx # Root layout3├── page.tsx # Home page4├── globals.css # Global styles5├── (marketing)/ # Route group6│ ├── layout.tsx7│ └── about/8│ └── page.tsx9├── dashboard/10│ ├── layout.tsx11│ ├── page.tsx12│ ├── @analytics/ # Parallel route slot13│ │ └── page.tsx14│ └── @revenue/ # Parallel route slot15│ └── page.tsx16├── blog/17│ ├── [slug]/ # Dynamic route18│ │ └── page.tsx19│ └── page.tsx20├── api/21│ └── hello/22│ └── route.ts # Route handler23├── loading.tsx # Root loading UI24├── error.tsx # Root error boundary25└── not-found.tsx # Custom 404 page
Docs Traceability:
- Reference:
docs/architecture.md- Section 1: Routing Architecture - Reference:
docs/architecture.md- Section 2: Route Groups & Parallel Routing - Requirement: Demonstrate all major routing patterns
Checklist Update: Track structure creation
Task 5.3: Create Utility Files ⬜
Action Steps:
- Create
src/_lib/utils.tswith common utilities:typescript1import { type ClassValue, clsx } from 'clsx'2import { twMerge } from 'tailwind-merge'34export function cn(...inputs: ClassValue[]) {5 return twMerge(clsx(inputs))6} - Create
src/_types/index.tsfor shared types - Create sample custom hooks in
src/_hooks/
Docs Traceability:
- Reference:
docs/ai_guidelines.md- Section 4.2: Private Folders Use Cases
Checklist Update: Document utility file creation
Phase 6: Routing Implementation
Docs Context References:
docs/requirements.md(Section 3: Routing Capabilities)docs/architecture.md(Section 1: Routing Architecture)docs/implementation.md(Section 4: Routing Implementation)
Task 6.1: Implement Root Layout ⬜
Action Steps:
- Update
src/app/layout.tsxwith proper structure:typescript1import type { Metadata } from 'next'2import { Inter } from 'next/font/google'3import './globals.css'45const inter = Inter({ subsets: ['latin'] })67export const metadata: Metadata = {8 title: 'Next.js Boilerplate',9 description: 'Production-ready Next.js boilerplate',10}1112export default function RootLayout({13 children,14}: {15 children: React.ReactNode16}) {17 return (18 <html lang="en">19 <body className={inter.className}>{children}</body>20 </html>21 )22}
Docs Traceability:
- Reference:
docs/architecture.md- Section 2.B: Nested Layouts - Requirement: Root layout wraps all pages
Checklist Update: Track root layout implementation
Task 6.2: Implement Static Routes ⬜
Action Steps:
- Create home page (
app/page.tsx) - Create about page (
app/(marketing)/about/page.tsx) - Implement proper Server Components with async data fetching examples
Docs Traceability:
- Reference:
docs/requirements.md- Section 3.1: Static Routes - Reference:
docs/ai_guidelines.md- Section 1.2: RSC as Default
Checklist Update: Document static route implementation
Task 6.3: Implement Dynamic Routes ⬜
Action Steps:
- Create
app/blog/[slug]/page.tsx:typescript1interface PageProps {2 params: { slug: string }3}45export default async function BlogPost({ params }: PageProps) {6 const { slug } = params7 // Fetch data based on slug8 return <div>Blog Post: {slug}</div>9}1011export async function generateStaticParams() {12 // Generate static paths13 return [{ slug: 'first-post' }, { slug: 'second-post' }]14}
Docs Traceability:
- Reference:
docs/requirements.md- Section 3.1: Dynamic Routes - Reference:
docs/architecture.md- Section 1: Dynamic Routing
Checklist Update: Track dynamic route creation
Task 6.4: Implement Parallel Routes ⬜
Action Steps:
- Create dashboard with parallel slots:
app/dashboard/@analytics/page.tsxapp/dashboard/@revenue/page.tsx
- Update
app/dashboard/layout.tsxto receive slots as props:typescript1export default function DashboardLayout({2 children,3 analytics,4 revenue,5}: {6 children: React.ReactNode7 analytics: React.ReactNode8 revenue: React.ReactNode9}) {10 return (11 <div>12 <div>{children}</div>13 <div className="grid grid-cols-2 gap-4">14 {analytics}15 {revenue}16 </div>17 </div>18 )19}
Docs Traceability:
- Reference:
docs/architecture.md- Section 3: Parallel Rendering - Reference:
docs/requirements.md- Section 3.1: Parallel Routing
Checklist Update: Document parallel routing implementation
Task 6.5: Implement Route Groups ⬜
Action Steps:
- Create
app/(marketing)/folder for marketing pages - Add shared layout in
app/(marketing)/layout.tsx - Verify URL paths don't include "(marketing)"
Docs Traceability:
- Reference:
docs/architecture.md- Section 2.C: Route Groups - Requirement: Parentheses folders excluded from URL path
Checklist Update: Track route group setup
Task 6.6: Implement Navigation Components ⬜
Action Steps:
- Create
src/_components/navigation.tsx:typescript1'use client'23import Link from 'next/link'4import { useRouter } from 'next/navigation'56export function Navigation() {7 const router = useRouter()89 return (10 <nav>11 <Link href="/">Home</Link>12 <Link href="/about">About</Link>13 <Link href="/blog">Blog</Link>14 <button onClick={() => router.push('/dashboard')}>15 Dashboard16 </button>17 </nav>18 )19}
Docs Traceability:
- Reference:
docs/implementation.md- Section 4.1: Navigation Between Routes - Reference:
docs/sop.md- Section 6: Navigation Standards - Requirement: Use Link for internal, useRouter for programmatic
Checklist Update: Document navigation implementation
Phase 7: Data Fetching & State Management
Docs Context References:
docs/architecture.md(Section 4: Data Fetching Paradigm)docs/requirements.md(Section 3.3: Efficient Data Fetching)docs/implementation.md(Section 6: Performance Optimization)
Task 7.1: Implement Server-Side Data Fetching ⬜
Action Steps:
- Create example in
app/blog/page.tsx:typescript1async function getPosts() {2 const res = await fetch('https://api.example.com/posts', {3 cache: 'force-cache', // SSG4 // cache: 'no-store', // SSR5 // next: { revalidate: 60 }, // ISR6 })7 return res.json()8}910export default async function BlogPage() {11 const posts = await getPosts()12 return <div>{/* Render posts */}</div>13}
Docs Traceability:
- Reference:
docs/architecture.md- Section 4: Server Component Direct Fetching - Reference:
docs/implementation.md- Section 6.2: Strategic Rendering - Requirement: Server-side data fetching in RSC
Checklist Update: Track data fetching examples
Task 7.2: Implement Route Handlers (API Routes) ⬜
Action Steps:
- Create
app/api/hello/route.ts:typescript1import { NextResponse } from 'next/server'23export async function GET() {4 return NextResponse.json({ message: 'Hello from API' })5}67export async function POST(request: Request) {8 const body = await request.json()9 return NextResponse.json({ received: body })10}
Docs Traceability:
- Reference:
docs/architecture.md- Section 5: Route Handlers - Requirement: Support GET, POST, PUT, DELETE methods
Checklist Update: Document API route creation
Task 7.3: Implement Loading & Error States ⬜
Action Steps:
- Create
app/blog/loading.tsx:typescript1export default function Loading() {2 return <div>Loading posts...</div>3} - Create
app/blog/error.tsx:typescript1'use client'23export default function Error({4 error,5 reset,6}: {7 error: Error & { digest?: string }8 reset: () => void9}) {10 return (11 <div>12 <h2>Something went wrong!</h2>13 <button onClick={() => reset()}>Try again</button>14 </div>15 )16} - Create
app/not-found.tsx:typescript1export default function NotFound() {2 return <div>404 - Page Not Found</div>3}
Docs Traceability:
- Reference:
docs/implementation.md- Section 5: State Management - Reference:
docs/requirements.md- Section 3.2: Error Handling - Requirement: loading.js wraps in Suspense, error.js must be Client Component
Checklist Update: Track state management files
Phase 8: Testing Infrastructure
Docs Context References:
docs/testing.md(All sections)docs/requirements.md(Section 3.2: Error Handling)
Task 8.1: Install Testing Dependencies ⬜
Action Steps:
- Install Jest and React Testing Library:
bash1npm install --save-dev jest jest-environment-jsdom @testing-library/react @testing-library/jest-dom @testing-library/user-event @types/jest
- Install additional testing utilities:
bash1npm install --save-dev @testing-library/react-hooks
Docs Traceability:
- Reference:
docs/testing.md- Section 2.1: Development Dependencies
Checklist Update: Track testing package installation
Task 8.2: Configure Jest ⬜
Action Steps:
- Create
jest.config.js:javascript1const nextJest = require('next/jest')23const createJestConfig = nextJest({4 dir: './',5})67const customJestConfig = {8 setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],9 testEnvironment: 'jest-environment-jsdom',10 moduleNameMapper: {11 '^@/(.*)$': '<rootDir>/src/$1',12 },13 collectCoverageFrom: [14 'src/**/*.{js,jsx,ts,tsx}',15 '!src/**/*.d.ts',16 '!src/**/*.stories.{js,jsx,ts,tsx}',17 '!src/**/__tests__/**',18 ],19 coverageThreshold: {20 global: {21 branches: 80,22 functions: 80,23 lines: 80,24 statements: 80,25 },26 },27}2829module.exports = createJestConfig(customJestConfig) - Create
jest.setup.js:javascript1import '@testing-library/jest-dom'
Docs Traceability:
- Reference:
docs/testing.md- Section 2.2: Code Coverage Requirement - Requirement: >80% code coverage
Checklist Update: Document Jest configuration
Task 8.3: Create Sample Tests ⬜
Action Steps:
- Create
src/_components/__tests__/navigation.test.tsx:typescript1import { render, screen } from '@testing-library/react'2import { Navigation } from '../navigation'34jest.mock('next/navigation', () => ({5 useRouter: () => ({6 push: jest.fn(),7 }),8}))910describe('Navigation', () => {11 it('renders navigation links', () => {12 render(<Navigation />)13 expect(screen.getByText('Home')).toBeInTheDocument()14 })15}) - Create unit tests for utilities
- Create integration tests for API routes
Docs Traceability:
- Reference:
docs/testing.md- Section 3: Testing Strategy - Requirement: Unit, Integration, and E2E tests
Checklist Update: Track test file creation
Task 8.4: Create Test for Routing Patterns ⬜
Action Steps:
- Create tests for static routes
- Create tests for dynamic routes with params
- Create tests for parallel routes rendering
- Create tests for error.js and not-found.js
Docs Traceability:
- Reference:
docs/testing.md- Section 4: Critical Next.js Feature Testing - Requirement: Test all routing conventions
Checklist Update: Document routing tests
Phase 9: Security Hardening
Docs Context References:
docs/security.md(All sections)docs/architecture.md(Section 6: Security Considerations)
Task 9.1: Setup Environment Variables ⬜
Action Steps:
- Create
.env.example:text1# Database2DATABASE_URL=postgresql://user:password@localhost:5432/db34# API Keys5NEXT_PUBLIC_API_URL=https://api.example.com6API_SECRET_KEY=your-secret-key78# Auth9NEXTAUTH_URL=http://localhost:300010NEXTAUTH_SECRET=your-nextauth-secret - Create
.env.local(gitignored) - Document environment variable usage
Docs Traceability:
- Reference:
docs/security.md- Section 2: Environment Variable Management - Requirement: Segmented by stage, never exposed to client
Checklist Update: Track env configuration
Task 9.2: Create Middleware for Auth ⬜
Action Steps:
- Create
src/middleware.ts:typescript1import { NextResponse } from 'next/server'2import type { NextRequest } from 'next/server'34export function middleware(request: NextRequest) {5 // Example: Check for auth token6 const token = request.cookies.get('session')78 if (!token && request.nextUrl.pathname.startsWith('/dashboard')) {9 return NextResponse.redirect(new URL('/login', request.url))10 }1112 return NextResponse.next()13}
Docs Traceability:
- Reference:
docs/security.md- Section 4: Authentication and Authorization - Requirement: Middleware for protected routes
Checklist Update: Document middleware implementation
Task 9.3: Implement Server-Side Data Security ⬜
Action Steps:
- Create example server component with secure data fetching:
typescript1// app/dashboard/page.tsx2async function getSecureData() {3 // Direct database call - safe in RSC4 const data = await fetch('http://localhost:3000/api/secure', {5 headers: {6 'Authorization': `Bearer ${process.env.API_SECRET_KEY}`7 }8 })9 return data.json()10}1112export default async function Dashboard() {13 const data = await getSecureData()14 return <div>{/* Render secure data */}</div>15}
- Document RSC security benefits in README
Docs Traceability:
- Reference:
docs/security.md- Section 3: Leveraging RSC for Data Security - Requirement: Server-side execution prevents credential leakage
Checklist Update: Track secure data fetching implementation
Task 9.4: Add Security Headers ⬜
Action Steps:
- Update
next.config.tswith security headers:typescript1const nextConfig: NextConfig = {2 typedRoutes: true,3 reactStrictMode: true,4 async headers() {5 return [6 {7 source: '/(.*)',8 headers: [9 {10 key: 'X-Frame-Options',11 value: 'DENY',12 },13 {14 key: 'X-Content-Type-Options',15 value: 'nosniff',16 },17 {18 key: 'X-XSS-Protection',19 value: '1; mode=block',20 },21 {22 key: 'Referrer-Policy',23 value: 'strict-origin-when-cross-origin',24 },25 ],26 },27 ]28 },29}
Docs Traceability:
- Reference:
docs/security.md- Section 1: Handling Sensitive Information - Reference: Web security best practices
Checklist Update: Document security headers
Phase 10: CI/CD Pipeline
Docs Context References:
docs/sop.md(Section 4: Deployment)docs/requirements.md(Deployment Environments)
Task 10.1: Create GitHub Actions Workflow ⬜
Action Steps:
- Create
.github/workflows/ci.yml:yaml1name: CI/CD Pipeline23on:4 push:5 branches: [main, develop]6 pull_request:7 branches: [main, develop]89jobs:10 quality:11 runs-on: ubuntu-latest12 steps:13 - uses: actions/checkout@v41415 - name: Setup Node.js16 uses: actions/setup-node@v417 with:18 node-version: '18'19 cache: 'npm'2021 - name: Install dependencies22 run: npm ci2324 - name: Type check25 run: npm run type-check2627 - name: Lint28 run: npm run lint2930 - name: Format check31 run: npm run format:check3233 - name: Run tests34 run: npm run test:coverage3536 - name: Upload coverage37 uses: codecov/codecov-action@v338 with:39 files: ./coverage/lcov.info40 flags: unittests41 name: codecov-umbrella4243 build:44 needs: quality45 runs-on: ubuntu-latest46 steps:47 - uses: actions/checkout@v44849 - name: Setup Node.js50 uses: actions/setup-node@v451 with:52 node-version: '18'53 cache: 'npm'5455 - name: Install dependencies56 run: npm ci5758 - name: Build application59 run: npm run build6061 - name: Upload build artifacts62 uses: actions/upload-artifact@v363 with:64 name: build65 path: .next
Docs Traceability:
- Reference:
docs/sop.md- Section 4.1: CI/CD Pipeline Services - Requirement: Automated builds, tests, and deployment
Checklist Update: Track CI/CD configuration
Task 10.2: Configure Vercel Deployment ⬜
Action Steps:
- Create
vercel.json:json1{2 "buildCommand": "npm run build",3 "devCommand": "npm run dev",4 "installCommand": "npm install",5 "framework": "nextjs",6 "outputDirectory": ".next"7} - Create deployment documentation in README
Docs Traceability:
- Reference:
docs/sop.md- Section 4.2: Deployment Platform - Requirement: Deploy on [DEPLOYMENT_TARGET]
Checklist Update: Document Vercel configuration
Task 10.3: Setup Environment Variables for Deployment ⬜
Action Steps:
- Document required environment variables for production
- Create checklist for Vercel environment variable setup
- Add deployment verification steps
Docs Traceability:
- Reference:
docs/security.md- Section 2: Environment Variable Management - Requirement: Production environment variables
Checklist Update: Track deployment env setup
Phase 11: Performance & SEO Optimization
Docs Context References:
docs/implementation.md(Section 6: SEO and Performance)docs/requirements.md(Section 3.4: SEO Integration)
Task 11.1: Implement SEO Metadata ⬜
Action Steps:
- Update
app/layout.tsxwith comprehensive metadata:typescript1import type { Metadata } from 'next'23export const metadata: Metadata = {4 title: {5 template: '%s | Next.js Boilerplate',6 default: 'Next.js Boilerplate',7 },8 description: 'Production-ready Next.js boilerplate with App Router',9 keywords: ['Next.js', 'React', 'TypeScript', 'Boilerplate'],10 authors: [{ name: 'Your Name' }],11 creator: 'Your Name',12 openGraph: {13 type: 'website',14 locale: 'en_US',15 url: 'https://your-domain.com',16 title: 'Next.js Boilerplate',17 description: 'Production-ready Next.js boilerplate',18 siteName: 'Next.js Boilerplate',19 images: [{20 url: 'https://your-domain.com/og-image.png',21 width: 1200,22 height: 630,23 }],24 },25 twitter: {26 card: 'summary_large_image',27 title: 'Next.js Boilerplate',28 description: 'Production-ready Next.js boilerplate',29 images: ['https://your-domain.com/twitter-image.png'],30 },31 robots: {32 index: true,33 follow: true,34 },35}
Docs Traceability:
- Reference:
docs/implementation.md- Section 6.1: SEO Metadata - Reference:
docs/requirements.md- Section 3.4: Mandatory Tags - Requirement: title ≤60 chars, description ≤160 chars, OG tags
Checklist Update: Track metadata implementation
Task 11.2: Create Sitemap and Robots.txt ⬜
Action Steps:
- Create
app/sitemap.ts:typescript1import { MetadataRoute } from 'next'23export default function sitemap(): MetadataRoute.Sitemap {4 return [5 {6 url: 'https://your-domain.com',7 lastModified: new Date(),8 changeFrequency: 'yearly',9 priority: 1,10 },11 {12 url: 'https://your-domain.com/about',13 lastModified: new Date(),14 changeFrequency: 'monthly',15 priority: 0.8,16 },17 {18 url: 'https://your-domain.com/blog',19 lastModified: new Date(),20 changeFrequency: 'weekly',21 priority: 0.5,22 },23 ]24} - Create
app/robots.ts:typescript1import { MetadataRoute } from 'next'23export default function robots(): MetadataRoute.Robots {4 return {5 rules: {6 userAgent: '*',7 allow: '/',8 disallow: ['/api/', '/dashboard/'],9 },10 sitemap: 'https://your-domain.com/sitemap.xml',11 }12}
Docs Traceability:
- Reference:
docs/requirements.md- Section 3.4: Generated Files - Requirement: sitemap.xml and robots.txt
Checklist Update: Document SEO file generation
Task 11.3: Optimize Images and Fonts ⬜
Action Steps:
- Create example with Next.js Image component:
typescript1import Image from 'next/image'23export function OptimizedImage() {4 return (5 <Image6 src="/example.jpg"7 alt="Example image"8 width={800}9 height={600}10 priority11 placeholder="blur"12 />13 )14}
- Verify font optimization in layout (already using
next/font) - Add image optimization guidelines to README
Docs Traceability:
- Reference:
docs/implementation.md- Section 6.3: Optimization Assets - Requirement: Next.js Image and Font Optimization
Checklist Update: Track asset optimization
Task 11.4: Configure Caching Strategies ⬜
Action Steps:
- Create examples of different caching strategies:
typescript1// SSG - Static Site Generation2async function getStaticData() {3 const res = await fetch('https://api.example.com/data', {4 cache: 'force-cache' // Default5 })6 return res.json()7}89// ISR - Incremental Static Regeneration10async function getRevalidatedData() {11 const res = await fetch('https://api.example.com/data', {12 next: { revalidate: 3600 } // Revalidate every hour13 })14 return res.json()15}1617// SSR - Server-Side Rendering18async function getDynamicData() {19 const res = await fetch('https://api.example.com/data', {20 cache: 'no-store' // Always fetch fresh21 })22 return res.json()23}
- Document caching strategies in README
Docs Traceability:
- Reference:
docs/implementation.md- Section 6.2: Strategic Rendering - Requirement: SSG, ISR, SSR based on content dynamism
Checklist Update: Document caching implementation
Phase 12: Documentation
Docs Context References:
docs/sop.md(Section 5: Documentation Maintenance)- All docs files for context
Task 12.1: Create Comprehensive README.md ⬜
Action Steps:
- Create
README.mdwith following sections:markdown1# Next.js Boilerplate23Production-ready Next.js boilerplate with App Router, TypeScript, Tailwind CSS, and shadcn/ui.45## Features67- ✅ Next.js 14+ with App Router8- ✅ React 18+ with Server Components9- ✅ TypeScript with strict mode10- ✅ Tailwind CSS for styling11- ✅ shadcn/ui components (Open Code philosophy)12- ✅ ESLint + Prettier for code quality13- ✅ Husky + Lint-Staged for pre-commit hooks14- ✅ Jest + React Testing Library15- ✅ GitHub Actions CI/CD16- ✅ Security best practices17- ✅ SEO optimization1819## Prerequisites2021- Node.js v18.18.0 or later22- npm or yarn or pnpm2324## Getting Started2526### Installation2728\`\`\`bash29# Clone repository30git clone [REPOSITORY_URL]31cd [PROJECT_NAME]3233# Install dependencies34npm install3536# Copy environment variables37cp .env.example .env.local3839# Run development server40npm run dev41\`\`\`4243Open [http://localhost:3000](http://localhost:3000) in your browser.4445## Project Structure4647\`\`\`48src/49├── app/ # Next.js App Router50│ ├── (marketing)/ # Route group51│ ├── api/ # API routes52│ ├── blog/ # Blog pages53│ ├── dashboard/ # Dashboard with parallel routes54│ ├── layout.tsx # Root layout55│ ├── page.tsx # Home page56│ ├── error.tsx # Error boundary57│ ├── loading.tsx # Loading UI58│ └── not-found.tsx # 404 page59├── _components/ # Shared components60├── _lib/ # Utility functions61├── _hooks/ # Custom React hooks62├── _types/ # TypeScript types63└── middleware.ts # Middleware for auth/routing64\`\`\`6566## Available Scripts6768- `npm run dev` - Start development server69- `npm run build` - Build for production70- `npm run start` - Start production server71- `npm run lint` - Run ESLint72- `npm run lint:fix` - Fix ESLint issues73- `npm run format` - Format code with Prettier74- `npm run format:check` - Check code formatting75- `npm run test` - Run tests76- `npm run test:watch` - Run tests in watch mode77- `npm run test:coverage` - Generate coverage report78- `npm run type-check` - Check TypeScript types7980## Architecture Highlights8182### App Router83- File-system based routing84- Server Components by default85- Nested layouts and route groups86- Parallel routing for dashboards87- Dynamic routes with `[slug]` convention8889### Data Fetching90- Server-side fetching with `fetch` API91- Caching strategies (SSG, ISR, SSR)92- Direct database calls in Server Components93- Route Handlers for API endpoints9495### Styling96- Tailwind CSS utility-first approach97- shadcn/ui components (customizable source code)98- CSS Modules support99- Responsive design patterns100101### Testing102- Jest for unit testing103- React Testing Library for component testing104- Coverage threshold: 80%105- GitHub Actions for CI/CD106107### Security108- Environment variable management109- Server-side data fetching110- Middleware for authentication111- Security headers configured112113## Environment Variables114115See `.env.example` for required environment variables.116117## Deployment118119### Vercel (Recommended)1201211. Push code to GitHub1222. Import project in Vercel1233. Configure environment variables1244. Deploy125126## Documentation127128Comprehensive documentation available in `docs/`:129- [AI Guidelines](docs/ai_guidelines.md)130- [Requirements](docs/requirements.md)131- [Architecture](docs/architecture.md)132- [Implementation](docs/implementation.md)133- [Testing](docs/testing.md)134- [Security](docs/security.md)135- [SOP](docs/sop.md)136- [Checklist](docs/checklist.md)137138## Contributing139140See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines.141142## License143144MIT License - see [LICENSE](LICENSE) for details.
Docs Traceability:
- Reference:
docs/sop.md- Section 5.1: README.md - Requirement: Setup, development, testing, deployment instructions
Checklist Update: Track README creation
Task 12.2: Create CONTRIBUTING.md ⬜
Action Steps:
- Create
CONTRIBUTING.md:markdown1# Contributing Guidelines23Thank you for considering contributing to this project!45## Getting Started671. Fork the repository82. Clone your fork93. Create a feature branch104. Make your changes115. Run tests and linting126. Commit with conventional commits137. Push to your fork148. Create a Pull Request1516## Development Workflow1718### Branching Strategy1920We use [GitHub Flow / Gitflow]:21- `main` - Production-ready code22- `develop` - Development branch23- `feature/*` - Feature branches24- `fix/*` - Bug fix branches2526### Commit Messages2728Follow [Conventional Commits](https://www.conventionalcommits.org/):29- `feat:` - New features30- `fix:` - Bug fixes31- `docs:` - Documentation changes32- `style:` - Code style changes33- `refactor:` - Code refactoring34- `test:` - Test additions/changes35- `chore:` - Maintenance tasks3637### Code Quality3839- All code must pass ESLint checks40- All code must be formatted with Prettier41- All tests must pass42- Coverage must maintain >80%43- TypeScript strict mode must pass4445### Pull Request Process46471. Update documentation if needed482. Add tests for new features493. Ensure all checks pass504. Request review from maintainers515. Address review feedback526. Squash commits if requested5354## Code Style5556- Use TypeScript for all files57- Follow ESLint configuration58- Use functional components59- Prefer Server Components60- Use 'use client' only when necessary61- Follow naming conventions in docs/6263## Testing6465- Write unit tests for utilities66- Write component tests with RTL67- Write integration tests for features68- Maintain coverage above 80%6970## Questions?7172Open an issue for discussion!
Docs Traceability:
- Reference:
docs/sop.md- Section 5.2: Contributing Guidelines
Checklist Update: Document contributing guidelines
Task 12.3: Create LICENSE ⬜
Action Steps:
- Create
LICENSEfile (MIT or chosen license) - Add copyright information
Docs Traceability:
- Reference: Standard open source practices
Checklist Update: Track license file
Task 12.4: Add Inline Code Documentation ⬜
Action Steps:
- Add JSDoc comments to utility functions
- Add comments explaining complex logic
- Document component props with TypeScript interfaces
- Add README files in key directories
Docs Traceability:
- Reference:
docs/sop.md- Section 5.3: Architecture Documentation
Checklist Update: Track code documentation
Phase 13: Final Validation & Packaging
Docs Context References:
- All documentation files
docs/checklist.md(self-reference)
Task 13.1: Run Full Test Suite ⬜
Action Steps:
- Run all commands to verify setup:
bash1npm run type-check2npm run lint3npm run format:check4npm run test:coverage5npm run build
- Verify all checks pass
- Document any warnings or issues
Docs Traceability:
- Reference: All implementation phases
- Requirement: All quality checks must pass
Checklist Update: Track validation results
Task 13.2: Verify Documentation Completeness ⬜
Action Steps:
- Review all docs files for completeness
- Verify cross-references work
- Ensure README accurately reflects implementation
- Check that checklist.md is up-to-date
Docs Traceability:
- Reference:
docs/documentation-summary.md - Requirement: Traceability between docs and code
Checklist Update: Document verification status
Task 13.3: Security Audit ⬜
Action Steps:
- Run
npm auditand address vulnerabilities - Verify
.env.exampledoesn't contain secrets - Verify
.gitignoreexcludes sensitive files - Check middleware authentication logic
- Verify security headers in next.config.ts
Docs Traceability:
- Reference:
docs/security.md- All sections - Requirement: Zero security vulnerabilities
Checklist Update: Track security audit
Task 13.4: Performance Testing ⬜
Action Steps:
- Run Lighthouse audit on built application
- Verify Core Web Vitals scores
- Check bundle size with
npm run build - Verify image optimization working
- Test loading states and error boundaries
Docs Traceability:
- Reference:
docs/requirements.md- Non-functional Requirements - Reference:
docs/implementation.md- Section 6: Performance - Requirement: Load times <2 seconds
Checklist Update: Document performance metrics
Task 13.5: Create Deployment Checklist ⬜
Action Steps:
- Create deployment verification document
- List all environment variables needed
- Document deployment steps
- Create rollback procedures
- Add monitoring setup instructions
Docs Traceability:
- Reference:
docs/sop.md- Section 4: Deployment
Checklist Update: Track deployment documentation
Task 13.6: Final Checklist Review ⬜
Action Steps:
- Review
docs/checklist.mdfor completeness - Ensure all tasks are marked ✅ or documented as blocked
- Add final summary section to checklist
- Document known issues or future enhancements
- Add completion timestamp
Docs Traceability:
- Reference: This prompt document
- Requirement: Full traceability and observability
Checklist Update:
markdown1## Final Summary23### Completion Status4- Total Tasks: [NUMBER]5- Completed: [NUMBER] ✅6- Blocked: [NUMBER] ❌7- Overall Progress: [PERCENTAGE]%89### Completion Date10[YYYY-MM-DD HH:MM]1112### Deliverables Checklist13- ✅ Next.js boilerplate with App Router14- ✅ TypeScript configuration15- ✅ Tailwind CSS + shadcn/ui16- ✅ ESLint + Prettier + Husky17- ✅ Jest + React Testing Library18- ✅ GitHub Actions CI/CD19- ✅ Environment variable setup20- ✅ Security middleware21- ✅ SEO optimization22- ✅ Comprehensive documentation23- ✅ All tests passing24- ✅ All quality checks passing2526### Known Issues27[List any known issues or limitations]2829### Future Enhancements30[List potential improvements or features for future versions]3132### Traceability Matrix33All requirements from docs/ mapped to implementation:34- ai_guidelines.md → [FILES]35- requirements.md → [FILES]36- architecture.md → [FILES]37- implementation.md → [FILES]38- testing.md → [FILES]39- security.md → [FILES]40- sop.md → [FILES]
Task 13.7: Package Repository ⬜
Action Steps:
- Ensure all files are committed to Git
- Create final commit:
git commit -m "chore: complete Next.js boilerplate v1.0.0" - Tag release:
git tag v1.0.0 - Create repository archive:
bash1# Option 1: Zip file2git archive --format=zip --output=nextjs-boilerplate-v1.0.0.zip HEAD34# Option 2: Tarball5git archive --format=tar.gz --output=nextjs-boilerplate-v1.0.0.tar.gz HEAD
- Document push instructions for remote repository
Docs Traceability:
- Reference: Final deliverable requirement
Checklist Update: Mark packaging complete
Output Instructions for CLine
Continuous Updates
Throughout the entire process:
-
Update
docs/checklist.mdafter EVERY task completion- Change status from ⬜ to 🟡 when starting
- Change status from 🟡 to ✅ when complete
- Add timestamp using format:
YYYY-MM-DD HH:MM - Link to relevant docs context
- Note any deviations or decisions
- List next action items
-
Commit frequently with descriptive messages
- Use conventional commit format
- Commit after each major task or logical grouping
- Reference checklist task number in commits
- Example:
feat: implement typed routes configuration (Task 2.1)
-
Document decisions and trade-offs
- Add comments in code explaining "why" not just "what"
- Update checklist with rationale for implementation choices
- Note any deviations from docs guidance
Final Deliverables
When all phases are complete:
-
Verify checklist.md is fully updated
- All tasks marked with status
- Final summary section completed
- Traceability matrix filled out
-
Create repository archive
- Generate zip file:
nextjs-boilerplate-v1.0.0.zip - Include all files except node_modules and .next
- Ensure .env.example is included, not .env.local
- Generate zip file:
-
Provide handoff documentation
- Output location of zip file
- Provide instructions for:
- Extracting archive
- Installing dependencies
- Running development server
- Deploying to production
- Include link to docs/checklist.md for progress reference
-
Create summary report
markdown1# Next.js Boilerplate - Completion Report23## Executive Summary4Successfully created production-ready Next.js boilerplate following all guidelines from docs/ folder.56## Statistics7- Total Files Created: [NUMBER]8- Total Lines of Code: [NUMBER]9- Test Coverage: [PERCENTAGE]%10- Total Commits: [NUMBER]11- Time Taken: [DURATION]1213## Documentation Traceability14- ai_guidelines.md: [STATUS] - All mandates implemented15- requirements.md: [STATUS] - All requirements met16- architecture.md: [STATUS] - Architecture followed17- implementation.md: [STATUS] - Standards applied18- testing.md: [STATUS] - Testing complete19- security.md: [STATUS] - Security hardened20- sop.md: [STATUS] - SOPs established2122## Quality Metrics23- Type Safety: ✅ TypeScript strict mode24- Code Quality: ✅ ESLint passing25- Formatting: ✅ Prettier passing26- Testing: ✅ [COVERAGE]% coverage27- Build: ✅ Production build successful28- Security: ✅ No vulnerabilities2930## Deliverables31- ✅ Repository: [LOCATION]32- ✅ Archive: nextjs-boilerplate-v1.0.0.zip33- ✅ Documentation: docs/34- ✅ Checklist: docs/checklist.md3536## Next Steps371. Extract archive to desired location382. Run `npm install`393. Copy `.env.example` to `.env.local`404. Run `npm run dev`415. Review docs/checklist.md for implementation details426. Deploy to [DEPLOYMENT_TARGET]
Success Criteria
The boilerplate is considered complete when:
- ✅ All 13 phases marked as "Done" in checklist.md
- ✅ All tasks within each phase marked as ✅
- ✅ All quality checks passing (lint, format, type-check, test)
- ✅ Test coverage ≥80%
- ✅ Build successful with no errors
- ✅ Security audit passed with zero vulnerabilities
- ✅ All documentation complete and accurate
- ✅ Full traceability between docs/ and implementation
- ✅ Repository archived and ready for distribution
Important Reminders
- ALWAYS update docs/checklist.md first - This is your source of truth
- Reference docs context at every step - Maintain traceability
- Commit frequently - Small, logical commits with clear messages
- Test as you go - Don't wait until the end to test
- Document decisions - Future you (and others) will thank you
- Follow the docs strictly - They contain all requirements and constraints
- Ask for clarification - If requirements conflict, document and proceed with best judgment
Begin with Phase 0: Creating docs/checklist.md, then proceed systematically through each phase. Good luck! 🚀
Now you can see why I leave Anthropic for the final draft. There are multiple ways to proceed. The best method is to stop after each phase outlined and test everything. But for today I am going to YOLO through all the phases and see if we got it all in one prompt.
Vibe Coding




Link to Repo
Not much effort other than periodically clicking proceed. When most people think about vibe coding they typically think the process begins here but as you can see this is bascially the end. But does it work?
Vibe Debugging

So it runs without errors when I initially start it up. It is functional except for two key part:
No dashboard layout.tsx or page.tsx exists in the dashboard directory. This means the parallel routes (@analytics and @revenue) have content but there's no main dashboard container to display them.
The navigation includes an "/about" link, but there's no corresponding about page or directory in src/app/.
Currently, both pages are incomplete and won't render properly if accessed directly.
Since this is a boilerplate we really don't need all of that since it is pretty simple to expand that functionality if needed or remove it.
Conclusion: Mastering Vibe Coding for Next.js
Vibe coding represents a paradigm shift in software development, combining human expertise with AI assistance to create production-ready applications efficiently. This methodology proves particularly effective for Next.js boilerplate development, enabling rapid creation of robust, scalable applications.
Future implementations can leverage this structured approach to create increasingly sophisticated applications. The combination of comprehensive documentation, AI assistance, and systematic development processes establishes a new standard for efficient software development.
Ready to start your vibe coding journey? Begin with thorough research, create comprehensive documentation, and leverage AI tools to accelerate your Next.js development process.
I would call this success. We were able to create a boilerplate Next.JS repo all in one vibe coding prompt.
Link to Repo


Sovereign AI: Building Local-First Intelligent Systems
by Daniel Kliewer · Paperback · 72 pages
The hands-on guide to building AI that runs on your hardware, keeps your data private, and eliminates cloud dependence. Working code included.