Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a583d75
wip
nickcastel50 Jul 27, 2025
b0e7a9d
wip
nickcastel50 Jul 27, 2025
6142290
wip
nickcastel50 Jul 29, 2025
3d934d1
* add recenter button and fix model positioning when right drawers ar…
nickcastel50 Jul 30, 2025
c54be99
* Make AppsRegistry AI Create iFrame compatible with newest bolt.new …
nickcastel50 Dec 3, 2025
73d9177
attempt building bolt into share
nickcastel50 Dec 9, 2025
f62945e
attempt building bolt into share 2
nickcastel50 Dec 9, 2025
83a9364
set node env to development
nickcastel50 Dec 9, 2025
a179601
test netlify.toml
nickcastel50 Dec 9, 2025
a72a644
rename GITHUB_TOKEN to GITHUB_BOLT_TOKEN
nickcastel50 Dec 9, 2025
478aa92
rename GITHUB_TOKEN to GITHUB_BOLT_TOKEN
nickcastel50 Dec 9, 2025
767ac47
add share build command
nickcastel50 Dec 10, 2025
b62eb7e
testing
nickcastel50 Dec 10, 2025
b514a30
testing netlify
nickcastel50 Dec 10, 2025
baf4f12
testing netlify 2
nickcastel50 Dec 10, 2025
0952a81
testing netlify 3
nickcastel50 Dec 11, 2025
19b4e26
add redirect rules for bolt
nickcastel50 Dec 12, 2025
62e01b6
fix path name in AppsRegistry
nickcastel50 Dec 12, 2025
13db396
expose ai api keys to build process
nickcastel50 Dec 15, 2025
1938595
Merge branch 'main' into bolt_int
nickcastel50 Dec 15, 2025
4828226
* fix relative paths in AppRegistry
nickcastel50 Dec 15, 2025
385e1d7
merge and test
pablo-mayrgundter Dec 16, 2025
0200a14
Merge pull request #1467 from pablo-mayrgundter/bolt_int
pablo-mayrgundter Dec 16, 2025
b282389
Enable local development
nickcastel50 Dec 19, 2025
784dcf3
Merge branch 'bolt_int' of https://github.com/bldrs-ai/Share into bol…
nickcastel50 Dec 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ public/test-models

# Local Netlify folder
.netlify
.env
deno.lock
142 changes: 142 additions & 0 deletions Bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Bolt.new Integration

This repository integrates bolt.new as a subpath at `/build`.

## Local Development Setup

### Prerequisites

1. Clone the bolt.new fork alongside this repository:
```bash
git clone https://github.com/bldrs-ai/bldrsbolt.new.git
```

2. Install dependencies in bolt.new:
```bash
cd bldrsbolt.new
pnpm install
```

### Environment Variables

Create a `.env` file in the root of this Share repository:

```bash
GEMINI_API_KEY=your_gemini_api_key_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
```

> **⚠️ Important**: Never commit the `.env` file. Make sure it's in `.gitignore`.

### Syncing Bolt.new Files

The `sync-to-share.cjs` script builds bolt.new and copies the files into this repository:

```bash
# Sync using default path (../bldrsbolt.new)
yarn sync-bolt

# Or specify a custom bolt.new path
yarn sync-bolt /path/to/bldrsbolt.new

# Or use environment variable
BOLT_PATH=/path/to/bldrsbolt.new yarn sync-bolt
```

This script:
1. Builds bolt.new from the specified directory
2. Copies client files to `docs/build/`
3. Copies server function to `netlify/functions/server/`

### Running Locally

Start the development server:

```bash
# Sync bolt.new and start dev server in one command
yarn dev-with-bolt

# Or manually
yarn sync-bolt
netlify dev
```
Access Share at: `http://localhost:8888`
Access bolt.new at: `http://localhost:8888/build`

### How It Works

