# 1. Project setup

### Initialize repository ​ <a href="#initialize-repository" id="initialize-repository"></a>

#### Create working directory ​ <a href="#create-working-directory" id="create-working-directory"></a>

Let's start from scratch from an empty directory:

```bash
# create folder & jump into it
mkdir vault-bot && cd vault-bot

# init your git repository
git init
```

#### Mark un-needed files as ignored for Git ​ <a href="#mark-un-needed-files-as-ignored-for-git" id="mark-un-needed-files-as-ignored-for-git"></a>

Create a `.gitignore` file with this content to ignore the `node_modules` folder & the env file (we will create it on next steps):

{% tabs %}
{% tab title=".gitignore" %}

```tsconfig
node_modules
.env
```

{% endtab %}
{% endtabs %}

### Initialize Typescript package ​ <a href="#initialize-typescript-package" id="initialize-typescript-package"></a>

#### Create the Node.js package ​ <a href="#create-the-node-js-package" id="create-the-node-js-package"></a>

This command will create the `package.json` with default content:

```bash
# using `-y` option will make the init use all the defaults options
npm init -y
```

#### Install dependencies ​ <a href="#install-dependencies" id="install-dependencies"></a>

Install the production dependencies:

```bash
npm install --save axios dotenv
```

Then install the development dependencies:

```bash
npm install --save-dev typescript tsx @types/node
```

#### Initialize Typescript configuration ​ <a href="#initialize-typescript-configuration" id="initialize-typescript-configuration"></a>

Run this init command to create the `tsconfig.json` with default values:

```bash
./node_modules/.bin/tsc --init
```

If everything worked correctly, you should have now a `tsconfig.json` file at the root of the repo.

***

### Setup the main script ​ <a href="#setup-the-main-script" id="setup-the-main-script"></a>

#### Create the script file ​ <a href="#create-the-script-file" id="create-the-script-file"></a>

Let's create a `main.ts` file that will contain our code:

{% tabs %}
{% tab title="main.ts" %}

```tsconfig
console.log("Hello world!");
```

{% endtab %}
{% endtabs %}

#### Add a npm script to run it ​ <a href="#add-a-npm-script-to-run-it" id="add-a-npm-script-to-run-it"></a>

Edit the `package.json` file to add a new script entry. Let's remove the `test` script and add a `dev` script:

{% tabs %}
{% tab title="package.json" %}

```json
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
    "dev": "tsx main.ts"
  },
  "keywords": [],
  "author": "",
```

{% endtab %}
{% endtabs %}

#### Verify that the setup works ​ <a href="#verify-that-the-setup-works" id="verify-that-the-setup-works"></a>

Now, you can run this command to check that everything is OK:

bash

```bash
npm run dev
```

That should output:

```
> vault-bot@1.0.0 dev
> tsx main.tsx

Hello world!
```

Congratulations 🎉, we are ready to move to next step.
