VS Code: How to Create a New Project
In this article
To create a new project in VS Code, you open a folder that will contain your project files—VS Code doesn't have a "New Project" wizard like some IDEs. You do this by selecting File > Open Folder (or Open… on macOS) and choosing an empty or existing folder, then adding files and folders as needed.
What “Project” Means in VS Code
Unlike Visual Studio or IntelliJ, VS Code is a code editor, not a full integrated development environment. It treats a “project” as simply a folder on your disk. All your settings, search results, and source control operations are scoped to that folder. This folder-based approach keeps VS Code lightweight and flexible—you can open any directory, even one with no code, and start working immediately.
When you open a folder, VS Code creates a hidden .vscode subfolder inside it (if needed) to store workspace-specific settings, tasks, and debug configurations. These settings override your user-level preferences and travel with the project if you share the folder.
Step-by-Step: Creating a New Project
- Open VS Code.
- Click File in the menu bar.
- Select Open Folder… (Windows/Linux) or Open… (macOS).
- In the dialog, navigate to where you want the project folder to live.
- Click New Folder (or create one beforehand) and give it a name, e.g.,
my-awesome-app. - Select that new folder and click Select Folder / Open.
You now have an empty project. To add files, use File > New File (Ctrl+N on Windows/Linux, Cmd+N on macOS) and save it inside the folder. You can also create subfolders via the Explorer sidebar’s “New Folder” icon.
Using the Terminal to Scaffold a Project
For most real projects, you’ll use a command-line tool to generate the initial structure. VS Code has an integrated terminal (View > Terminal or Ctrl+`), so you can run these commands without leaving the editor. For example:
- Node.js:
npm init -ycreates apackage.json. - React:
npx create-react-app my-app(ornpm create vite@latest my-appfor Vite). - Python:
python -m venv venvcreates a virtual environment. - Angular:
ng new my-app(requires Angular CLI installed).
After running the scaffold, open the generated folder in VS Code using code . from the terminal (if the code command is installed) or via File > Open Folder.
How to Choose the Right Folder Structure
There’s no one-size-fits-all, but a few common patterns help:
- Flat structure – all files in one folder, fine for tiny scripts or single-file utilities.
- Feature-based – group files by feature (e.g.,
auth/,payment/) – common in larger apps. - Layer-based – separate
controllers/,models/,views/– typical for MVC frameworks. - Monorepo – multiple projects in one folder, each with its own subfolder and often a root
package.json.
For a simple project, start with a single folder and add subfolders as you grow. VS Code doesn’t enforce any structure, so you’re free to reorganize later.
Common Problems and Fixes
- “Open Folder” is grayed out? This happens if you’re in a special mode like “Workspace Trust” or if you’re already in a window with no folder. Close all tabs and try again.
- Can’t find the folder in Explorer? Make sure you’re looking at the Explorer view (Ctrl+Shift+E) and not the Search or Source Control panel.
- Terminal doesn’t start in the right directory? Use
cd /path/to/your/projectin the terminal, or right-click on the folder in Explorer and select “Open in Integrated Terminal”. - Scaffold command not found? The tool (e.g.,
create-react-app) may not be installed globally. Try usingnpx(for npm packages) or install the CLI first.
VS Code vs. Full IDEs for Project Creation
Full IDEs like Visual Studio or Eclipse have built-in project templates—you pick “Console App” or “Web Application” and it generates a whole structure. VS Code intentionally leaves this to you and external tools. This means more flexibility but a steeper learning curve for beginners. However, once you’re comfortable with the terminal, creating a project is often faster in VS Code because you can reuse your favorite scaffold commands.
If you prefer a GUI, you can install extensions like “Project Manager” that let you save and quickly switch between folders, but the core workflow remains folder-based.
Frequently Asked Questions
How do I create a new file inside my project?
Right-click on the folder in the Explorer sidebar and choose “New File”, or use File > New File and then save it (Ctrl+S) into the desired location. You can also type Ctrl+N to create an untitled file and then save it with a name.
Can I have multiple projects open at once?
Yes. You can open multiple VS Code windows, each with a different folder. Alternatively, you can add folders to the same window via File > Add Folder to Workspace, which creates a multi-root workspace—useful for related projects.
What is a workspace vs. a folder?
A folder is a single directory. A workspace can be one folder or multiple folders plus configuration settings, saved as a .code-workspace file. When you open a single folder, VS Code treats it as a workspace automatically.
How do I open an existing project?
Use File > Open Folder and select the folder that contains your project. If you recently opened it, you can find it under File > Open Recent.
Why does VS Code ask to trust the folder?
This is a security feature introduced to prevent malicious code in workspace settings from running automatically. If you trust the source of the folder, click “Yes, I trust the authors”. You can manage trust settings in File > Preferences > Workspace Trust.
Do I need to create a project before writing code?
No. You can open any folder and start writing files immediately. The “project” is just a way to organize your work—VS Code doesn’t require any special metadata until you add tasks or debug configurations.