DEV Community

Andreas Riedmüller
Andreas Riedmüller

Posted on • Edited on

15 1 2 1

Two+ things I do every time I set up a new node project

1. Early first commit

Committing regularly is a very good habit. And there is one point in time where it is especially helpful, right after you created a new project and BEFORE you type the first character in your project.

For example, right after creating a new Vite project (or bootstrapping with any other template):

git init
git add --all
git commit -m "blank vite react/typescript project"
Enter fullscreen mode Exit fullscreen mode

This way you can easily spot what you have done and what has been created by create vite@latest for example.

2. Create a .nvmrc file

Working with different versions of Node on the same project might cause unnecessary trouble. So the second thing I do after setting up a node project is to create a .nvmrc file in the project root.

node --version > .nvmrc
git add .nvmrc
git commit -m "created .nvmrc file"
Enter fullscreen mode Exit fullscreen mode

This will create a file named .nvmrc with this content:

v18.16.0
Enter fullscreen mode Exit fullscreen mode

Having done that, any developer can just run nvm use in the project folder and nvm will automatically switch to the correct version of node.

💡Pro Tip You can set up a script that will automatically call nvm use whenever you enter a directory that contains an .nvmrc

(3. Install node's types)

If working with TypeScript I also install the types package for node. Sooner or later you will need this.

npm install @types/node -D
Enter fullscreen mode Exit fullscreen mode

(4. Add a jsconfig.json)

If you are going to use an editor that uses LSP (VSCode, Sublime Text, etc.) make sure you have a jsconfig.json (or tsconfig.json) file for your project. Not having this file might bring you into trouble.

Warp.dev image

Warp is the #1 coding agent.

Warp outperforms every other coding agent on the market, and gives you full control over which model you use. Get started now for free, or upgrade and unlock 2.5x AI credits on Warp's paid plans.

Download Warp

Top comments (2)

Collapse
 
lukkea profile image
lukkea • Edited

Hey Andreas, good tips here, thanks.
You've got a typo in (3. Install node's types): should be a slash between @types/node
🙂

Collapse
 
receter profile image
Andreas Riedmüller

Ah yes, thanks for pointing it out 🙏

Gen AI apps are built with MongoDB Atlas

Gen AI apps are built with MongoDB Atlas

MongoDB Atlas is the developer-friendly database for building, scaling, and running gen AI & LLM apps—no separate vector DB needed. Enjoy native vector search, 115+ regions, and flexible document modeling. Build AI faster, all in one place.

Start Free

👋 Kindness is contagious

Explore this insightful write-up, celebrated by our thriving DEV Community. Developers everywhere are invited to contribute and elevate our shared expertise.

A simple "thank you" can brighten someone’s day—leave your appreciation in the comments!

On DEV, knowledge-sharing fuels our progress and strengthens our community ties. Found this useful? A quick thank you to the author makes all the difference.

Okay