Skip to content

Commit 195433d

Browse files
EricSimonsjrvidal
authored andcommitted
Initial commit
0 parents  commit 195433d

File tree

8 files changed

+317
-0
lines changed

8 files changed

+317
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**Link to the blitz that caused the error**
14+
15+
**To Reproduce**
16+
Steps to reproduce the behavior:
17+
1. Go to '...'
18+
2. Click on '....'
19+
3. Scroll down to '....'
20+
4. See error
21+
22+
**Expected behavior**
23+
A clear and concise description of what you expected to happen.
24+
25+
**Screenshots**
26+
If applicable, add screenshots to help explain your problem.
27+
28+
**Desktop (please complete the following information):**
29+
- OS: [e.g. iOS]
30+
- Browser [e.g. chrome, safari]
31+
- Version [e.g. 22]
32+
33+
**Smartphone (please complete the following information):**
34+
- Device: [e.g. iPhone6]
35+
- OS: [e.g. iOS8.1]
36+
- Browser [e.g. stock browser, safari]
37+
- Version [e.g. 22]
38+
39+
**Additional context**
40+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: New framework support
3+
about: Suggest a framework that we should add support for
4+
title: Framework support for [FRAMEWORK_NAME]
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the solution you'd like**
11+
A clear and concise description of what you want to happen.
12+
13+
**Give a link to a github repo containing an example of the framework**
14+
15+
16+
**Additional context**
17+
Add any other context or screenshots about the feature request here.

.gitignore

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Next.js build output
79+
.next
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
85+
# Gatsby files
86+
.cache/
87+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# public
90+
91+
# vuepress build output
92+
.vuepress/dist
93+
94+
# Serverless directories
95+
.serverless/
96+
97+
# FuseBox cache
98+
.fusebox/
99+
100+
# DynamoDB Local files
101+
.dynamodb/
102+
103+
# TernJS port file
104+
.tern-port

