Introduction
SharePoint Framework (SPFx) is Microsoft's recommended development framework for building modern, responsive, and customizable solutions for SharePoint Online and Microsoft 365. It allows developers to create client-side web parts, extensions, and custom user experiences using technologies such as TypeScript, React, HTML, and CSS.
SPFx solutions run directly within the SharePoint environment and can interact with SharePoint Lists, Libraries, Microsoft Graph, and other Microsoft 365 services.
In this article, we will set up a complete SPFx development environment from scratch and create our first SharePoint Web Part.
Below is the complete step-by-step setup for SharePoint Framework (SPFx) Web Part development on Windows, starting from a fresh machine.
Recommended approach: Use SPFx + React + TypeScript + VS Code for SharePoint Online development.
Step 1 — Install Node.js
Download the Node.js version supported by the SPFx version you plan to use.
After installation, open Command Prompt:
node --versionnpm --version
Keep note of both versions.
Important: Don't automatically use the newest Node.js release. SPFx versions have specific Node.js compatibility requirements.
Step 2 — Install Visual Studio Code
Download: Visual Studio Code
Install it with the default options.
Verify:
code --versionStep 3 — Install Git
Download: Git for Windows
Install using the default options.
Verify:
git --versionStep 4 — Install Yeoman
Open Command Prompt as Administrator.
Run:
npm install -g yoVerify:
yo --versionStep 5 — Install SharePoint Framework Generator
Run:
npm install -g @microsoft/generator-sharepointVerify:
npm list -g @microsoft/generator-sharepoint --depth=0You should see something similar to:
@microsoft/[email protected]Step 6 — Create an SPFx project folder
Create a development folder:
mkdir C:\SPFxMove into it:
cd C:\SPFxCreate a project folder:
mkdir MyFirstWebPart
cd MyFirstWebPartStep 7 — Create the SPFx project
Run:
yo @microsoft/sharepointThe generator will ask several questions.
Example answers
Solution name:
MyFirstWebPartWhich type of client-side component to create?
WebPartWhat is your Web part name?
MyFirstWebPartWhich framework would you like to use?
ReactFor a modern project, React is a good choice.
Step 8 — Open the project in VS Code
After the generator finishes:
code .Your project will look approximately like:
MyFirstWebPart
│
├── config
├── node_modules
├── src
│ └── webparts
│ └── myFirstWebPart
│ ├── MyFirstWebPart.ts
│ ├── MyFirstWebPart.module.scss
│ ├── components
│ └── loc
│
├── sharepoint
├── package.json
├── tsconfig.json
├── gulpfile.js
└── README.mdStep 9 — Install project dependencies
Inside the project folder:
npm installWait until installation completes.
Step 10 — Build the project
Run:
gulp buildIf everything is correct, you should see a successful build.
You can also run:
gulp bundleStep 11 — Trust the local development certificate
For local SPFx development, run:
gulp trust-dev-certIf Windows asks for permission to trust the certificate, accept it.
Step 12 — Start the local SPFx server
Run:
gulp serveYou should get a local URL similar to:
https://localhost:4321/temp/workbench.htmlOpen it in your browser.
Step 13 — Test your Web Part
The SharePoint Framework Workbench should open.
VS Code
↓
Edit SPFx Code
↓
gulp serve
↓
Local Workbench
↓
Test Web PartYour development flow is now:
Step 14 — Connect to your SharePoint site
For SharePoint Online development, you can also use the hosted workbench:
https://YOUR-TENANT.sharepoint.com/sites/YOUR-SITE/_layouts/15/workbench.aspxFor example:
https://contoso.sharepoint.com/sites/Development/_layouts/15/workbench.aspxThis allows you to test your web part against SharePoint.
Step 15 — Create a production build
When your development is complete, run:
gulp cleanThen:
gulp bundle --shipThen:
gulp package-solution --shipThe SharePoint package will be created under:
sharepoint└── solution
└── my-first-web-part.sppkg
Step 16 — Open SharePoint App Catalog
Go to your SharePoint App Catalog.
Upload the generated:
.sppkgfile.
SharePoint will ask whether you want to make the solution available to sites.
Choose the appropriate option for your organization.
Step 17 — Add the SPFx app to your SharePoint site
Go to your SharePoint site.
Select:
Settings → Add an app
or open:
Site contents → New → App
Find your SPFx solution and add it.
Step 18 — Add the Web Part to a SharePoint page
Open a SharePoint page.
Click:
Edit → + Add a new web part
Find:
MyFirstWebPartAdd it to the page.
Publish the page.
Your SPFx Web Part is now running in SharePoint Online.
Complete command list
Once the prerequisites are installed, the basic commands are:
npm install -g yo
npm install -g @microsoft/generator-sharepoint
mkdir C:\SPFx
cd C:\SPFx
mkdir MyFirstWebPart
cd MyFirstWebPart
yo @microsoft/sharepoint
npm install
gulp build
gulp trust-dev-cert
gulp serveFor deployment:
gulp clean
gulp bundle --ship
gulp package-solution --shipThen upload:
sharepoint/solution/*.sppkgto the SharePoint App Catalog.
Final SPFx development flow
1. Install Node.js
↓
2. Install VS Code
↓
3. Install Git
↓
4. Install Yeoman
↓
5. Install SharePoint Generator
↓
6. Create SPFx project
↓
7. Select Web Part
↓
8. Select React
↓
9. npm install
↓
10. gulp build
↓
11. gulp trust-dev-cert
↓
12. gulp serve
↓
13. Test Web Part
↓
14. Develop in VS Code
↓
15. gulp bundle --ship
↓
16. gulp package-solution --ship
↓
17. Upload .sppkg to App Catalog
↓
18. Add app to SharePoint
↓
19. Add Web Part to SharePoint pageRecommended first project
For learning, create a simple Employee Directory Web Part:
SharePoint List
↓
SPFx React Web Part
↓
Microsoft Graph / SharePoint REST
↓
Display Employees
↓
Search
↓
Filter
↓
SharePoint PageSharePoint Page
This will teach you the important SPFx concepts: React components, SharePoint API, lists, properties, permissions, deployment, and debugging.

Join the conversation! Your thoughts help the community grow.