1. **Static Assets**: Files in `docs/build/assets/` are served directly by Netlify
2. **API Routes**: `/build/api/*` and `/build/chat/*` are routed to `netlify/functions/server`
3. **Bolt Pages**: Other `/build/*` routes are handled by the Remix SSR function
4. **Share SPA**: All other routes (`/*`) serve Share's `index.html`

### Netlify Configuration

The `_redirects` file contains:

```
# 1. Bolt static assets
/build/assets/* /build/assets/:splat 200!

# 2. Bolt server routes
/build /.netlify/functions/server 200
/build/* /.netlify/functions/server 200

# 3. Share SPA fallback
/* /index.html 200
```

## Deployment

### Setting Up Environment Variables

In Netlify dashboard:
1. Go to Site settings → Build & deploy → Environment
2. Add the API keys:
- `GEMINI_API_KEY`
- `ANTHROPIC_API_KEY`

Or via CLI:
```bash
netlify env:set GEMINI_API_KEY "your_key_here"
netlify env:set ANTHROPIC_API_KEY "your_key_here"
```

### Build Process

The deployment uses `netlify-share.toml` which:
1. Clones bolt.new into a temporary directory
2. Builds it with `pnpm run build`
3. Copies files to `docs/build/` and `netlify/functions/server/`
4. Deploys everything together

## Troubleshooting

### 204 No Content on Assets
Make sure the assets redirect has the `!` (force) flag and comes before the catch-all `/build/*` redirect.

### API Key Errors
Ensure the `.env` file exists in the Share repository (not just in bolt.new) when running `netlify dev`.

### Build Fails
Check that:
- The bolt.new path is correct
- Dependencies are installed in bolt.new (`pnpm install`)
- The build completes successfully (`pnpm run build` in bolt.new)

## File Structure

