forked from stackblitz-labs/bolt.diy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
137 changed files
with
191 additions
and
1,226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,84 @@ | ||
# Bolt Monorepo | ||
# Bolt | ||
|
||
Welcome to the Bolt monorepo! This repository contains the codebase for Bolt, an AI assistant developed by StackBlitz. | ||
Bolt is an AI assistant developed by StackBlitz. This package contains the UI interface for Bolt as well as the server components, built using [Remix Run](https://remix.run/). | ||
|
||
## Repository Structure | ||
## Prerequisites | ||
|
||
Currently, this monorepo contains a single package: | ||
|
||
- [`bolt`](packages/bolt): The main package containing the UI interface for Bolt as well as the server components. | ||
|
||
As the project grows, additional packages may be added to this workspace. | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
Before you begin, ensure you have the following installed: | ||
|
||
- Node.js (v20.15.1) | ||
- pnpm (v9.4.0) | ||
|
||
### Installation | ||
## Setup | ||
|
||
1. Clone the repository: | ||
1. Clone the repository (if you haven't already): | ||
|
||
```bash | ||
git clone https://github.com/stackblitz/bolt.git | ||
cd bolt | ||
``` | ||
|
||
2. Install dependencies: | ||
|
||
```bash | ||
pnpm i | ||
pnpm install | ||
``` | ||
|
||
3. Create a `.env.local` file in the root directory and add your Anthropic API key: | ||
|
||
``` | ||
ANTHROPIC_API_KEY=XXX | ||
``` | ||
|
||
Optionally, you an set the debug level or disable authentication: | ||
|
||
``` | ||
VITE_LOG_LEVEL=debug | ||
VITE_DISABLE_AUTH=1 | ||
``` | ||
|
||
3. Optionally, init git hooks: | ||
If you want to run authentication against a local StackBlitz instance, add: | ||
|
||
``` | ||
VITE_CLIENT_ORIGIN=https://local.stackblitz.com:3000 | ||
``` | ||
|
||
**Important**: Never commit your `.env.local` file to version control. It's already included in .gitignore. | ||
|
||
## Available Scripts | ||
|
||
- `pnpm run dev`: Starts the development server. | ||
- `pnpm run build`: Builds the project. | ||
- `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. | ||
- `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`. | ||
- `pnpm test:` Runs the test suite using Vitest. | ||
- `pnpm run typecheck`: Runs TypeScript type checking. | ||
- `pnpm run typegen`: Generates TypeScript types using Wrangler. | ||
- `pnpm run deploy`: Builds the project and deploys it to Cloudflare Pages. | ||
|
||
## Development | ||
|
||
To start the development server: | ||
|
||
```bash | ||
pnpmx husky | ||
pnpm run dev | ||
``` | ||
|
||
### Development | ||
This will start the Remix Vite development server. | ||
|
||
To start developing the Bolt UI: | ||
## Testing | ||
|
||
1. Navigate to the bolt package: | ||
Run the test suite with: | ||
|
||
```bash | ||
cd packages/bolt | ||
pnpm test | ||
``` | ||
|
||
2. Start the development server: | ||
## Deployment | ||
|
||
To deploy the application to Cloudflare Pages: | ||
|
||
```bash | ||
pnpm run dev | ||
pnpm run deploy | ||
``` | ||
|
||
Make sure you have the necessary permissions and Wrangler is correctly configured for your Cloudflare account. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { CLIENT_ORIGIN } from '~/lib/constants'; | ||
import { request as doRequest } from '~/lib/fetch'; | ||
|
||
export interface Identity { | ||
userId?: string | null; | ||
guestId?: string | null; | ||
segmentWriteKey?: string | null; | ||
avatar?: string; | ||
} | ||
|
||
const MESSAGE_PREFIX = 'Bolt'; | ||
|
||
export enum AnalyticsTrackEvent { | ||
MessageSent = `${MESSAGE_PREFIX} Message Sent`, | ||
MessageComplete = `${MESSAGE_PREFIX} Message Complete`, | ||
ChatCreated = `${MESSAGE_PREFIX} Chat Created`, | ||
} | ||
|
||
export async function identifyUser(access: string): Promise<Identity | undefined> { | ||
const response = await doRequest(`${CLIENT_ORIGIN}/api/identify`, { | ||
method: 'GET', | ||
headers: { authorization: `Bearer ${access}` }, | ||
}); | ||
|
||
const body = await response.json(); | ||
|
||
if (!response.ok) { | ||
return undefined; | ||
} | ||
|
||
// convert numerical identity values to strings | ||
const stringified = Object.entries(body).map(([key, value]) => [ | ||
key, | ||
typeof value === 'number' ? value.toString() : value, | ||
]); | ||
|
||
return Object.fromEntries(stringified) as Identity; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
Oops, something went wrong.