Skip to content

Instantly share code, notes, and snippets.

@scrubmx
Created September 2, 2025 18:35
Show Gist options
  • Save scrubmx/4ebc01f4e3a032582e16a0d7eb2644c8 to your computer and use it in GitHub Desktop.
Save scrubmx/4ebc01f4e3a032582e16a0d7eb2644c8 to your computer and use it in GitHub Desktop.
Build a Next.js App with ONE Prompt (Gemini CLI)

Generate and run a shell command to create a new Next.js application.
First, ask the user to provide an "Application Name". Then, use their input to replace every instance of [APP_NAME].

Project Specifications:

  • Application Name: [APP_NAME]
  • Framework: Next.js (latest version)
  • Language: TypeScript & ESLint
  • Styling: Tailwind CSS
  • UI Components: shadcn/ui
  • Testing: Vitest with React Testing Library
  • Project Structure: App Router, no /src directory, @/* import alias
  • Development Server: Use Turbopack
  • Version Control: Git

Script Instructions:

  1. Chain Commands: Use the && operator to link all commands together.
  2. Create Next.js App: Start with npx create-next-app@latest [APP_NAME] --yes and include all the necessary flags (--typescript, --tailwind, --eslint, --app, --no-src-dir, --import-alias "@/*") to run it non-interactively.
  3. Initialize shadcn/ui: After changing into the new [APP_NAME] directory with cd, run npx shadcn@latest init with the -y flag to accept all default settings, which match our project's configuration. This avoids all interactive prompts.
  4. Install Vitest: Install vitest, @vitejs/plugin-react, jsdom, and @testing-library/react as development dependencies.
  5. Create Vitest Config: Use an echo command to create and write the contents of vitest.config.ts in a single step. The config must include the @/* path alias.
  6. Add Test Scripts: Use the npm pkg set command to add the "test": "vitest" and "test:ui": "vitest --ui" scripts directly to package.json.
  7. Initialize Git: Initialize a Git repository and make the first commit.
  8. Final Output: The script should conclude by printing a confirmation message with the next steps for the user (how to cd into the [APP_NAME] directory and run the dev server). Do not attempt to run the server automatically.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment