Rahul Bhardwaj commited on
Commit
5f62d1f
·
unverified ·
2 Parent(s): 71c4398 ffa9f11

Merge branch 'main' into add-docker-support

Browse files
CONTRIBUTING.md CHANGED
@@ -1,10 +1,10 @@
1
  [![Bolt Open Source Codebase](./public/social_preview_index.jpg)](https://bolt.new)
2
 
3
- > Welcome to the **Bolt** open-source codebase! This repo cpontains a simple example app using the core components from bolt.new to help you get started building **AI-powered software development tools** powered by StackBlitz’s **WebContainer API**.
4
 
5
  ### Why Build with Bolt + WebContainer API
6
 
7
- By building with the Bolt + WebContainer API you can create browser-based applications that let users **prompt, run, edit, and deploy** full-stack web apps directly in the browser, without the need for virtual machines. With WebContainer API, you can build apps that give AI direct access and full control over a **Node.js server**, **filesystem**, **package manager** and **dev terminal** inside your users browser tab. This powerful combination allows you to create a new class of development tools that support all major javascript libraries and node packages right out of the box, all without remote environments or local installs.
8
 
9
  ### What’s the Difference Between Bolt (This Repo) and [Bolt.new](https://bolt.new)?
10
 
@@ -76,7 +76,7 @@ VITE_LOG_LEVEL=debug
76
  - `pnpm run build`: Builds the project.
77
  - `pnpm run start`: Runs the built application locally using Wrangler Pages. This script uses `bindings.sh` to set up necessary bindings so you don't have to duplicate environment variables.
78
  - `pnpm run preview`: Builds the project and then starts it locally, useful for testing the production build. Note, HTTP streaming currently doesn't work as expected with `wrangler pages dev`.
79
- - `pnpm test:` Runs the test suite using Vitest.
80
  - `pnpm run typecheck`: Runs TypeScript type checking.
81
  - `pnpm run typegen`: Generates TypeScript types using Wrangler.
82
  - `pnpm run deploy`: Builds the project and deploys it to Cloudflare Pages.
 
1
  [![Bolt Open Source Codebase](./public/social_preview_index.jpg)](https://bolt.new)
2
 
3
+ > Welcome to the **Bolt** open-source codebase! This repo contains a simple example app using the core components from bolt.new to help you get started building **AI-powered software development tools** powered by StackBlitz’s **WebContainer API**.
4
 
5
  ### Why Build with Bolt + WebContainer API
6
 
7
+ By building with the Bolt + WebContainer API you can create browser-based applications that let users **prompt, run, edit, and deploy** full-stack web apps directly in the browser, without the need for virtual machines. With WebContainer API, you can build apps that give AI direct access and full control over a **Node.js server**, **filesystem**, **package manager** and **dev terminal** inside your users browser tab. This powerful combination allows you to create a new class of development tools that support all major JavaScript libraries and Node packages right out of the box, all without remote environments or local installs.
8
 
9
  ### What’s the Difference Between Bolt (This Repo) and [Bolt.new](https://bolt.new)?
10
 
 
76
  - `pnpm run build`: Builds the project.
77
  - `pnpm run start`: Runs the built application locally using Wrangler Pages. This script uses `bindings.sh` to set up necessary bindings so you don't have to duplicate environment variables.
78
  - `pnpm run preview`: Builds the project and then starts it locally, useful for testing the production build. Note, HTTP streaming currently doesn't work as expected with `wrangler pages dev`.
79
+ - `pnpm test`: Runs the test suite using Vitest.
80
  - `pnpm run typecheck`: Runs TypeScript type checking.
81
  - `pnpm run typegen`: Generates TypeScript types using Wrangler.
82
  - `pnpm run deploy`: Builds the project and deploys it to Cloudflare Pages.
README.md CHANGED
@@ -2,7 +2,7 @@
2
 
3
  # Bolt.new: AI-Powered Full-Stack Web Development in the Browser
4
 
5
- Bolt.new is an AI-powered web development agent that allows you to prompt, run, edit, and deploy full-stack applications directly from your browser—no local setup required. If you're here to build your own AI powered web dev agent using the Bolt open source codebase, [click here to get started!](./CONTRIBUTING.md)
6
 
7
  ## What Makes Bolt.new Different
8
 
@@ -11,7 +11,7 @@ Claude, v0, etc are incredible- but you can't install packages, run backends or
11
  - **Full-Stack in the Browser**: Bolt.new integrates cutting-edge AI models with an in-browser development environment powered by **StackBlitz’s WebContainers**. This allows you to:
12
  - Install and run npm tools and libraries (like Vite, Next.js, and more)
13
  - Run Node.js servers
14
- - Interact with 3rd party APIs
15
  - Deploy to production from chat
16
  - Share your work via a URL
17
 
@@ -25,7 +25,7 @@ For developers interested in building their own AI-powered development tools wit
25
 
26
  Here are some tips to get the most out of Bolt.new:
27
 
28
- - **Be specific about your stack**: If you want to use specific frameworks or libraries (like Astro, Tailwind, ShadCN, or any other popular Javacsript framework), mention them in your initial prompt to ensure Bolt scaffolds the project accordingly.
29
 
30
  - **Use the enhance prompt icon**: Before sending your prompt, try clicking the 'enhance' icon to have the AI model help you refine your prompt, then edit the results before submitting.
31
 
@@ -35,8 +35,8 @@ Here are some tips to get the most out of Bolt.new:
35
 
36
  ## FAQs
37
 
38
- **Where do sign up for a paid plan?**
39
- Bolt.new is free to get started. If you need more AI tokens or want private projects, you can purchase a paid subscription in your [Bolt.new](https://bolt.new) settings, in the lower left hand corner of the application.
40
 
41
  **What happens if I hit the free usage limit?**
42
  Once your free daily token limit is reached, AI interactions are paused until the next day or until you upgrade your plan.
@@ -48,7 +48,7 @@ Yes, Bolt.new is in beta, and we are actively improving it based on feedback.
48
  Check out the [Issues section](https://github.com/bolt.new/issues) to report an issue or request a new feature. Please use the search feature to check if someone else has already submitted the same issue/request.
49
 
50
  **What frameworks/libraries currently work on Bolt?**
51
- Bolt.new supports most popular javascript frameworks and libraries. If it runs on StackBlitz, it will run on Bolt.new as well.
52
 
53
  **How can I add make sure my framework/project works well in bolt?**
54
- We are excited to work with the javascript ecosystem to improve functionality in Bolt. Reach out to us via [[email protected]](mailto:[email protected]) to discuss how we can partner!
 
2
 
3
  # Bolt.new: AI-Powered Full-Stack Web Development in the Browser
4
 
5
+ Bolt.new is an AI-powered web development agent that allows you to prompt, run, edit, and deploy full-stack applications directly from your browser—no local setup required. If you're here to build your own AI-powered web dev agent using the Bolt open source codebase, [click here to get started!](./CONTRIBUTING.md)
6
 
7
  ## What Makes Bolt.new Different
8
 
 
11
  - **Full-Stack in the Browser**: Bolt.new integrates cutting-edge AI models with an in-browser development environment powered by **StackBlitz’s WebContainers**. This allows you to:
12
  - Install and run npm tools and libraries (like Vite, Next.js, and more)
13
  - Run Node.js servers
14
+ - Interact with third-party APIs
15
  - Deploy to production from chat
16
  - Share your work via a URL
17
 
 
25
 
26
  Here are some tips to get the most out of Bolt.new:
27
 
28
+ - **Be specific about your stack**: If you want to use specific frameworks or libraries (like Astro, Tailwind, ShadCN, or any other popular JavaScript framework), mention them in your initial prompt to ensure Bolt scaffolds the project accordingly.
29
 
30
  - **Use the enhance prompt icon**: Before sending your prompt, try clicking the 'enhance' icon to have the AI model help you refine your prompt, then edit the results before submitting.
31
 
 
35
 
36
  ## FAQs
37
 
38
+ **Where do I sign up for a paid plan?**
39
+ Bolt.new is free to get started. If you need more AI tokens or want private projects, you can purchase a paid subscription in your [Bolt.new](https://bolt.new) settings, in the lower-left hand corner of the application.
40
 
41
  **What happens if I hit the free usage limit?**
42
  Once your free daily token limit is reached, AI interactions are paused until the next day or until you upgrade your plan.
 
48
  Check out the [Issues section](https://github.com/bolt.new/issues) to report an issue or request a new feature. Please use the search feature to check if someone else has already submitted the same issue/request.
49
 
50
  **What frameworks/libraries currently work on Bolt?**
51
+ Bolt.new supports most popular JavaScript frameworks and libraries. If it runs on StackBlitz, it will run on Bolt.new as well.
52
 
53
  **How can I add make sure my framework/project works well in bolt?**
54
+ We are excited to work with the JavaScript ecosystem to improve functionality in Bolt. Reach out to us via [[email protected]](mailto:[email protected]) to discuss how we can partner!
app/lib/runtime/action-runner.ts CHANGED
@@ -128,7 +128,9 @@ export class ActionRunner {
128
 
129
  const webcontainer = await this.#webcontainer;
130
 
131
- const process = await webcontainer.spawn('jsh', ['-c', action.content]);
 
 
132
 
133
  action.abortSignal.addEventListener('abort', () => {
134
  process.kill();
 
128
 
129
  const webcontainer = await this.#webcontainer;
130
 
131
+ const process = await webcontainer.spawn('jsh', ['-c', action.content], {
132
+ env: { npm_config_yes: true },
133
+ });
134
 
135
  action.abortSignal.addEventListener('abort', () => {
136
  process.kill();
package.json CHANGED
@@ -71,9 +71,9 @@
71
  "rehype-raw": "^7.0.0",
72
  "rehype-sanitize": "^6.0.0",
73
  "remark-gfm": "^4.0.0",
 
74
  "remix-utils": "^7.6.0",
75
  "shiki": "^1.9.1",
76
- "remix-island": "^0.2.0",
77
  "unist-util-visit": "^5.0.0"
78
  },
79
  "devDependencies": {
 
71
  "rehype-raw": "^7.0.0",
72
  "rehype-sanitize": "^6.0.0",
73
  "remark-gfm": "^4.0.0",
74
+ "remix-island": "^0.2.0",
75
  "remix-utils": "^7.6.0",
76
  "shiki": "^1.9.1",
 
77
  "unist-util-visit": "^5.0.0"
78
  },
79
  "devDependencies": {
vite.config.ts CHANGED
@@ -1,6 +1,6 @@
1
  import { cloudflareDevProxyVitePlugin as remixCloudflareDevProxy, vitePlugin as remixVitePlugin } from '@remix-run/dev';
2
  import UnoCSS from 'unocss/vite';
3
- import { defineConfig } from 'vite';
4
  import { nodePolyfills } from 'vite-plugin-node-polyfills';
5
  import { optimizeCssModules } from 'vite-plugin-optimize-css-modules';
6
  import tsconfigPaths from 'vite-tsconfig-paths';
@@ -24,7 +24,34 @@ export default defineConfig((config) => {
24
  }),
25
  UnoCSS(),
26
  tsconfigPaths(),
 
27
  config.mode === 'production' && optimizeCssModules({ apply: 'build' }),
28
  ],
29
  };
30
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import { cloudflareDevProxyVitePlugin as remixCloudflareDevProxy, vitePlugin as remixVitePlugin } from '@remix-run/dev';
2
  import UnoCSS from 'unocss/vite';
3
+ import { defineConfig, type ViteDevServer } from 'vite';
4
  import { nodePolyfills } from 'vite-plugin-node-polyfills';
5
  import { optimizeCssModules } from 'vite-plugin-optimize-css-modules';
6
  import tsconfigPaths from 'vite-tsconfig-paths';
 
24
  }),
25
  UnoCSS(),
26
  tsconfigPaths(),
27
+ chrome129IssuePlugin(),
28
  config.mode === 'production' && optimizeCssModules({ apply: 'build' }),
29
  ],
30
  };
31
  });
32
+
33
+ function chrome129IssuePlugin() {
34
+ return {
35
+ name: 'chrome129IssuePlugin',
36
+ configureServer(server: ViteDevServer) {
37
+ server.middlewares.use((req, res, next) => {
38
+ const raw = req.headers['user-agent']?.match(/Chrom(e|ium)\/([0-9]+)\./);
39
+
40
+ if (raw) {
41
+ const version = parseInt(raw[2], 10);
42
+
43
+ if (version === 129) {
44
+ res.setHeader('content-type', 'text/html');
45
+ res.end(
46
+ '<body><h1>Please use Chrome Canary for testing.</h1><p>Chrome 129 has an issue with JavaScript modules & Vite local development, see <a href="https://github.com/stackblitz/bolt.new/issues/86#issuecomment-2395519258">for more information.</a></p><p><b>Note:</b> This only impacts <u>local development</u>. `pnpm run build` and `pnpm run start` will work fine in this browser.</p></body>',
47
+ );
48
+
49
+ return;
50
+ }
51
+ }
52
+
53
+ next();
54
+ });
55
+ },
56
+ };
57
+ }