Project Setup

Avatar of Hemanta SundarayHemanta Sundaray

Follow the steps below to create a Node.js project:

Creating a Project

Create a new directory and initialize a Node.js project:

Terminal
mkdir effect-config
cd effect-config
pnpm init

Installing Dependencies

Run the following command to install the required packages:

Terminal
pnpm add effect@4.0.0-beta.50
pnpm add -D typescript tsx @types/node

Configuring the Project

Add "type": "module" to your package.json to enable ES modules:

package.json
{
"name": "effect-config",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "module",
"packageManager": "pnpm@10.28.0",
"dependencies": {
"effect": "4.0.0-beta.50"
},
"devDependencies": {
"@types/node": "^25.6.0",
"tsx": "^4.21.0",
"typescript": "^6.0.3"
}
}

Create a tsconfig.json in the project root:

tsconfig.json
{
"compilerOptions": {
"target": "ES2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "./dist"
},
"include": ["*.ts"]
}

Creating a TypeScript File

Create a file named config.ts in the project root. This is the file where we’ll write all of our code.

Running TypeScript Files

To run a file, use the command npx tsx followed by the file name:

Terminal
npx tsx config.ts

Sign in to save progress

Stay in the loop

Get notified when new Effect Foundation courses are released.