> For the complete documentation index, see [llms.txt](https://whs3-doge5k.gitbook.io/smartcontract-security-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whs3-doge5k.gitbook.io/smartcontract-security-docs/basics/6.-foundry/forge/forge-init.md).

# forge init

## 프로젝트 생성

### &#x20;명령어 형식

```bash
$ forge init [프로젝트명]
```

위 명령어를 입력하면 Foundry 프로젝트가 생성된다.\
명령어 실행 시 기본적인 폴더 구조와 설정 파일들이 자동으로 생성된다.

***

### 폴더 구조

프로젝트 폴더 내부는 다음과 같은 구조로 구성되어 있다.

| 폴더/파일명       | 설명                                                                   |
| ------------ | -------------------------------------------------------------------- |
| foundry.toml | 프로젝트 전체 설정을 담당하는 설정 파일이다. 네트워크, 컴파일러 버전, 라이브러리 경로 등을 지정할 수 있다.       |
| src/         | 스마트 컨트랙트 소스 코드가 위치하는 폴더이다. 직접 작성한 .sol 파일들을 이곳에 저장한다.                |
| test/        | 테스트용 스마트 컨트랙트 코드가 위치하는 폴더이다. forge test 명령어로 실행할 테스트 코드를 작성한다.       |
| lib/         | 외부 라이브러리 및 의존성 패키지가 저장되는 폴더이다. 예를 들어 OpenZeppelin 라이브러리 등이 여기에 설치된다. |
| script/      | 스마트 컨트랙트 배포 및 기타 작업을 위한 스크립트가 위치하는 폴더이다. 자동화된 배포 코드를 작성할 때 사용한다.     |

GUI로 살펴보면 이렇다.&#x20;

<figure><img src="https://2462457462-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLf9vwRuaws92ULgGvzTi%2Fuploads%2Fxg83cAlN9riRUFFiQpsR%2Fimage%20(1).png?alt=media&amp;token=538fdaa1-1f46-45ad-acbf-47b6338efa0b" alt=""><figcaption></figcaption></figure>
