src/content/docs/en/tutorial/1-setup/2.mdx
import Checklist from '/components/Checklist.astro';
import Box from '/components/tutorial/Box.astro';
import InstallGuideTabGroup from '/components/TabGroup/InstallGuideTabGroup.astro';
import PackageManagerTabs from '/components/tabs/PackageManagerTabs.astro';
import PreCheck from '/components/tutorial/PreCheck.astro';
import { Steps } from '@astrojs/starlight/components';
import Badge from "/components/Badge.astro"
The preferred way to create a new Astro site is through our create astro setup wizard.
<PackageManagerTabs>
<Fragment slot="npm">
```shell
# create a new project with npm
npm create astro@latest
```
</Fragment>
<Fragment slot="pnpm">
```shell
# create a new project with pnpm
pnpm create astro@latest
```
</Fragment>
<Fragment slot="yarn">
```shell
# create a new project with yarn
yarn create astro
```
</Fragment>
</PackageManagerTabs>
2. Enter y to install create-astro.
3. When the prompt asks you where to create the project, type in the name of a folder to create a new directory for your project, e.g.
./tutorial
:::note
A new Astro project can only be created in a completely empty folder, so choose a name for your folder that does not already exist!
:::
4. You will see a short list of starter templates to choose from. Use the arrow keys (up and down) to navigate to the minimal (empty) template, and then press return (enter) to submit your choice.
When the prompt asks you whether or not to install dependencies, enter y.
When the prompt asks you whether or not to initialize a new git repository, enter y.
When the install wizard is complete, you no longer need this terminal. You can now open VS Code to continue.
If this is your first time opening an Astro project, you should see a notification asking if you would like to install recommended extensions. Click to see the recommended extensions, and choose the Astro language support extension. This will provide syntax highlighting and autocompletions for your Astro code.
Make sure the terminal is visible and that you can see the command prompt, such as:
user@machine:~/tutorial$
:::tip[Keyboard shortcut] To toggle the visibility of the terminal, use <kbd>Ctrl + J</kbd> (macOS: <kbd>Cmd ⌘ + J</kbd>). :::
</Steps>You can now use the terminal built right into this window, instead of your computer's Terminal app, for the rest of this tutorial.
In order to preview your project files as a website while you work, you will need Astro to be running in development (dev) mode.
<PackageManagerTabs>
<Fragment slot="npm">
```shell
npm run dev
```
</Fragment>
<Fragment slot="pnpm">
```shell
pnpm run dev
```
</Fragment>
<Fragment slot="yarn">
```shell
yarn run dev
```
</Fragment>
</PackageManagerTabs>
Now you should see confirmation in the terminal that Astro is running in dev mode. 🚀
Your project files contain all the code necessary to display an Astro website, but the browser is responsible for displaying your code as web pages.
<Steps> 11. Click on the `localhost` link in your terminal window to see a live preview of your new Astro website!(Astro uses `http://localhost:4321` by default if port `4321` is available.)
Here's what the Astro "Empty Project" starter website should look like in the browser preview:

:::tip[Using the Astro dev server]
While the Astro server is running in dev mode, you will NOT be able to run commands in your terminal window. Instead, this pane will give you feedback as you preview your site.
You can stop the dev server at any time and return to the command prompt by typing <kbd>Ctrl + C</kbd> in the terminal.
Sometimes the dev server will stop on its own while you are working. If your live preview stops working, go back to the terminal and restart the dev server by typing npm run dev.
:::