AI Hints
Home›Angular Tutorial›What You Need, Creating a Project and The Project Structure
Angular · Lesson 5 of 120

Creating a Project

Ng new.

⏱ 2 min read▶ Video at 5:06🎓 Free
Watch this lesson in the Angular courseWatch on YouTube ↗Full Angular course

The Angular CLI creates a complete, working project for us, with one command. Every file is ready, so we can start coding straight away.

  • One command
  • A complete project
  • Start coding

What ng new does

ng new asks a few questions, like which style sheet format to use. It creates the project folder, with all the files. Then npm installs the packages the project needs. And the project is ready to run.

  1. ng new shop
  2. A few questions
  3. Creates the files
  4. npm install
  5. Ready to run

Creating the shop project

We create a project called shop. We answer the questions with options, plain CSS, and no server side rendering. The CLI creates about twenty files. The skip install option leaves the package install for the next step.

Terminal
ng new shop --style=css --ssr=false --skip-install --ai-config=none
CREATE shop/.prettierrc (161 bytes)
CREATE shop/README.md (1457 bytes)
CREATE shop/.editorconfig (314 bytes)
CREATE shop/.gitignore (622 bytes)
CREATE shop/angular.json (1897 bytes)
CREATE shop/package.json (780 bytes)
CREATE shop/tsconfig.json (908 bytes)
CREATE shop/tsconfig.app.json (398 bytes)
CREATE shop/tsconfig.spec.json (409 bytes)
CREATE shop/.vscode/extensions.json (130 bytes)
CREATE shop/.vscode/launch.json (470 bytes)
CREATE shop/.vscode/tasks.json (978 bytes)
CREATE shop/src/main.ts (222 bytes)
CREATE shop/src/index.html (290 bytes)
CREATE shop/src/styles.css (80 bytes)
CREATE shop/src/app/app.css (0 bytes)
CREATE shop/src/app/app.spec.ts (678 bytes)
CREATE shop/src/app/app.ts (287 bytes)
CREATE shop/src/app/app.html (20144 bytes)
CREATE shop/src/app/app.config.ts (312 bytes)
CREATE shop/src/app/app.routes.ts (77 bytes)
CREATE shop/public/favicon.ico (15086 bytes)
    Successfully initialized git.

Installing the packages

We move into the new folder. Then npm install downloads Angular, and everything it needs, into node modules. It takes a little while, the first time.

Terminal
cd shop
npm install
added 288 packages, and audited 289 packages in 6s

89 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Summary

ng new creates a complete project, and npm install adds its packages. Next, a tour of the files it created.

Key takeaways
  • ng new shop
  • --style=css
  • npm install
Next up: The Project Structure — a tour of the files