Import a Public GitHub Repository into StackBlitz and Verify the Dev Server
Import a public GitHub repo into StackBlitz, start its dev server in the browser, and verify the preview loads without local Node.js installation.
20 Aug 2025, 13:03 UTC

The Problem: Local Setup Friction for Repository Testing
Opening a public GitHub repository usually requires installing Git, Node.js, and dependencies on your computer before you can run the development server. StackBlitz WebContainers runs a Node.js runtime directly in the browser using WebAssembly, so you can import a repository and start its dev server without local installation.
Desired Outcome
Import a public GitHub repository into StackBlitz, let WebContainers install npm dependencies, start the project’s development server, and confirm the application loads in the StackBlitz preview pane.
Prerequisites
- A Chromium-based browser such as Chrome, Edge, or Brave with WebAssembly and WebGL enabled. WebContainers depends on these browser APIs to execute Node.js in the tab.
- A free StackBlitz account.
- The URL of a public GitHub repository that contains a valid package.json with a start or dev script.
- Basic familiarity with package.json scripts and browser developer tools.
Import the Repository
- Open stackblitz.com/github/OWNER/REPO in your browser, replacing OWNER and REPO with the GitHub account and repository name. No command-line permissions are required.
- Sign in to StackBlitz if prompted. The import creates a new project in your StackBlitz workspace.
- Wait for the editor to load. WebContainers reads package.json and runs the equivalent of npm install inside the browser.
Example import URL pattern:
https://stackblitz.com/github/OWNER/REPO
Inspect package.json and Start the Dev Server
Open package.json in the StackBlitz editor and identify the script used for development. A typical Vite-based project contains:
{
"name": "example-app",
"version": "1.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"vite": "^4.4.0"
}
}
Open the terminal panel at the bottom of the StackBlitz editor and run:
npm run dev
Run this command inside the StackBlitz terminal, not your local system terminal. No elevated permissions are needed because WebContainers executes the process inside the browser sandbox.
Expected check: the terminal should display a startup message similar to Vite’s local server address, for example:
➜ Local: http://localhost:5173/
If the repository uses a different port or framework, the message will reflect that configuration.
Verify the Preview Pane
- Open the Preview tab in StackBlitz, usually shown beside the editor or in a separate browser tab.
- Confirm the application UI loads instead of a blank screen or connection error.
- Open browser DevTools and select the Console tab. Look for successful initialization messages rather than failed module loads or 404 errors.
Limitations and Practical Checks
- Browser support: Firefox and Safari do not provide full WebContainers support. Use Chrome, Edge, or Brave for this procedure.
- Cold start: Repositories with large dependency trees may take longer to install because packages are downloaded and executed in the browser.
- Persistence: Imported project files live in browser storage. Export to GitHub or download the project as a ZIP if you need a permanent copy.
Practical check: refresh the StackBlitz project page. If the imported files and terminal history remain, the project is stored in your StackBlitz workspace. If the workspace is empty, re-import from GitHub.
Recovery Options
- If the import fails, confirm the repository is public and that package.json is valid. Private repositories require connected GitHub access and may not import on the free tier.
- If npm install stalls, open the StackBlitz terminal and run
npm installagain, or refresh the project page. - If the dev server does not start, check the terminal for port conflict errors and confirm package.json lists the correct start script.
- If the preview stays blank, open browser DevTools Console and Network tabs to identify failed requests.
There is no server-side rollback for an import because StackBlitz creates a browser-based project. To start over, delete the project from your StackBlitz dashboard and repeat the import steps.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.