### Install Metabase with Docker Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/addons/metabase.mdx Use this command to start a Metabase container. Ensure Docker is installed on your system. ```sh docker run -d --name metabase -p 3000:3000 metabase/metabase ``` -------------------------------- ### Run Development Server Source: https://github.com/vercel/next-forge/blob/main/apps/storybook/README.md Use these commands to start the Next.js development server. Ensure you have the appropriate package manager installed. ```bash bun dev ``` ```bash npm run dev ``` ```bash yarn dev ``` ```bash pnpm dev ``` -------------------------------- ### Bootstrap a New Next-Forge Project Source: https://context7.com/vercel/next-forge/llms.txt Use the `init` command to bootstrap a new monorepo from the GitHub template. It handles environment file setup, dependency installation, Prisma client generation, and Git initialization. Flags allow for non-interactive setup and customization of project name, package manager, and branch. ```sh npx next-forge@latest init ``` ```sh npx next-forge@latest init \ --name my-saas \ --package-manager bun \ --branch main ``` ```sh npx next-forge@latest init --name my-saas --disable-git ``` ```sh npx next-forge@latest init --name my-saas --package-manager npm ``` -------------------------------- ### Install NUQS Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/addons/nuqs.mdx Install the NUQS library using npm. ```bash npm install nuqs ``` -------------------------------- ### Install @libsql/client for Turso Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/turso.mdx Install the `@libsql/client` package to enable connection to the Turso database. ```package-install npm install @libsql/client --filter @repo/database ``` -------------------------------- ### Install Mintlify CLI with npm Source: https://github.com/vercel/next-forge/blob/main/apps/docs/development.mdx Installs the Mintlify CLI globally using npm. Ensure Node.js is installed and meets the version requirements. ```bash npm i -g mintlify ``` -------------------------------- ### Start All Development Apps Source: https://github.com/vercel/next-forge/blob/main/skills/next-forge/references/setup.md Run this command to start all applications and services defined in the project for full local development. ```bash bun run dev ``` -------------------------------- ### Install Motion Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/addons/motion.mdx Install the Motion library using npm. ```bash npm install motion ``` -------------------------------- ### Install React Wrap Balancer Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/addons/react-wrap-balancer.mdx Install the react-wrap-balancer package using npm. ```bash npm install react-wrap-balancer ``` -------------------------------- ### Install Mintlify CLI with yarn Source: https://github.com/vercel/next-forge/blob/main/apps/docs/development.mdx Installs the Mintlify CLI globally using yarn. Ensure Node.js is installed and meets the version requirements. ```bash yarn global add mintlify ``` -------------------------------- ### Install Appwrite Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/storage/appwrite.mdx Install the necessary Appwrite packages for your storage provider. ```bash npm install node-appwrite appwrite --filter @repo/storage ``` -------------------------------- ### Install Fuse.js Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/addons/fuse.mdx Install the fuse.js library using npm. ```bash npm install fuse.js ``` -------------------------------- ### Install Appwrite Dependency Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/appwrite.mdx Install the Appwrite dependency for the `database` package. ```bash npm install node-appwrite --filter @repo/database ``` -------------------------------- ### Install Dub SDK Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/addons/dub.mdx Install the Dub SDK using npm to programmatically create links, manage customers, and track leads. ```bash npm install dub ``` -------------------------------- ### Start Docker Compose Services Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/deployment/docker.mdx Command to build and start all services defined in the docker-compose.yml file. ```bash docker compose up --build ``` -------------------------------- ### Install Next Safe Action Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/addons/next-safe-action.mdx Install next-safe-action and zod using npm. This command filters the installation to the 'app' package. ```bash npm install next-safe-action zod --filter app ``` -------------------------------- ### Run Development Server Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/setup/installation.mdx Start the development server to view the application. Open the localhost URLs with the relevant ports to access different parts of the app. ```bash npm run dev ``` -------------------------------- ### Check Node.js Version Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/setup/quickstart.mdx Verify that Node.js version 18 or higher is installed. This is a prerequisite for the project setup. ```sh node -v # Should be v18 or higher ``` -------------------------------- ### Start Mintlify Development Server Source: https://github.com/vercel/next-forge/blob/main/apps/docs/development.mdx Runs the Mintlify development server from your docs directory. This command makes your documentation website available locally. ```bash mintlify dev ``` -------------------------------- ### Install Paddle Dependency Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/payments/paddle.mdx Install the Paddle Node.js SDK as the new payment processor dependency. ```bash npm install @paddle/paddle-node-sdk --filter @repo/payments ``` -------------------------------- ### Create a User Endpoint Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/apps/api.mdx Example of creating a new GET endpoint for users in the API application. It fetches all users from the database. ```typescript import { database } from '@repo/database'; export const GET = async () => { const users = await database.user.findMany(); return Response.json(users); }; ``` -------------------------------- ### Start Prisma Studio Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/apps/studio.mdx Run this command in your terminal to start Prisma Studio. It runs on port 3005. ```sh bun dev --filter studio ``` -------------------------------- ### Install and Login to Stripe CLI Source: https://github.com/vercel/next-forge/blob/main/skills/next-forge/references/setup.md Install the Stripe CLI using Homebrew and log in to your Stripe account. This is necessary for local webhook testing. ```bash brew install stripe/stripe-cli/stripe stripe login ``` -------------------------------- ### Initialize Next-Forge Project Source: https://github.com/vercel/next-forge/blob/main/README.md Use this command to create a new Next-Forge project. Ensure you have Node.js 20+ and Bun installed. ```bash npx next-forge@latest init ``` -------------------------------- ### Install Joyful Package Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/addons/joyful.mdx Install the joyful package using npm. ```bash npm install joyful ``` -------------------------------- ### Run the app development server Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/examples/ai-chatbot.mdx Use this command to start the development server. Access the chatbot UI at http://localhost:3000. ```sh bun dev --filter app ``` -------------------------------- ### Install c15t Next.js Package Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/addons/c15t.mdx Install the c15t Next.js package using npm. ```bash npm install @c15t/nextjs ``` -------------------------------- ### OpenAPI Configuration Examples Source: https://github.com/vercel/next-forge/blob/main/apps/docs/essentials/settings.mdx Specify the path or URL to your OpenAPI file. Supports single or multiple OpenAPI files. ```json "openapi": "https://example.com/openapi.json" ``` ```json "openapi": "/openapi.json" ``` ```json "openapi": ["https://example.com/openapi1.json", "/openapi2.json", "/openapi3.json"] ``` -------------------------------- ### Start Specific Development App Source: https://github.com/vercel/next-forge/blob/main/skills/next-forge/references/setup.md Use this command to start a particular application or service within the project, specifying the app name with the --filter flag. ```bash bun dev --filter app # Port 3000 bun dev --filter web # Port 3001 bun dev --filter api # Port 3002 ``` -------------------------------- ### Install Prisma Accelerate Extension Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/prisma-postgres.mdx Install the necessary Prisma extension for Accelerate. This enables features like connection pooling and global caching. ```bash npm install @prisma/extension-accelerate ``` -------------------------------- ### Install ESLint Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/formatting/eslint.mdx Install the necessary ESLint and related plugin dependencies for your project. ```bash npm install -D eslint @next/eslint-plugin-next eslint-plugin-react eslint-plugin-react-hooks typescript-eslint ``` -------------------------------- ### Install Appwrite Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/authentication/appwrite.mdx Uninstall Clerk dependencies and install Appwrite packages for the auth package. ```bash npm uninstall @clerk/nextjs @clerk/themes @clerk/types --filter @repo/auth ``` ```bash npm install appwrite node-appwrite --filter @repo/auth ``` -------------------------------- ### Install PlanetScale Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/planetscale.mdx Install the necessary PlanetScale database and Prisma adapter packages for your database package. ```bash npm install @planetscale/database @prisma/adapter-planetscale --filter @repo/database ``` -------------------------------- ### Install Better Auth Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/authentication/better-auth.mdx Install the necessary Better Auth and Next.js packages for the @repo/auth package. ```bash npm install better-auth next --filter @repo/auth ``` -------------------------------- ### Install Prisma Pulse Extension Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/prisma-postgres.mdx Install the Prisma Pulse extension to enable real-time streaming of database change events. Note that Prisma Pulse may be deprecated. ```bash npm install @prisma/extension-pulse ``` -------------------------------- ### Turborepo Filtering Examples Source: https://github.com/vercel/next-forge/blob/main/skills/next-forge/references/architecture.md Illustrates how to run Turborepo commands for specific applications or packages using the `--filter` flag. ```bash bun dev --filter app # Only the main app ``` ```bash bun dev --filter web # Only the marketing site ``` ```bash bun build --filter @repo/database # Only the database package ``` -------------------------------- ### Run Email App Preview Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/apps/email.mdx To preview email templates, run the `email` app using the provided command. This command starts the development server for the email application. ```sh bun dev --filter email ``` -------------------------------- ### Configure Light Mode Toggle Source: https://github.com/vercel/next-forge/blob/main/apps/docs/essentials/settings.mdx Use `default` to set the initial mode and `isHidden` to hide the toggle. This example forces light mode. ```json { "modeToggle": { "default": "light", "isHidden": true } } ``` -------------------------------- ### Install Supabase Auth Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/authentication/supabase.mdx Install the necessary Supabase Auth dependencies for the @repo/auth package. ```bash npm install @supabase/supabase-js @supabase/ssr --filter @repo/auth ``` -------------------------------- ### Setup Server Authentication Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/authentication/better-auth.mdx Configure the server-side authentication using Better Auth, integrating with Prisma and Next.js cookies. ```typescript import { betterAuth } from 'better-auth'; import { nextCookies } from "better-auth/next-js"; import { prismaAdapter } from "better-auth/adapters/prisma"; import { database } from "@repo/database" export const auth = betterAuth({ database: prismaAdapter(database, { provider: 'postgresql', }), plugins: [ nextCookies() // organization() // if you want to use organization plugin ], //...add more options here }); ``` -------------------------------- ### Install Paddle JS SDK Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/payments/paddle.mdx Install the Paddle JS SDK using npm. This is a prerequisite for using the Paddle checkout hook. ```bash npm install @paddle/paddle-js --filter @repo/payments ``` -------------------------------- ### Install a New shadcn/ui Component Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/packages/design-system/components.mdx Use the shadcn CLI to install a new component into the Design System package. Specify the component name and the configuration path. ```sh npx shadcn@latest add select -c packages/design-system ``` -------------------------------- ### Setup Client Authentication Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/authentication/better-auth.mdx Initialize the client-side authentication functions using Better Auth's createAuthClient for React applications. ```typescript import { createAuthClient } from 'better-auth/react'; export const {signIn, signOut, signUp, useSession } = createAuthClient(); ``` -------------------------------- ### Install UploadThing Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/storage/upload-thing.mdx Install the necessary UploadThing packages for your project. This command targets the storage package within a monorepo. ```bash npm install uploadthing @uploadthing/react --filter @repo/storage ``` -------------------------------- ### Install Auth.js Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/authentication/authjs.mdx Add the Auth.js package to your auth package. ```bash npm install next-auth@beta --filter @repo/auth ``` -------------------------------- ### Install Content Collections Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/cms/content-collections.mdx Install the necessary Content Collections packages for MDX processing and core functionality. ```bash npm install @content-collections/mdx fumadocs-core --filter @repo/cms npm install -D @content-collections/cli @content-collections/core @content-collections/next --filter @repo/cms ``` -------------------------------- ### Create Appwrite Storage Bucket Programmatically Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/storage/appwrite.mdx Example of creating a storage bucket using the Appwrite SDK. Ensure you have the necessary permissions. ```typescript import { storage, Permission, Role } from '@repo/storage'; await storage.createBucket( 'uploads', 'uploads', [ Permission.read(Role.any()), Permission.create(Role.users()), Permission.update(Role.users()), Permission.delete(Role.users()), ], false, // fileSecurity true, // enabled 10 * 1024 * 1024, // maximumFileSize (10MB) ['jpg', 'jpeg', 'png', 'gif', 'webp', 'pdf'] // allowedFileExtensions ); ``` -------------------------------- ### Run Development Server Source: https://github.com/vercel/next-forge/blob/main/skills/next-forge/SKILL.md Starts the development server for all applications within the monorepo. Use filters to run specific apps. ```bash bun run dev bun dev --filter app bun dev --filter web ``` -------------------------------- ### Start Mintlify Development Server on Custom Port Source: https://github.com/vercel/next-forge/blob/main/apps/docs/development.mdx Starts the Mintlify development server on a specific port (e.g., 3333) using the --port flag. This is useful if the default port 3000 is already in use. ```bash mintlify dev --port 3333 ``` -------------------------------- ### Launch EdgeDB UI Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/edgedb.mdx Start the EdgeDB UI for managing your database and browsing data. This provides a graphical interface for your EdgeDB instance. ```bash npx edgedb ui ``` -------------------------------- ### Install Lemon Squeezy Dependency Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/payments/lemon-squeezy.mdx Install the new Lemon Squeezy JavaScript SDK using npm. This command filters the operation to the @repo/payments package. ```bash npm install @lemonsqueezy/lemonsqueezy.js --filter @repo/payments ``` -------------------------------- ### Configure Vercel Cron Job Source: https://github.com/vercel/next-forge/blob/main/skills/next-forge/references/packages.md Example JSON configuration for a Vercel Cron Job. Cron routes must use the `GET` HTTP method and can be tested locally via direct HTTP GET. ```json { "path": "/cron/keep-alive", "schedule": "0 1 * * *" } ``` -------------------------------- ### Install Drizzle Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/drizzle.mdx Add Drizzle ORM and its Neon serverless adapter, along with Drizzle Kit for development. ```bash npm install drizzle-orm @neondatabase/serverless --filter @repo/database npm install -D drizzle-kit --filter @repo/database ``` -------------------------------- ### Get Dictionary for Locale with @repo/internationalization Source: https://github.com/vercel/next-forge/blob/main/skills/next-forge/references/packages.md Retrieve the dictionary for a specific locale using `getDictionary`. This is part of the internationalization setup. ```typescript const dict = await getDictionary(locale); ``` -------------------------------- ### Configure Dark Mode Toggle Source: https://github.com/vercel/next-forge/blob/main/apps/docs/essentials/settings.mdx Use `default` to set the initial mode and `isHidden` to hide the toggle. This example forces dark mode. ```json { "modeToggle": { "default": "dark", "isHidden": true } } ``` -------------------------------- ### Open Paddle Checkout Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/payments/paddle.mdx Use the `usePaddle` hook to get the Paddle instance and open a checkout session. This example demonstrates opening a checkout for a specific price ID. ```tsx 'use client'; import { usePaddle } from '@repo/payments/checkout'; const Pricing = () => { const paddle = usePaddle(); function openCheckout(priceId: string) { paddle?.Checkout.open({ items: [ { priceId, quantity: 1, }, ], }); } return ( ); }; export default Pricing; ``` -------------------------------- ### Initialize Convex Development Environment Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/convex.mdx Run this command from your project root to set up Convex, log in, create a project, and generate necessary configuration files. ```sh npx convex dev ``` -------------------------------- ### Update Tailwind CSS Content Path Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/documentation/fumadocs.mdx Adjust the `content` property in `tailwind.config.mjs` to ensure styles are correctly applied, especially in monorepo setups. This is necessary if styles appear missing after starting the app. ```js export default { content: [ // from './node_modules/fumadocs-ui/dist/**/*.js', // to '../../node_modules/fumadocs-ui/dist/**/*.js', './components/**/*.{ts,tsx}', // ... ], }; ``` -------------------------------- ### Configure libSQL Client for Turso Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/turso.mdx Set up the `libsql` client in `packages/database/index.ts` using the provided `DATABASE_URL` and `DATABASE_AUTH_TOKEN` from your environment variables. ```ts import "server-only"; import { createClient } from "@libsql/client"; import { env } from "@repo/env"; const libsql = createClient({ url: env.DATABASE_URL, authToken: env.DATABASE_AUTH_TOKEN, }); export const database = libsql; ``` -------------------------------- ### Initialize EdgeDB Project Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/edgedb.mdx Initialize a new EdgeDB project within the @repo/database directory, linking it to your EdgeDB Cloud instance. Replace placeholders with your actual organization and instance names. ```bash npx edgedb project init --server-instance / --non-interactive ``` -------------------------------- ### Install EdgeDB Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/edgedb.mdx Install the necessary EdgeDB packages for your project. ```bash npm install edgedb @edgedb/generate ``` -------------------------------- ### Initialize Fumadocs App Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/documentation/fumadocs.mdx Use this command to quickly set up a new Fumadocs application. Assumes Fumadocs MDX, Tailwind CSS, and no default ESLint config are enabled. ```sh bunx create-fumadocs-app ``` -------------------------------- ### Install Zustand Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/addons/zustand.mdx Install Zustand using npm. This command adds the necessary package to your project's dependencies. ```bash npm install zustand ``` -------------------------------- ### Create a Blog Post MDX File Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/cms/content-collections.mdx Example of an MDX file for a blog post, including frontmatter with title, description, date, and image path. The file name is used as the slug. ```mdx --- title: 'My First Post' description: 'This is my first blog post' date: 2024-10-23 image: /blog/my-first-post.png --- ``` -------------------------------- ### Import and use a basic MDX snippet Source: https://github.com/vercel/next-forge/blob/main/apps/docs/essentials/reusable-snippets.mdx Import a snippet from the `snippets` directory into your destination file and render it as a component, passing any required props. ```mdx --- title: My title description: My Description --- import MySnippet from '/snippets/path/to/my-snippet.mdx'; ## Header Lorem impsum dolor sit amet. ``` -------------------------------- ### Stripe Client and AI Toolkit Usage Source: https://context7.com/vercel/next-forge/llms.txt Demonstrates creating a Stripe checkout session and retrieving customer subscriptions using the pre-configured Stripe client. Also shows how to use the `paymentsAgentToolkit` for AI-driven Stripe actions. ```typescript import { stripe } from "@repo/payments"; import { paymentsAgentToolkit } from "@repo/payments/ai"; // Create a Stripe checkout session const session = await stripe?.checkout.sessions.create({ mode: "subscription", line_items: [{ price: "price_xxx", quantity: 1 }], success_url: "https://app.example.com/success", cancel_url: "https://app.example.com/cancel", }); // → { id: "cs_live_...", url: "https://checkout.stripe.com/..." } // Retrieve a customer's subscriptions const subscriptions = await stripe?.subscriptions.list({ customer: "cus_xxx", status: "active", }); // Use the AI toolkit in a Vercel AI SDK tool chain import { generateText } from "ai"; import { openai } from "@ai-sdk/openai"; const result = await generateText({ model: openai("gpt-4o"), tools: paymentsAgentToolkit?.getTools(), prompt: "Create a $49/month subscription product called Pro Plan", }); ``` -------------------------------- ### Create Turso Database Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/turso.mdx Use the Turso CLI to create a new database. Replace `` with your desired name. ```sh turso db create ``` -------------------------------- ### Markdown Code Block Example Source: https://github.com/vercel/next-forge/blob/main/apps/docs/essentials/code.mdx Demonstrates how to render a fenced code block within Markdown. This is useful for displaying code examples directly in documentation. ```markdown ```java HelloWorld.java class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } ``` ``` -------------------------------- ### Initialize Next-Forge Project Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/examples/ai-chatbot.mdx Use this command to create a new Next.js project with next-forge, setting up the basic structure and dependencies for your application. ```bash npx next-forge@latest init ai-chatbot ``` -------------------------------- ### Scaffold Database with Prisma Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/setup/installation.mdx Use this command to scaffold the database using the schema defined in `packages/database/prisma/schema.prisma`. Refer to the Database Configuration Guide for details on the default Prisma configuration. ```bash npm run migrate ``` -------------------------------- ### Create New Documentation Page Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/apps/docs.mdx Add a new MDX file to the `apps/docs` directory to create a documentation page. The file name becomes the page slug, and frontmatter defines page metadata. ```mdx --- title: 'Quickstart' description: 'Start building modern documentation in under five minutes.' --- ``` -------------------------------- ### Get Resolved Theme with useTheme Hook Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/packages/design-system/dark-mode.mdx Use the useTheme hook from next-themes to get the currently resolved theme. This is useful for conditionally rendering UI elements based on the active theme. ```tsx import { useTheme } from 'next-themes'; const MyPage = () => { const { resolvedTheme } = useTheme(); return resolvedTheme === 'dark' ? 'Dark mode baby' : 'Light mode ftw'; } ``` -------------------------------- ### Install Novu Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/notifications/novu.mdx Add the new Novu notification dependencies to the notifications package. ```bash npm install @novu/api @novu/react --filter @repo/notifications ``` -------------------------------- ### Install Convex Dependency Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/convex.mdx Add the Convex package to your project's database package. ```bash npm install convex --filter @repo/database ``` -------------------------------- ### Uninstall Neon Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/convex.mdx Remove existing Neon and Prisma related packages before installing Convex. ```bash npm uninstall @neondatabase/serverless @prisma/adapter-neon @prisma/client prisma ws @types/ws --filter @repo/database ``` -------------------------------- ### Inline Code Example Source: https://github.com/vercel/next-forge/blob/main/apps/docs/essentials/code.mdx Use backticks (`) to denote inline code like `word` or `phrase`. ```markdown To denote a `word` or `phrase` as code, enclose it in backticks (`). ``` -------------------------------- ### Install Hypertune Dependencies Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/flags/hypertune.mdx Replace existing analytics dependencies with Hypertune and server-only packages in the feature-flags package. ```package-install npm uninstall @repo/analytics --filter @repo/feature-flags npm install hypertune server-only --filter @repo/feature-flags ``` -------------------------------- ### Set up Hypertune Client Instance Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/flags/hypertune.mdx Define a getHypertune function to initialize and configure the Hypertune SDK on the server, including user context and Vercel overrides. ```ts import 'server-only'; import { auth } from '@repo/auth/server'; import { noStore } from 'next/cache'; import type { ReadonlyHeaders } from 'next/dist/server/web/spec-extension/adapters/headers'; import type { ReadonlyRequestCookies } from 'next/dist/server/web/spec-extension/adapters/request-cookies'; import { createSource } from '../generated/hypertune'; import { getVercelOverride } from '../generated/hypertune.vercel'; import { keys } from '../keys'; const hypertuneSource = createSource({ token: keys().NEXT_PUBLIC_HYPERTUNE_TOKEN, }); export default async function getHypertune(params?: { headers?: ReadonlyHeaders; cookies?: ReadonlyRequestCookies; }) { noStore(); await hypertuneSource.initIfNeeded(); // Check for flag updates const { userId, orgId, sessionId } = await auth(); // Respect flag overrides set by the Vercel Toolbar hypertuneSource.setOverride(await getVercelOverride()); return hypertuneSource.root({ args: { context: { environment: process.env.NODE_ENV, user: { id: userId ?? '', sessionId: sessionId ?? '' }, org: { id: orgId ?? '' }, }, }, }); } ``` -------------------------------- ### Get file metadata Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/storage/appwrite.mdx Retrieves metadata for a specific file, including its name, size, and MIME type. ```APIDOC ## Get file metadata ### Description Fetches metadata for a given file. ### Method `storage.getFile(bucketId, fileId)` ### Parameters #### Path Parameters - **bucketId** (string) - Required - The ID of the bucket where the file is stored. - **fileId** (string) - Required - The ID of the file to retrieve metadata for. ### Request Example ```ts import { storage, bucketId } from '@repo/storage'; const file = await storage.getFile(bucketId, 'file-id'); console.log(file.name); // Original filename console.log(file.sizeOriginal); // File size in bytes console.log(file.mimeType); // MIME type ``` ### Response #### Success Response (200) - **name** (string) - The original filename. - **sizeOriginal** (integer) - The file size in bytes. - **mimeType** (string) - The MIME type of the file. ``` -------------------------------- ### Build and Run Docker Image Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/deployment/docker.mdx Commands to build a Docker image for a specific Next.js app (e.g., 'app') and run it, mapping the container's port 3000 to the host's port 3000 and using environment variables from a .env.local file. ```bash # Build the app docker build --build-arg APP_NAME=app -t next-forge-app . # Run it docker run -p 3000:3000 --env-file .env.local next-forge-app ``` -------------------------------- ### Fetch Store Data with Lemon Squeezy Client Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/payments/lemon-squeezy.mdx Example of using the payments client to fetch store data. This assumes the `getStore` function is available and configured for Lemon Squeezy. ```typescript import { getStore } from '@repo/payments'; const Page = async () => { const store = await getStore(123456); return (
{JSON.stringify(store, null, 2)}
); }; ``` -------------------------------- ### Get Turso Database URL Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/turso.mdx Fetch the connection URL for your newly created Turso database using the CLI. ```sh turso db show --url ``` -------------------------------- ### Initialize Auth.js NextAuth Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/authentication/authjs.mdx Replace existing client and server files with this basic Auth.js initialization. It sets up handlers, signIn, signOut, and auth functions. ```tsx import NextAuth from "next-auth"; export const { handlers, signIn, signOut, auth } = NextAuth({ providers: [], }); ``` -------------------------------- ### Replace Neon Dependencies with Supabase Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/database/supabase.mdx Remove Neon-specific npm packages and install the Supabase package for direct database connection. ```package-install npm uninstall @neondatabase/serverless @prisma/adapter-neon ws @types/ws --filter @repo/database ``` ```package-install npm install -D supabase --filter @repo/database ``` -------------------------------- ### Configure Appwrite Environment Variables Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/authentication/appwrite.mdx Add necessary Appwrite endpoint, project ID, and API key to your .env.local file. Ensure the API key is kept server-side. ```bash NEXT_PUBLIC_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1 NEXT_PUBLIC_APPWRITE_PROJECT_ID=your-project-id APPWRITE_API_KEY=your-api-key ``` -------------------------------- ### Configure Hypertune Build Scripts Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/migrations/flags/hypertune.mdx Add 'analyze' and 'build' scripts to the feature-flags package.json to enable Hypertune command execution. ```json { "scripts": { "analyze": "hypertune", "build": "hypertune" } } ``` -------------------------------- ### Link Applications with vercel link Source: https://github.com/vercel/next-forge/blob/main/docs/content/docs/packages/toolbar.mdx Run `vercel link` in each application directory to create a `.vercel/project.json` file. This step is optional but recommended for Vercel Toolbar integration. ```sh cd apps/app && vercel link && cd ../.. cd apps/web && vercel link && cd ../.. cd apps/api && vercel link && cd ../.. ```