npm create astro@latest -- --template minimal
🧑🚀 Seasoned astronaut? Delete this file. Have fun!
Inside of your Astro project, you'll see the following folders and files:
/
├── public/
├── src/
│ └── pages/
│ └── index.astro
└── package.json
Astro looks for .astro
or .md
files in the src/pages/
directory. Each page is exposed as a route based on its file name.
There's nothing special about src/components/
, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
Any static assets, like images, can be placed in the public/
directory.
All commands are run from the root of the project, from a terminal:
Command | Action |
---|---|
npm install |
Installs dependencies |
npm run dev |
Starts local dev server at localhost:4321 |
npm run build |
Build your production site to ./dist/ |
npm run preview |
Preview your build locally, before deploying |
npm run astro ... |
Run CLI commands like astro add , astro check |
npm run astro -- --help |
Get help using the Astro CLI |
This is a project written in Typescript programming language, with the use of Astro web development framework which allows us to use multiple frontend frameworks, including the React UI development library.
- TypeScript: the programming language "JavaScript with types". It doesn't render anything, it's a programming language.
- React: a library specifically for building user interfaces focusing on rendering interactive UIs.
- Astro: a web framework and a static site generator used for building static websites which supports multiple frontend frameworks. It renders static HTML with optional JavaScript for interactivity.
Follow Astro's official website: Install and set up Astro.
- React and React DOM:
npm install react react-dom
- Swiper (for swiper/react, swiper/modules, and swiper/css):
npm install swiper
- Emotion (for @emotion/styled and @emotion/react):
npm install @emotion/styled @emotion/react
- @astrojs/react:
npx astro add react
, otherwise the problem of No matching renderer found will persist and the terminal will run the project. If the previous command to install @astrojs/react doesn't work, please read this page to try to install manually. - vite-plugin-compression:
npm i vite-plugin-compression
- @astrojs/sitemap:
npm i @astrojs/sitemap
Translate all the astro pages (i.e. all the astro files under the folder pages
).
A tsx file can't contain an astro file; an astro file can contain a tsx file. npm install react-i18next i18next [email protected] --save https://react.i18next.com/getting-started and https://www.npmjs.com/package/i18next-browser-languagedetector/v/3.0.0 if there are vulnerabilities: follow the terminal's instructions.
Feel free to check our documentation or jump into our Discord server.