0Pricing
NestJS Enterprise Backend APIs · 강의

프로젝트 구조와 CLI

CLI를 사용하여 새로운 NestJS 프로젝트를 초기화하고, 기본 폴더 구조를 이해하며, 구성 요소를 효율적으로 생성하는 방법을 학습합니다.

프로젝트 구조와 CLI은(는) CoddyKit의 무료 NestJS Enterprise Backend APIs 강의입니다. 이것은 3개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 NestJS Enterprise Backend APIs 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. NestJS Enterprise Backend APIs 강의에는 총 3개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

NestJS CLI: Your Development Ally

The NestJS CLI is your dev assistant — it scaffolds projects, generates boilerplate for modules and services, and runs your builds.

Get the CLI Up and Running

Install the CLI globally with npm i -g @nestjs/cli (Node and npm required first). The -g flag makes the nest command available everywhere.

Starting a New NestJS App

Create a project with nest new my-first-backend. The CLI asks for a package manager, then sets up files, dependencies, and boilerplate.

Understanding the Project Layout

A new project's layout: src/ holds your code, node_modules/ the dependencies, test/ e2e tests, and dist/ the compiled output.

Core Application Files in `src`

Inside src/ are the core files: main.ts bootstraps the app, app.module.ts is the root module, plus a starter controller and service.

`main.ts`: Application Entry Point

main.ts is the entry point: NestFactory.create() builds the app and app.listen() starts the server, usually on port 3000.

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  await app.listen(3000);
  console.log(`Application is running on: ${await app.getUrl()}`);
}
bootstrap();

Building Blocks: A Simple Class

NestJS runs on classes — controllers, services, and modules are all TypeScript classes. This runnable snippet shows the basic class structure.

class Greeter {
  name: string;

  constructor(name: string) {
    this.name = name;
  }

  greet(): string {
    return `Hello, ${this.name}! Welcome to CoddyKit.`;
  }
}

// This is the entry point for running the example
function main() {
  const greeter = new Greeter("NestJS Learner");
  console.log(greeter.greet());
}

main();

Streamline with `nest generate`

As the app grows, use nest generate (or nest g) to scaffold modules, controllers, services, guards, pipes — and auto-wire them in.

CLI in Action: New Module

For a Users feature, run nest g module users. The CLI creates the folder and users.module.ts, then registers it in your root AppModule.

Test Your CLI Knowledge

You've learned about the NestJS CLI and how it helps set up and structure your project.

Which CLI command is used to quickly create a new NestJS project named my-api?

Summary: CLI & Project Setup

You used the CLI: installed it, created a project with nest new, explored the layout, and scaffolded components with nest generate.

자주 묻는 질문

“프로젝트 구조와 CLI” 강의는 무료인가요?

네 — “프로젝트 구조와 CLI” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 NestJS Enterprise Backend APIs 강의 전체를 잠금 해제할 수 있습니다. NestJS Enterprise Backend APIs 강의에는 총 3개의 강의가 포함되어 있습니다.

“프로젝트 구조와 CLI”에서 뭘 배우나요?

CLI를 사용하여 새로운 NestJS 프로젝트를 초기화하고, 기본 폴더 구조를 이해하며, 구성 요소를 효율적으로 생성하는 방법을 학습합니다. 브라우저에서 직접 실행하는 실습 코드로 NestJS Enterprise Backend APIs을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

NestJS Enterprise Backend APIs을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 NestJS Enterprise Backend APIs은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 3개 중 2번째 강의입니다.

“프로젝트 구조와 CLI” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 NestJS Enterprise Backend APIs 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 NestJS Enterprise Backend APIs 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. NestJS 프레임워크 소개
  2. 프로젝트 구조와 CLI
  3. 모듈, 컨트롤러, 서비스
← NestJS Enterprise Backend APIs(으)로 돌아가기