Add_support_for_a_framework.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Add support for a framework
2+
3+
On the [Supported frameworks](Supported_frameworks.md) page you can find all officially supported frameworks. But, since our technology allows you to run node programs in the secure context of your browser, it could be that the framework you wanna use 'just works'. The following list has a number of steps you can try to see if this is the case.
4+
5+
1. Go to <a href="https://stackblitz.com/fork/node" target="_blank">our node starter</a>
6+
2. Add a dependency to the framework you wanna try out by using `npm i ${framework}`
7+
3. Add the necessary files to the stackblitz example.
8+
4. See if it works!
9+
10+
If it works, great! Feel free to open a PR on the [Supported frameworks](Supported_frameworks.md) page and add the give us the url you used to try it. We will verify if everything works after that.
11+
12+
If it doesn't work, you can file an issue by clicking the button in the editor or by creating an issue on this repo and we will try and figure out what went wrong.
13+
14+
In both cases: Thanks for helping us!

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 StackBlitz
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# WebContainer
2+
3+
This repository serves as a coordination point for the WebContainer working group. Chat with our team live on [Discord](https://discord.gg/stackblitz). See how you can [get involved](#getting-involved) below.
4+
5+
### Browser Support
6+
7+
|<a href="#">![](https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png)</a><br>Chrome|<a href="#">![](https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png)</a><br>Edge|<a href="#">![](https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png)</a><br>Opera|<a href="#">![](https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png)</a><br>Safari|<a href="#">![](https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png)</a><br>Firefox|
8+
|:---:|:---:|:---:|:---:|:---:|
9+
|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:soon:|:soon:|
10+
11+
## Explainer
12+
13+
The web has evolved to a point where it can provide most of the capabilities of an application that's natively installed. With the power of [WebAssembly](https://webassembly.org/), modern browser API's like Web/ServiceWorker and SharedArrayBuffer, and the increased access to hardware, the ingredients to unlock the Web's full potential has been created, and the line between native and web based applications has never been thinner. Solutions like [Electron](https://www.electronjs.org/) have helped fill this gap in the past by creating a sandbox for web-based applications to have access to System level resources. With standardization around interfaces like [WASI](https://wasi.dev/), we can actually have a portable runtime that matches the capabilities of native applications, while maintaining the security and consistency of the Web as we've come to expect. While WASI aims to bring a modular system interface, there still needs to be an operating system for WASI modules to interface with within browsers. WebContainer provides a small portable container and operating system designed for modern applications. The WebContainer working group aims to bridge this gap and help accelerate the world's transition to the WebAssembly based computing.
14+
15+
The initial focus for the applications of WebContainer will be Node.js based development toolchains. Software development toolchains tend to be slow, insecure, and inconsistent across platforms, largely due to the variance in underlying operating system and machine architectures. They also have a thorough and tangible scope of what's required to be implemented in an operating system (process management, File System access, multi-threaded computation, networking stacks, etc). By doing so, we can bring the web to an inflection point where the Web can be natively used to build the web, which is an important step in bringing the Web to even more production workflows.
16+
17+
While containerization solutions like Docker and VMs have improved environment portability, they still leave much to be desired in terms of speed, security, consistency, and accessibility. A full operating system is brought along (and ideally secured and hardened) with each virtual instance, and system resources are difficult to efficiently share between containers. Operating systems and browsers have a lot in common. They're both [user agents](https://en.wikipedia.org/wiki/User_agent) that run multi-tenant environments containing arbitrary (and possibly insecure) code. The browser provides a better primitive for a modern operating system, being networked, secure, and multi-tenant by default.
18+
19+
The advent of WebAssembly has introduced an opportunity to fix these problems in a fundamentally new way. Initiatives like WASI have paved the way for a new type of operating system interface. But to date, nearly all software development continues to be done with local binaries. Other initiatives focus on lower level APIs that are required for this change. This is important work, but the feedback loop is impaired without developers being able 'dogfood' their normal development toolchains on top of these APIs.
20+
21+
# Key goals
22+
23+
Provide developers fast, secure and consistent development environments for real world workloads.
24+
25+
- Speed
26+
- Seeing the results of changes to code can help drive new development decisions. By focusing on speed, we can help developers see the results they want and make new decisions faster.
27+
- Security
28+
- In a world where cyber security attacks are becoming increasingly prevalent, security can't be an afterthought. Development environments must be secure by default in order to have a maintainable security posture.
29+
- Consistency
30+
- "Worked on my machine" is one of the most common sayings when bugs are first discovered due to inconsistencies between environments. Containers can help abstract the complexity between different systems and environemnts.
31+
- Development Experience
32+
- Frictionless
33+
- Adopting a new tool shouldn't mean rewriting a codebase. Great tools should be a joy to use and should minimize disruption to existing workflows.
34+
- Reduce Pain
35+
- Complex programs that require multiple processes or threads have been cumbersome to work with on the Web. The web won't remain single-threaded for long, but developers must be empowered to help create a multi-threaded Web.
36+
- Research
37+
- Take the knowledge gained from this to help improve existing standards and introduce new ones where necessary.
38+
39+
# Key WebContainer Components
40+
41+
- Virtual File System with lazy-loading capabilities
42+
- Virtual Networking
43+
- Multi-threaded/multi-process application support
44+
- Inter-Process communication/process signaling
45+
- POSIX-esque shell with ability to shell out between processes
46+
47+
# Limitations
48+
49+
As with many new technologies, there are inherent technical limitations of what's possible. Over time these limitations will get worked around and smoothed out as browsers become more powerful, but some things may never be supported.
50+
51+
- Node.js Runtime
52+
- We plan on bringing support for other languages to WebContainer in the future, but the only supported runtime is currently Node.js.
53+
- Native binaries and NPM `postinstall` scripts
54+
- While many `postinstall` scripts are harmless to run, most are used for setting up/compiling native binaries, and can often times be run in privileged root contexts, giving system-wide access to arbitrary code. This [vulnerability](https://www.kb.cert.org/vuls/id/319816) is [known by NPM](https://blog.npmjs.org/post/141702881055/package-install-scripts-vulnerability.html) with no plans on remediating the behavior, and goes against the secure-by-default nature of the Web.
55+
- HTTP Networking
56+
- We're limited by the browser's ability to make network requests, so connecting to processes like MongoDB, Redis, PostgreSQL, etc. are not currently possible. This may change as [Chromium plans to ship Native Sockets](https://bugs.chromium.org/p/chromium/issues/detail?id=909927&can=2&q=proj-fugu&sort=pri&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified&x=m&y=releaseblock&cells=ids) in the future. For now, we're limited to HTTP connections, but we're able to support other protocols that run on HTTP such as WebSockets. HTTP requests to external services must be allowed with CORS or a CORS proxy.
57+
- Module support
58+
- ESM is currently supported with the use of transpilers, but native ESM support will be coming in the future.
59+
60+
# Security
61+
62+
WebContainers are designed to be secure by default and run within the browser's security sandbox without any extensions or services needed to run. WebContainers are subject to the same cross-origin security constraints as any ordinary JavaScript code in the browser. Many development environments are run in environments with an excess amount of privilege, giving third party dependencies complete access over the operating system. By containing runtime environments within a browser context, we get an additional layer of security and process isolation when compared to running code locally on an operating system.
63+
64+
# Upcoming Support
65+
66+
During the beta, compatibility efforts will be focused on Next.js development, with additional environments soon to come after. Check this repository regularly to see the latest updates and plans for WebContainer.
67+
68+
# FAQs
69+
70+
- Is there a developer API?
71+
- Not yet. Once we reach General Availability for WebContainer we plan to release an API surface.
72+
- Is this open source?
73+
- Today no, but the API will be open source to developers at GA.
74+
- What can't this run?
75+
- Non WebAssembly native binaries. Native binaries must be compiled as WASM, which is a more portable and secure format for native binaries.
76+
- Is this a Docker container?
77+
- It's similar in the way that you can package and run Node.js code with minimal modifications, but your Browser serves as the operating system instead of a separately managed virtual machine.
78+
- How can I help?
79+
- Check out the [Getting Involved](#getting-involved) section here to see how you can get involved, or [try out WebContainers on StackBlitz.com](https://stackblitz.com/edit/next-starter)
80+
81+
# Getting Involved
82+
83+
The core working group communicates on Slack and you can request an invite [here](#).
84+
85+
## Port binaries to WebAssembly
86+
While many binaries are now available as WASMs, many still need to be converted over. These also tie into the webcontainer-registry for seamlessly swapping out legacy binaries with their corresponding WebAssembly counterparts during installs.
87+
88+
## Test compatibility of new toolchains
89+
It's important for us to identify toolchains that are currently broken to ensure we can track
90+
91+
## Enable live environments for open source projects
92+
93+
Integrating live WebContainer environments in OSS GitHub issue templates, documentation and learning resources is key: open source projects have instant reliable bug reproductions, newcomers to those libraries have an instant environment to learn in, and the WebContainer runtime becomes more robust against any edge cases.

Supported_frameworks.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Supported frameworks
2+
3+
The following is a list of frameworks that we have actively tested and are supported. Other frameworks may work OOTB. If not, feel free to open an issue on this repo.
4+
5+
PS: if you wanna add a framework to this list, feel free to help us out and follow the steps [here](Add_support_for_a_framework.md)!
6+
7+
1. NextJS
8+

0 commit comments

Comments
 (0)