```
Share/
├── docs/
├── └── _redirects
│ └── build/ # Bolt.new client files (copied by script)
│ ├── assets/
│ └── ...
├── netlify/
│ └── functions/
│ └── server/ # Bolt.new server function (copied by script)
├── sync-to-share.cjs # Build and sync script
├── netlify.toml # Production deployment config
└── .env # API keys (gitignored)
```
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ from any device.
## Features
### Fast and easy access to your models for free
Open your models on any device in our browser-based viewer.
- Drag-n-drop models to view, no data upload, offline capable
- Drag-n-drop models to view, no data upload, offline capable
- Navigate and search elements, crop with section planes
- Property editing, save changes locally (early access)
- Powerful data slice-n-dice, csv export (early access)
Expand All @@ -38,6 +38,7 @@ Start using Bldrs Share today to transform your CAD workflows. Join our communit
### Getting Started
- Visit our [wiki](https://github.com/bldrs-ai/Share/wiki) for Share's Design, Developer Guide and instructions for hosting your models.
- See our [Conway engine](https://github.com/bldrs-ai/conway) repository
- See [Bolt.md](Bolt.md) for bolt.new integration and AI-powered code generation
- Join us on [Bldrs Discord](https://discord.gg/9SxguBkFfQ)
- Follow us on [X @bldrs_ai](https://x.com/bldrs_ai)
- Connect with us on [LinkedIn](https://www.linkedin.com/company/bldrs-ai/)
72 changes: 71 additions & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,63 @@
# Configuration for integrating bolt.new into Share at /build path
# Note: This approach copies bolt.new's built files but may require additional
# configuration in bolt.new's vite.config.ts to set base: '/build/'

[build]
command = """
# Build Share first so its assets land in docs/
yarn build && \
# Clone and build bolt.new (private repo - requires GITHUB_BOLT_TOKEN)
git clone https://${GITHUB_BOLT_TOKEN}@github.com/bldrs-ai/bolt.new.git temp-bolt && \
cd temp-bolt && \
corepack enable && \
NODE_ENV=development pnpm install && \
pnpm run build && \
cd .. && \
# Place bolt.new client bundle under Share's docs/build (served at /build/*)
rm -rf docs/build && \
mkdir -p docs/build && \
cp -R temp-bolt/build/client/* docs/build/ && \
# Copy bolt.new server bundle into Netlify functions directory
rm -rf netlify/functions/server && \
mkdir -p netlify/functions/server && \
cp -R temp-bolt/build/server/* netlify/functions/server/ && \
rm -rf temp-bolt
"""
publish = "docs"
functions = "netlify/functions"

# bolt.new's Remix server runs from /.netlify/functions/server (per build/server/server.js output)

[build.environment]
NODE_VERSION = "20"
GEMINI_API_KEY = "${GEMINI_API_KEY}"
ANTHROPIC_API_KEY = "${ANTHROPIC_API_KEY}"
# GITHUB_BOLT_TOKEN must be set in Netlify environment variables
# Create a GitHub Personal Access Token with 'repo' scope at:
# https://github.com/settings/tokens
# Add it to Netlify: Site settings > Build & deploy > Environment > Environment variables (name it GITHUB_BOLT_TOKEN)

# Apply strict cross-origin isolation for all routes by default
[[headers]]
for = "/*"
[headers.values]
Cross-Origin-Opener-Policy = "same-origin"
Cross-Origin-Embedder-Policy = "require-corp"

# Headers for /build path (bolt.new app)
[[headers]]
for = "/build/*"
[headers.values]
Cross-Origin-Opener-Policy = "same-origin"
Cross-Origin-Embedder-Policy = "require-corp"
Cross-Origin-Resource-Policy = "cross-origin"

# Asset caching for bolt.new assets
[[headers]]
for = "/build/assets/*"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"

# Override headers for the /subscribe route so that no strict isolation is enforced.
[[headers]]
for = "/subscribe/*"
Expand All @@ -17,4 +70,21 @@
from = "/subscribe"
to = "/subscribe/"
status = 301
force = true
force = true

# Keep bolt.new static assets served from /build/assets without hitting the function
[[redirects]]
from = "/build/assets/*"
to = "/build/assets/:splat"
status = 200

# Route everything else under /build to the bolt Remix server function
[[redirects]]
from = "/build"
to = "/.netlify/functions/server"
status = 200

[[redirects]]
from = "/build/*"
to = "/.netlify/functions/server"
status = 200
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bldrs",
"version": "1.0.1894",
"version": "1.0.1913",
"main": "src/index.jsx",
"license": "AGPL-3.0",
"homepage": "https://github.com/bldrs-ai/Share",
Expand All @@ -25,6 +25,8 @@
"build-share-copy-wasm-conway-MT": "shx cp node_modules/@bldrs-ai/conway/compiled/dependencies/conway-geom/Dist/* docs/static/js",
"build-share-copy-wasm-conway-profile": "shx cp node_modules/@bldrs-ai/conway-web-ifc-adapter/node_modules/@bldrs-ai/conway/compiled/dependencies/conway-geom/Dist/* docs/static/js",
"build-share-analyze": "ANALYZE=true node tools/esbuild/build.js",
"sync-bolt": "node tools/esbuild/sync-to-share.cjs ${BOLT_PATH:-../bldrsbolt.new}",
"serve-with-bolt": "yarn build && yarn sync-bolt && netlify dev",
"clean": "shx rm -rf docs",
"deps-graph": "npx dependency-cruiser src --include-only 'jsx?' --config --output-type dot | dot -T svg > deps.svg",
"husky-init": "husky install",
Expand Down
10 changes: 9 additions & 1 deletion public/_redirects
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
/* /index.html 200
# 1. Let Bolt static assets be served directly
/build/assets/* /build/assets/:splat 200!

# 2. Send /build and /build/* to the Remix server function
/build /.netlify/functions/server 200!
/build/* /.netlify/functions/server 200!

# 3. Fallback: Share SPA handles everything else
/* /index.html 200
Loading
Loading