Skip to content

Commit a92ee8b

Browse files
authored
feat(turbo): restructured repo to be a standard turborepo monorepo (#341)
* added turborepo * finished turbo migration * updated gitignore * use dotenv & run format * fixed error in docs * remove standalone deployment in prod * fix ts error, remove ignore ts errors during build * added formatter to the end of the docs generator
1 parent 1438028 commit a92ee8b

File tree

1,072 files changed

+39910
-22535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,072 files changed

+39910
-22535
lines changed

.devcontainer/.bashrc

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,20 @@ alias pgc="PGPASSWORD=postgres psql -h db -U postgres -d simstudio"
1818
alias check-db="PGPASSWORD=postgres psql -h db -U postgres -c '\l'"
1919

2020
# Sim Studio specific aliases
21-
alias logs="cd /workspace/sim && tail -f logs/*.log 2>/dev/null || echo 'No log files found'"
22-
alias sim-start="cd /workspace/sim && npm run dev"
23-
alias sim-migrate="cd /workspace/sim && npx drizzle-kit push"
24-
alias sim-generate="cd /workspace/sim && npx drizzle-kit generate"
25-
alias sim-rebuild="cd /workspace/sim && npm run build && npm start"
21+
alias logs="cd /workspace/apps/sim && tail -f logs/*.log 2>/dev/null || echo 'No log files found'"
22+
alias sim-start="cd /workspace && npm run dev"
23+
alias sim-migrate="cd /workspace/apps/sim && npx drizzle-kit push"
24+
alias sim-generate="cd /workspace/apps/sim && npx drizzle-kit generate"
25+
alias sim-rebuild="cd /workspace && npm run build && npm run dev"
26+
alias docs-dev="cd /workspace/apps/docs && npm run dev"
2627

27-
# Default to sim directory
28-
cd /workspace/sim 2>/dev/null || true
28+
# Turbo related commands
29+
alias turbo-build="cd /workspace && npx turbo run build"
30+
alias turbo-dev="cd /workspace && npx turbo run dev"
31+
alias turbo-test="cd /workspace && npx turbo run test"
32+
33+
# Default to workspace directory
34+
cd /workspace 2>/dev/null || true
2935

3036
# Welcome message - only show once per session
3137
if [ -z "$SIM_WELCOME_SHOWN" ]; then
@@ -36,10 +42,16 @@ if [ -z "$SIM_WELCOME_SHOWN" ]; then
3642
echo "🚀 Welcome to Sim Studio development environment!"
3743
echo ""
3844
echo "Available commands:"
39-
echo " sim-start - Start the development server"
40-
echo " sim-migrate - Push schema changes to the database"
41-
echo " sim-generate - Generate new migrations"
42-
echo " sim-rebuild - Build and start the production server"
45+
echo " sim-start - Start all apps in development mode"
46+
echo " sim-migrate - Push schema changes to the database for sim app"
47+
echo " sim-generate - Generate new migrations for sim app"
48+
echo " sim-rebuild - Build and start all apps"
49+
echo " docs-dev - Start only the docs app in development mode"
50+
echo ""
51+
echo "Turbo commands:"
52+
echo " turbo-build - Build all apps using Turborepo"
53+
echo " turbo-dev - Start development mode for all apps"
54+
echo " turbo-test - Run tests for all packages"
4355
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
4456
echo ""
4557
fi

.devcontainer/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ RUN echo "$USERNAME ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USERNAME \
2323
RUN npm install -g npm@latest
2424

2525
# Install global packages
26-
RUN npm install -g drizzle-kit
26+
RUN npm install -g drizzle-kit turbo
2727

2828
# Switch back to dialog for any ad-hoc use of apt-get
2929
ENV DEBIAN_FRONTEND=dialog
3030

3131
WORKDIR /workspace
3232

3333
# Expose the ports we're interested in
34-
EXPOSE 3000
34+
EXPOSE 3000
35+
EXPOSE 3001

.devcontainer/docker-compose.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ services:
1818
db:
1919
condition: service_healthy
2020
ports:
21-
- "3000:3000"
22-
working_dir: /workspace/sim
21+
- '3000:3000'
22+
- '3001:3001'
23+
working_dir: /workspace
2324

2425
db:
2526
image: postgres:16
@@ -31,12 +32,12 @@ services:
3132
- POSTGRES_PASSWORD=postgres
3233
- POSTGRES_DB=simstudio
3334
ports:
34-
- "5432:5432"
35+
- '5432:5432'
3536
healthcheck:
36-
test: ["CMD-SHELL", "pg_isready -U postgres"]
37+
test: ['CMD-SHELL', 'pg_isready -U postgres']
3738
interval: 5s
3839
timeout: 5s
3940
retries: 5
4041

4142
volumes:
42-
postgres-data:
43+
postgres-data:

.devcontainer/post-create.sh

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ set -e
55

66
echo "🔧 Setting up Sim Studio development environment..."
77

8-
# Change to the sim directory
9-
cd /workspace/sim
8+
# Change to the workspace root directory
9+
cd /workspace
1010

1111
# Setup .bashrc
1212
echo "📄 Setting up .bashrc with aliases..."
@@ -19,23 +19,31 @@ echo "📦 Cleaning and reinstalling npm dependencies..."
1919
if [ -d "node_modules" ]; then
2020
echo "Removing existing node_modules to ensure platform compatibility..."
2121
rm -rf node_modules
22+
rm -rf apps/sim/node_modules
23+
rm -rf apps/docs/node_modules
2224
fi
2325

2426
# Install dependencies with platform-specific binaries
2527
npm install || {
2628
echo "⚠️ npm install had issues but continuing setup..."
2729
}
2830

29-
# Set up environment variables if .env doesn't exist
30-
if [ ! -f ".env" ]; then
31+
# Set up environment variables if .env doesn't exist for the sim app
32+
if [ ! -f "apps/sim/.env" ]; then
3133
echo "📄 Creating .env file from template..."
32-
cp .env.example .env 2>/dev/null || echo "DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio" > .env
34+
if [ -f "apps/sim/.env.example" ]; then
35+
cp apps/sim/.env.example apps/sim/.env
36+
else
37+
echo "DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio" > apps/sim/.env
38+
fi
3339
fi
3440

3541
# Generate schema and run database migrations
3642
echo "🗃️ Running database schema generation and migrations..."
3743
echo "Generating schema..."
44+
cd apps/sim
3845
npx drizzle-kit generate
46+
cd ../..
3947

4048
echo "Waiting for database to be ready..."
4149
# Try to connect to the database, but don't fail the script if it doesn't work
@@ -44,7 +52,9 @@ echo "Waiting for database to be ready..."
4452
while [ $timeout -gt 0 ]; do
4553
if PGPASSWORD=postgres psql -h db -U postgres -c '\q' 2>/dev/null; then
4654
echo "Database is ready!"
55+
cd apps/sim
4756
DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio npx drizzle-kit push
57+
cd ../..
4858
break
4959
fi
5060
echo "Database is unavailable - sleeping (${timeout}s remaining)"
@@ -61,13 +71,13 @@ echo "Waiting for database to be ready..."
6171
cat << EOF >> ~/.bashrc
6272
6373
# Additional Sim Studio Development Aliases
64-
alias migrate="cd /workspace/sim && DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio npx drizzle-kit push"
65-
alias generate="cd /workspace/sim && npx drizzle-kit generate"
66-
alias dev="cd /workspace/sim && npm run dev"
67-
alias build="cd /workspace/sim && npm run build"
68-
alias start="cd /workspace/sim && npm run start"
69-
alias lint="cd /workspace/sim && npm run lint"
70-
alias test="cd /workspace/sim && npm run test"
74+
alias migrate="cd /workspace/apps/sim && DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio npx drizzle-kit push"
75+
alias generate="cd /workspace/apps/sim && npx drizzle-kit generate"
76+
alias dev="cd /workspace && npm run dev"
77+
alias build="cd /workspace && npm run build"
78+
alias start="cd /workspace && npm run dev"
79+
alias lint="cd /workspace/apps/sim && npm run lint"
80+
alias test="cd /workspace && npm run test"
7181
EOF
7282

7383
# Source the .bashrc to make aliases available immediately
File renamed without changes.

.github/CODE_OF_CONDUCT.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
1414
Examples of behaviour that contributes to a positive environment for our
1515
community include:
1616

17-
* Demonstrating empathy and kindness toward other people
18-
* Being respectful of differing opinions, viewpoints, and experiences
19-
* Giving and gracefully accepting constructive feedback
20-
* Accepting responsibility and apologising to those affected by our mistakes,
17+
- Demonstrating empathy and kindness toward other people
18+
- Being respectful of differing opinions, viewpoints, and experiences
19+
- Giving and gracefully accepting constructive feedback
20+
- Accepting responsibility and apologising to those affected by our mistakes,
2121
and learning from the experience
22-
* Focusing on what is best not just for us as individuals, but for the
22+
- Focusing on what is best not just for us as individuals, but for the
2323
overall community
2424

2525
Examples of unacceptable behaviour include:
2626

27-
* The use of sexualised language or imagery, and sexual attention or advances
28-
* Trolling, insulting or derogatory comments, and personal or political attacks
29-
* Public or private harassment
30-
* Publishing others' private information, such as a physical or email
27+
- The use of sexualised language or imagery, and sexual attention or advances
28+
- Trolling, insulting or derogatory comments, and personal or political attacks
29+
- Public or private harassment
30+
- Publishing others' private information, such as a physical or email
3131
address, without their explicit permission
32-
* Other conduct which could reasonably be considered inappropriate in a
32+
- Other conduct which could reasonably be considered inappropriate in a
3333
professional setting
3434

3535
## Our Responsibilities
@@ -112,4 +112,4 @@ the community.
112112
This Code of Conduct is adapted from the [Contributor Covenant](https://contributor-covenant.org/), version
113113
[1.4](https://www.contributor-covenant.org/version/1/4/code-of-conduct/code_of_conduct.md) and
114114
[2.0](https://www.contributor-covenant.org/version/2/0/code_of_conduct/code_of_conduct.md),
115-
and was generated by [contributing.md](https://contributing.md/generator).
115+
and was generated by [contributing.md](https://contributing.md/generator).

.github/CONTRIBUTING.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Thank you for your interest in contributing to Sim Studio! Our goal is to provide developers with a powerful, user-friendly platform for building, testing, and optimizing agentic workflows. We welcome contributions in all forms—from bug fixes and design improvements to brand-new features.
44

55
> **Project Overview:**
6-
> Sim Studio is a monorepo containing the main application (`sim/`) and documentation (`docs/`). The main application is built with Next.js (app router), ReactFlow, Zustand, Shadcn, and Tailwind CSS. Please ensure your contributions follow our best practices for clarity, maintainability, and consistency.
6+
> Sim Studio is a monorepo using Turborepo, containing the main application (`apps/sim/`), documentation (`apps/docs/`), and shared packages (`packages/`). The main application is built with Next.js (app router), ReactFlow, Zustand, Shadcn, and Tailwind CSS. Please ensure your contributions follow our best practices for clarity, maintainability, and consistency.
77
88
---
99

@@ -269,26 +269,26 @@ Sim Studio is built in a modular fashion where blocks and tools extend the platf
269269
270270
### Where to Add Your Code
271271
272-
- **Blocks:** Create your new block file under the `/sim/blocks/blocks` directory. The name of the file should match the provider name (e.g., `pinecone.ts`).
273-
- **Tools:** Create a new directory under `/sim/tools` with the same name as the provider (e.g., `/sim/tools/pinecone`).
272+
- **Blocks:** Create your new block file under the `/apps/sim/blocks/blocks` directory. The name of the file should match the provider name (e.g., `pinecone.ts`).
273+
- **Tools:** Create a new directory under `/apps/sim/tools` with the same name as the provider (e.g., `/apps/sim/tools/pinecone`).
274274
275275
In addition, you will need to update the registries:
276276
277-
- **Block Registry:** Update the blocks index (`/sim/blocks/index.ts`) to include your new block.
278-
- **Tool Registry:** Update the tools registry (`/sim/tools/index.ts`) to add your new tool.
277+
- **Block Registry:** Update the blocks index (`/apps/sim/blocks/index.ts`) to include your new block.
278+
- **Tool Registry:** Update the tools registry (`/apps/sim/tools/index.ts`) to add your new tool.
279279
280280
### How to Create a New Block
281281
282282
1. **Create a New File:**
283-
Create a file for your block named after the provider (e.g., `pinecone.ts`) in the `/sim/blocks/blocks` directory.
283+
Create a file for your block named after the provider (e.g., `pinecone.ts`) in the `/apps/sim/blocks/blocks` directory.
284284
285285
2. **Create a New Icon:**
286-
Create a new icon for your block in the `/sim/components/icons.tsx` file. The icon should follow the same naming convention as the block (e.g., `PineconeIcon`).
286+
Create a new icon for your block in the `/apps/sim/components/icons.tsx` file. The icon should follow the same naming convention as the block (e.g., `PineconeIcon`).
287287
288288
3. **Define the Block Configuration:**
289289
Your block should export a constant of type `BlockConfig`. For example:
290290
291-
```typescript:/sim/blocks/blocks/pinecone.ts
291+
```typescript:/apps/sim/blocks/blocks/pinecone.ts
292292
import { PineconeIcon } from '@/components/icons'
293293
import { PineconeResponse } from '@/tools/pinecone/types'
294294
import { BlockConfig } from '../types'
@@ -313,11 +313,11 @@ In addition, you will need to update the registries:
313313
```
314314
315315
4. **Register Your Block:**
316-
Add your block to the blocks registry (`/sim/blocks/registry.ts`):
316+
Add your block to the blocks registry (`/apps/sim/blocks/registry.ts`):
317317
318-
```typescript:/sim/blocks/registry.ts
318+
```typescript:/apps/sim/blocks/registry.ts
319319
import { PineconeBlock } from './blocks/pinecone'
320-
320+
321321
// Registry of all available blocks
322322
export const registry: Record<string, BlockConfig> = {
323323
// ... existing blocks
@@ -333,7 +333,7 @@ In addition, you will need to update the registries:
333333
### How to Create a New Tool
334334
335335
1. **Create a New Directory:**
336-
Create a directory under `/sim/tools` with the same name as the provider (e.g., `/sim/tools/pinecone`).
336+
Create a directory under `/apps/sim/tools` with the same name as the provider (e.g., `/apps/sim/tools/pinecone`).
337337
338338
2. **Create Tool Files:**
339339
Create separate files for each tool functionality with descriptive names (e.g., `fetch.ts`, `generate_embeddings.ts`, `search_text.ts`) in your tool directory.
@@ -344,7 +344,7 @@ In addition, you will need to update the registries:
344344
4. **Create an Index File:**
345345
Create an `index.ts` file in your tool directory that imports and exports all tools:
346346
347-
```typescript:/sim/tools/pinecone/index.ts
347+
```typescript:/apps/sim/tools/pinecone/index.ts
348348
import { fetchTool } from './fetch'
349349
import { generateEmbeddingsTool } from './generate_embeddings'
350350
import { searchTextTool } from './search_text'
@@ -355,7 +355,7 @@ In addition, you will need to update the registries:
355355
5. **Define the Tool Configuration:**
356356
Your tool should export a constant with a naming convention of `{toolName}Tool`. The tool ID should follow the format `{provider}_{tool_name}`. For example:
357357
358-
```typescript:/sim/tools/pinecone/fetch.ts
358+
```typescript:/apps/sim/tools/pinecone/fetch.ts
359359
import { ToolConfig, ToolResponse } from '../types'
360360
import { PineconeParams, PineconeResponse } from './types'
361361
@@ -384,9 +384,9 @@ In addition, you will need to update the registries:
384384
```
385385
386386
6. **Register Your Tool:**
387-
Update the tools registry in `/sim/tools/index.ts` to include your new tool:
387+
Update the tools registry in `/apps/sim/tools/index.ts` to include your new tool:
388388
389-
```typescript:/sim/tools/index.ts
389+
```typescript:/apps/sim/tools/index.ts
390390
import { fetchTool, generateEmbeddingsTool, searchTextTool } from './pinecone'
391391
// ... other imports
392392

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: "[BUG]"
4+
title: '[BUG]'
55
labels: bug
66
assignees: ''
77
---
@@ -11,6 +11,7 @@ A clear and concise description of what the bug is.
1111

1212
**To Reproduce**
1313
Steps to reproduce the behavior:
14+
1415
1. Go to '...'
1516
2. Click on '....'
1617
3. Scroll down to '....'
@@ -23,4 +24,4 @@ A clear and concise description of what you expected to happen.
2324
If applicable, add screenshots to help explain your problem.
2425

2526
**Additional context**
26-
Add any other context about the problem here.
27+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: "[REQUEST]"
4+
title: '[REQUEST]'
55
labels: feature
66
assignees: ''
77
---
@@ -16,4 +16,4 @@ A clear and concise description of what you want to happen.
1616
A clear and concise description of any alternative solutions or features you've considered.
1717

1818
**Additional context**
19-
Add any other context or screenshots about the feature request here.
19+
Add any other context or screenshots about the feature request here.

.github/SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
| ------- | ------------------ |
77
| 0.1.x | :white_check_mark: |
88

9-
109
## Reporting a Vulnerability
1110

1211
We take the security of Sim Studio seriously. If you believe you've found a security vulnerability, please follow these steps:
@@ -16,11 +15,12 @@ We take the security of Sim Studio seriously. If you believe you've found a secu
1615
2. **Email us directly** at [email protected] with details of the vulnerability.
1716

1817
3. **Include the following information** in your report:
18+
1919
- Description of the vulnerability
2020
- Steps to reproduce
2121
- Potential impact
2222
- Any suggestions for mitigation
2323

2424
4. We will acknowledge receipt of your vulnerability report within 48 hours and provide an estimated timeline for a fix.
2525

26-
5. Once the vulnerability is fixed, we will notify you and publicly acknowledge your contribution (unless you prefer to remain anonymous).
26+
5. Once the vulnerability is fixed, we will notify you and publicly acknowledge your contribution (unless you prefer to remain anonymous).

0 commit comments

Comments
 (0)