### Payload CMS Development Setup Source: https://github.com/payloadcms/payload/tree/main/examples/auth Instructions for setting up the Payload CMS example locally. It mentions following a 'Quick Start' guide, which is a common pattern for project initialization and setup. ```bash # Follow the Quick Start guide to spin up this example locally. ``` -------------------------------- ### Install Dependencies and Start Development Server Source: https://github.com/payloadcms/payload/tree/main/examples/email Installs project dependencies and starts the development server, making the Payload application accessible for testing and administration. ```bash pnpm install && pnpm dev ``` -------------------------------- ### Install Next.js with create-next-app Source: https://nextjs.org/docs/app/building-your-application/deploying This command initializes a new Next.js project. It allows for configuration of TypeScript, styling options, and more. Ensure you have Node.js installed. Dependencies include React and Next.js itself. ```bash npx create-next-app@latest ``` -------------------------------- ### Next.js Documentation Structure: Getting Started Source: https://nextjs.org/docs/app/building-your-application/configuring/environment-variables Represents a section of Next.js documentation focusing on 'Getting Started'. It includes a title, description, path, and nested children for sub-topics like 'Installation' and 'Project Structure'. This structure is likely used to render a navigation or content outline for the documentation. ```json {\"items\":{\"13\":[{\"title\":\"Getting Started\",\"description\":\"Learn how to create full-stack web applications with Next.js.\",\"path\":\"13/getting-started\",\"version\":\"$undefined\",\"source\":\"docs/13/01-getting-started/index.mdx\",\"children\":[{\"title\":\"Installation\",\"description\":\"Create a new Next.js application with \`create-next-app\`. Set up TypeScript, styles, and configure your \`next.config.js\` file.\",\"path\":\"13/getting-started/installation\",\"version\":\"$undefined\",\"source\":\"docs/13/01-getting-started/01-installation.mdx\",\"children\":[]},{\"title\":\"Project Structure\",\"description\":\"A list of folders and files conventions in a Next.js project\",\"path\":\"13/getting-started/project-structure\",\"version\":\"$undefined\",\"source\":\"docs/13/01-getting-started/02-project-structure.mdx\",\"children\":[]}]}]}} ``` -------------------------------- ### Deployment Options for Next.js Projects Source: https://nextjs.org/docs/app/building-your-application/deploying This section lists various deployment options for Next.js applications, including Docker, Docker Multi-Environment, and DigitalOcean. Each option links to a relevant guide or example. ```html Docker ``` ```html Docker Multi-Environment ``` ```html DigitalOcean ``` -------------------------------- ### create-next-app Source: https://nextjs.org/docs/app/building-your-application/routing Command-line interface for creating new Next.js applications with a streamlined setup process. ```APIDOC ## `create-next-app` CLI ### Description The `create-next-app` command provides a convenient way to scaffold new Next.js projects, setting up the necessary configurations and dependencies with minimal effort. ### Method N/A (CLI Command) ### Endpoint N/A (CLI Command) ### Parameters (These are arguments for the `create-next-app` command) - **[template]** (string) - Optional - Specifies the template to use for the new project (e.g., `app`, `blog`). - **`--typescript`** (boolean) - Optional - Enables TypeScript support. - **`--eslint`** (boolean) - Optional - Integrates ESLint for code linting. - **`--tailwind`** (boolean) - Optional - Sets up Tailwind CSS for styling. - **`--src-dir`** (boolean) - Optional - Creates a `src/` directory for the application code. - **`--app`** (boolean) - Optional - Uses the new App Router instead of the Pages Router. - **`--import-alias`** (string) - Optional - Sets up a custom module import alias. ### Request Example ```bash npx create-next-app@latest my-next-app --typescript --eslint --tailwind --app ``` ### Response (N/A - This is a CLI command that creates a project) ### Response Example (N/A - This is a CLI command that creates a project) ``` -------------------------------- ### Build and Start Payload for Production Source: https://github.com/payloadcms/payload/tree/main/templates/website Commands to build the Next.js admin panel and start the Payload Node.js server for production. Ensure you have pnpm or npm installed. This process creates a production-ready bundle in the '.next' directory. ```bash pnpm build pnpm start ``` ```bash npm run build npm run start ``` -------------------------------- ### Build and Start Next.js Node.js Server Source: https://nextjs.org/docs/app/building-your-application/deploying Commands to build the Next.js application for production and start the Node.js server. This server supports all Next.js features. Ejecting to a custom server is also an option for advanced configurations. ```bash npm run build npm run start ``` -------------------------------- ### Create Payload App with Live Preview Example Source: https://github.com/payloadcms/payload/tree/main/examples/live-preview Use this command to generate a new Payload project pre-configured with the Live Preview example. This command requires npx to be installed and accessible in your environment. ```bash npx create-payload-app --example live-preview ``` -------------------------------- ### NextRequest Source: https://nextjs.org/docs/app/building-your-application/deploying API Reference for NextRequest. ```APIDOC ## NextRequest ### Description API Reference for NextRequest. ### Method Not applicable (Class) ### Endpoint Not applicable (Class) ### Parameters Extends the standard Request object with additional properties and methods specific to Next.js. ### Request Example ```json { "example": "Example usage of NextRequest in an API route" } ``` ### Response #### Success Response (200) Represents an incoming request to a Next.js application. #### Response Example ```json { "example": "NextRequest object structure" } ``` ``` -------------------------------- ### NextResponse Source: https://nextjs.org/docs/app/building-your-application/deploying API Reference for NextResponse. ```APIDOC ## NextResponse ### Description API Reference for NextResponse. ### Method Not applicable (Class) ### Endpoint Not applicable (Class) ### Parameters Extends the standard Response object with additional properties and methods specific to Next.js. ### Request Example ```json { "example": "Example usage of NextResponse in an API route" } ``` ### Response #### Success Response (200) Represents an outgoing response from a Next.js application. #### Response Example ```json { "example": "NextResponse object structure" } ``` ``` -------------------------------- ### Next.js Documentation Structure (JSON) Source: https://nextjs.org/docs/app/building-your-application/deploying This JSON structure represents the organization of documentation content within a Next.js project. It details items like 'Getting Started' and 'Building Your Application', including titles, descriptions, paths, and nested children for navigation and content. ```json { "items": { "13": [ { "title": "Getting Started", "description": "Learn how to create full-stack web applications with Next.js.", "path": "13/getting-started", "version": "$undefined", "source": "docs/13/01-getting-started/index.mdx", "children": [ { "title": "Installation", "description": "Create a new Next.js application with `create-next-app`. Set up TypeScript, styles, and configure your `next.config.js` file.", "path": "13/getting-started/installation", "version": "$undefined", "source": "docs/13/01-getting-started/01-installation.mdx", "children": [] }, { "title": "Project Structure", "description": "A list of folders and files conventions in a Next.js project", "path": "13/getting-started/project-structure", "version": "$undefined", "source": "docs/13/01-getting-started/02-project-structure.mdx", "children": [] } ] }, { "title": "Building Your Application", "description": "Learn how to use Next.js features to build your application.", "path": "13/app/building-your-application", "version": "$undefined", "source": "docs/13/02-app/01-building-your-application/index.mdx", "children": [ { "title": "Routing", "description": "Learn the fundamentals of routing for front-end applications.", "path": "13/app/building-your-application/routing", "version": "$undefined", "source": "docs/13/02-app/01-building-your-application/01-routing/index.mdx", "children": [ { "title": "Defining Routes", "description": "Learn how to create your first route in Next.js.", "path": "13/app/building-your-application/routing/defining-routes", "version": "$undefined", "source": "docs/13/02-app/01-building-your-application/01-routing/01-defining-routes.mdx", "children": [] }, { "title": "Pages and Layouts", "description": "Create your first page and shared layout with the App Router.", "path": "13/app/building-your-application/routing/pages-and-layouts", "version": "$undefined", "source": "docs/13/02-app/01-building-your-application/01-routing/02-pages-and-layouts.mdx", "children": [] }, { "title": "Linking and Navigating", "description": "Learn how navigation works in Next.js, and how to use the Link Component and `useRouter` hook.", "path": "13/app/building-your-application/routing/linking-and-navigating", "version": "$undefined", "source": "docs/13/02-app/01-building-your-application/01-routing/03-linking-and-navigating.mdx", "children": [] }, { "title": "Route Groups", "description": "Route Groups can be used to partition your Next.js application into different sections.", "path": "13/app/building-your-application/routing/route-groups", "version": "$undefined", "source": "docs/13/02-app/01-building-your-application/01-routing/04-route-groups.mdx", "children": [] } ] } ] } ] } } ``` -------------------------------- ### useParams Source: https://nextjs.org/docs/app/building-your-application/deploying API Reference for the useParams hook. ```APIDOC ## useParams ### Description API Reference for the useParams hook. ### Method Not applicable (Hook) ### Endpoint Not applicable (Hook) ### Parameters This hook does not take any parameters. ### Request Example ```jsx import { useParams } from 'next/navigation'; function MyComponent() { const params = useParams(); // params will contain route parameters } ``` ### Response #### Success Response (200) Returns an object containing the current route's dynamic parameters. #### Response Example ```json { "example": "{ id: '123', slug: 'my-post' }" } ``` ``` -------------------------------- ### Install Dependencies and Start Development Server Source: https://github.com/payloadcms/payload/tree/main/templates/ecommerce This command installs project dependencies using pnpm and then starts the development server. It assumes that 'pnpm' is installed and available in the environment. The '&&&' symbol is used as a command separator. ```shell pnpm install &&& pnpm dev ``` -------------------------------- ### Install Next.js App Source: https://nextjs.org/docs/app/building-your-application/routing Create a new Next.js application using the `create-next-app` command. This process sets up TypeScript, styles, and configures the `next.config.js` file for your project. No external dependencies are required beyond Node.js. ```bash npx create-next-app@latest cd my-app npm run dev ``` -------------------------------- ### redirect Source: https://nextjs.org/docs/app/building-your-application/deploying API Reference for the redirect function. ```APIDOC ## redirect ### Description API Reference for the redirect function. ### Method Not applicable (Function) ### Endpoint Not applicable (Function) ### Parameters - **url** (string) - Required - The URL to redirect to. - **options** (object) - Optional - Configuration options. - **statusCode** (number) - Optional - The HTTP status code (defaults to 307). ### Request Example ```json { "example": "redirect('/new-page')" } ``` ### Response #### Success Response (307) Performs a temporary redirect to the specified URL. #### Response Example ```json { "example": "307 Temporary Redirect response" } ``` ``` -------------------------------- ### ImageResponse Source: https://nextjs.org/docs/app/building-your-application/deploying API Reference for the ImageResponse constructor. ```APIDOC ## ImageResponse ### Description API Reference for the ImageResponse constructor. ### Method Not applicable (Constructor) ### Endpoint Not applicable (Constructor) ### Parameters - **element** (ReactNode) - Required - The React element to render. - **options** (object) - Optional - Configuration options. - **width** (number) - Optional - The width of the image in pixels. - **height** (number) - Optional - The height of the image in pixels. - **fonts** (array) - Optional - An array of font configurations. ### Request Example ```json { "example": "new ImageResponse(
Hello world
, { width: 800, height: 400 })" } ``` ### Response #### Success Response (200) Returns an image response object. #### Response Example ```json { "example": "Image response object" } ``` ``` -------------------------------- ### usePathname Source: https://nextjs.org/docs/app/building-your-application/deploying API Reference for the usePathname hook. ```APIDOC ## usePathname ### Description API Reference for the usePathname hook. ### Method Not applicable (Hook) ### Endpoint Not applicable (Hook) ### Parameters This hook does not take any parameters. ### Request Example ```jsx import { usePathname } from 'next/navigation'; function MyComponent() { const pathname = usePathname(); // pathname will be the current URL pathname } ``` ### Response #### Success Response (200) Returns the current URL's pathname. #### Response Example ```json { "example": "/dashboard/settings" } ``` ``` -------------------------------- ### Install Dependencies and Run Local Docs Preview Source: https://github.com/payloadcms/payload/blob/main/CONTRIBUTING Steps to set up the PayloadCMS website repository, install dependencies, configure environment variables, and run the local development server to preview documentation changes. This process involves cloning the repository, installing with pnpm, creating an .env file, setting the DOCS_DIR, fetching local docs, and then running the dev server. ```shell pnpm install ``` ```shell pnpm fetchDocs:local ``` ```shell pnpm dev ``` -------------------------------- ### Google Cloud Storage Quickstart in Node.js Source: https://github.com/googleapis/nodejs-storage A basic Node.js example demonstrating how to get started with Google Cloud Storage. This typically involves initializing the client and performing a simple operation like listing buckets. ```javascript /** * Demonstrates a basic Google Cloud Storage operation. * This sample assumes you have authenticated via environment variables. * See: https://cloud.google.com/docs/authentication/getting-started */ // Imports the Google Cloud client library const {Storage} = require('@google-cloud/storage'); async function quickstart() { // Creates a client const storage = new Storage(); // Lists all buckets in the project const [buckets] = await storage.getBuckets(); console.log('Buckets:'); buckets.forEach(bucket => console.log(bucket.name)); } quickstart().catch(console.error); ``` -------------------------------- ### Configuration Options Source: https://nextjs.org/docs/app/building-your-application/deploying Details on configuring the application, including settings within `next.config.js`. ```APIDOC ## Configuration Reference This document outlines the configuration options available for the application, primarily through `next.config.js`. ### `next.config.js` Options * **allowedDevOrigins**: Specifies allowed origins during development. * **appDir**: Enables or disables the App Router. * **assetPrefix**: Prefixes all assets with a given string. * **authInterrupts**: Configuration related to authentication interruptions. * **basePath**: Prepends a path to all routes. * **browserDebugInfoInTerminal**: Controls browser debug information in the terminal. ``` -------------------------------- ### Next.js Routing Documentation Structure (JSON) Source: https://nextjs.org/docs/app/deep-dive/caching This snippet represents the structured data for Next.js routing documentation. It outlines sections like 'Getting Started', 'Installation', 'Project Structure', and detailed routing concepts within the App Router. ```json { "items": { "13": [ { "title": "Getting Started", "description": "Learn how to create full-stack web applications with Next.js.", "path": "13/getting-started", "version": null, "source": "docs/13/01-getting-started/index.mdx", "children": [ { "title": "Installation", "description": "Create a new Next.js application with \`create-next-app\`. Set up TypeScript, styles, and configure your \`next.config.js\` file.", "path": "13/getting-started/installation", "version": null, "source": "docs/13/01-getting-started/01-installation.mdx", "children": [] }, { "title": "Project Structure", "description": "A list of folders and files conventions in a Next.js project", "path": "13/getting-started/project-structure", "version": null, "source": "docs/13/01-getting-started/02-project-structure.mdx", "children": [] } ] }, { "title": "Building Your Application", "description": "Learn how to use Next.js features to build your application.", "path": "13/app/building-your-application", "version": null, "source": "docs/13/02-app/01-building-your-application/index.mdx", "children": [ { "title": "Routing", "description": "Learn the fundamentals of routing for front-end applications.", "path": "13/app/building-your-application/routing", "version": null, "source": "docs/13/02-app/01-building-your-application/01-routing/index.mdx", "children": [ { "title": "Defining Routes", "description": "Learn how to create your first route in Next.js.", "path": "13/app/building-your-application/routing/defining-routes", "version": null, "source": "docs/13/02-app/01-building-your-application/01-routing/01-defining-routes.mdx", "children": [] }, { "title": "Pages and Layouts", "description": "Create your first page and shared layout with the App Router.", "path": "13/app/building-your-application/routing/pages-and-layouts", "version": null, "source": "docs/13/02-app/01-building-your-application/01-routing/02-pages-and-layouts.mdx", "children": [] }, { "title": "Linking and Navigating", "description": "Learn how navigation works in Next.js, and how to use the Link Component and \`useRouter\` hook.", "path": "13/app/building-your-application/routing/linking-and-navigating", "version": null, "source": "docs/13/02-app/01-building-your-application/01-routing/03-linking-and-navigating.mdx", "children": [] }, { "title": "Route Groups", "description": "Route Groups can be used to partition your Next.js application into different sections.", "path": "13/app/building-your-application" } ] } ] } ] } } ``` -------------------------------- ### Create Payload App with Draft Preview Example Source: https://github.com/payloadcms/payload/tree/main/examples/draft-preview This command initializes a new Payload CMS project with the draft preview example already configured. It sets up the necessary files and dependencies for the example. ```bash npx create-payload-app --example draft-preview ``` -------------------------------- ### CLI - create-next-app Source: https://nextjs.org/docs/app/building-your-application/deploying API Reference for the create-next-app CLI tool. ```APIDOC ## CLI - create-next-app Create Next.js apps using one command with the `create-next-app` CLI. ``` -------------------------------- ### Basic API Route Example - TypeScript Source: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ A simple example of an API route handler in TypeScript. This route is configured to handle GET requests and returns a JSON response. ```ts import type { NextApiRequest, NextApiResponse } from "next"; type Data = { name: string; }; export default function handler(req: NextApiRequest, res: NextApiResponse) { res.status(200).json({ name: "John Doe" }); } ``` -------------------------------- ### Sentry Installation using Sentry Wizard Source: https://docs.sentry.io/platforms/javascript/guides/nextjs/ Command to initiate the Sentry installation wizard for a Next.js project. The wizard simplifies the setup process by guiding users through feature selection and configuration. ```bash npx @sentry/wizard@latest -i nextjs ``` -------------------------------- ### Configuration: next.config.js Options Source: https://nextjs.org/docs/app/building-your-application/deploying Documentation for various options available in the next.config.js file. ```APIDOC ## next.config.js Options ### Description Configuration options for customizing Next.js build and runtime behavior. ### Method N/A (Configuration File) ### Endpoint N/A ### Parameters Refer to individual option documentation below. ### Request Example ```javascript // next.config.js module.exports = { reactStrictMode: true, images: { domains: ['example.com'], }, }; ``` ### Response N/A #### Individual Options: - **allowedDevOrigins** - **Description**: Whitelist URLs that can be served during development. - **Type**: `Array