create-next-app

Next.js ile çalışmaya başlamanın en kolay yolu create-next-app adresini kullanmaktır. Bu CLI aracı, her şeyi sizin için ayarlanmış yeni bir Next.js uygulaması oluşturmaya hızlı bir şekilde başlamanızı sağlar.

Varsayılan Next.js şablonunu kullanarak veya adresindeki resmi Next.js örneklerinden birini kullanarak yeni bir uygulama oluşturabilirsiniz.

Interactive

Çalıştırarak etkileşimli olarak yeni bir proje oluşturabilirsiniz:

Terminal
npx create-next-app@latest
Terminal
yarn create next-app
Terminal
pnpm create next-app
Terminal
bunx create-next-app

Daha sonra size aşağıdaki sorular sorulacaktır:

Terminal
What is your project named?  my-app
Would you like to use TypeScript?  No / Yes
Would you like to use ESLint?  No / Yes
Would you like to use Tailwind CSS?  No / Yes
Would you like to use `src/` directory?  No / Yes
Would you like to use App Router? (recommended)  No / Yes
Would you like to customize the default import alias (@/*)?  No / Yes

İstemleri yanıtladıktan sonra, yanıtlarınıza bağlı olarak doğru yapılandırmayla yeni bir proje oluşturulacaktır.

Non-interactive

Yeni bir projeyi etkileşimsiz olarak kurmak için komut satırı argümanlarını da iletebilirsiniz.

Ayrıca, öntanımlı seçenekleri önlerine --no- (örn. --no-eslint) ekleyerek olumsuzlayabilirsiniz.

Bkz. create-next-app --help:

Terminal
Usage: create-next-app <project-directory> [options]
 
Options:
  -V, --version                        output the version number
  --ts, --typescript
 
    Initialize as a TypeScript project. (default)
 
  --js, --javascript
 
    Initialize as a JavaScript project.
 
  --tailwind
 
    Initialize with Tailwind CSS config. (default)
 
  --eslint
 
    Initialize with ESLint config.
 
  --app
 
    Initialize as an App Router project.
 
  --src-dir
 
    Initialize inside a `src/` directory.
 
  --import-alias <alias-to-configure>
 
    Specify import alias to use (default "@/*").
 
  --use-npm
 
    Explicitly tell the CLI to bootstrap the app using npm
 
  --use-pnpm
 
    Explicitly tell the CLI to bootstrap the app using pnpm
 
  --use-yarn
 
    Explicitly tell the CLI to bootstrap the app using Yarn
 
  --use-bun
 
    Explicitly tell the CLI to bootstrap the app using Bun
 
  -e, --example [name]|[github-url]
 
    An example to bootstrap the app with. You can use an example name
    from the official Next.js repo or a public GitHub URL. The URL can use
    any branch and/or subdirectory
 
  --example-path <path-to-example>
 
    In a rare case, your GitHub URL might contain a branch name with
    a slash (e.g. bug/fix-1) and the path to the example (e.g. foo/bar).
    In this case, you must specify the path to the example separately:
    --example-path foo/bar
 
  --reset-preferences
 
    Explicitly tell the CLI to reset any stored preferences
 
  -h, --help                           output usage information

Why use Create Next App?

create-next-app saniyeler içinde yeni bir Next.js uygulaması oluşturmanızı sağlar. Next.js'nin yaratıcıları tarafından resmi olarak korunur ve bir dizi avantaj içerir: