diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index f77473f3a8..c7ceff427e 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -71,7 +71,7 @@ fi # Set up environment variables if .env doesn't exist for the sim app if [ ! -f "apps/sim/.env" ]; then - echo "π Creating .env file from template..." + echo "π Creating apps/sim/.env from template..." if [ -f "apps/sim/.env.example" ]; then cp apps/sim/.env.example apps/sim/.env else @@ -79,6 +79,18 @@ if [ ! -f "apps/sim/.env" ]; then fi fi +# Set up env for the realtime server (must match the shared values in apps/sim/.env) +if [ ! -f "apps/realtime/.env" ] && [ -f "apps/realtime/.env.example" ]; then + echo "π Creating apps/realtime/.env from template..." + cp apps/realtime/.env.example apps/realtime/.env +fi + +# Set up packages/db/.env for drizzle-kit and migration scripts +if [ ! -f "packages/db/.env" ] && [ -f "packages/db/.env.example" ]; then + echo "π Creating packages/db/.env from template..." + cp packages/db/.env.example packages/db/.env +fi + # Generate schema and run database migrations echo "ποΈ Running database schema generation and migrations..." echo "Generating schema..." diff --git a/README.md b/README.md index 57c0192825..e2489be54b 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,55 @@ -
-
-
-
The open-source platform to build AI agents and run your agentic workforce. Connect 1,000+ integrations and LLMs to orchestrate agentic workflows.
- +The open-source platform to build AI agents and run your agentic workforce. Connect 1,000+ integrations and LLMs to orchestrate agentic workflows. + + + - ### Build Workflows with Ease + Design agent workflows visually on a canvasβconnect agents, tools, and blocks, then run them instantly. -
-
-
-
-
-
-
Made with β€οΈ by the Sim Team
+Made with β€οΈ by the Sim Team \ No newline at end of file diff --git a/apps/realtime/.env.example b/apps/realtime/.env.example new file mode 100644 index 0000000000..26ef119c01 --- /dev/null +++ b/apps/realtime/.env.example @@ -0,0 +1,30 @@ +# Environment variables required by the @sim/realtime (Socket.IO) server. +# These MUST match the corresponding values in apps/sim/.env for auth to work. +# See apps/realtime/src/env.ts for the full zod schema. + +# Core +NODE_ENV=development +PORT=3002 + +# Database β must point at the same Postgres as the main app +DATABASE_URL=postgresql://postgres:postgres@localhost:5432/simstudio + +# Auth β shared with apps/sim (Better Auth "Shared Database Session" pattern) +BETTER_AUTH_URL=http://localhost:3000 +BETTER_AUTH_SECRET=your_better_auth_secret_min_32_chars + +# Internal RPC β shared with apps/sim +INTERNAL_API_SECRET=your_internal_api_secret_min_32_chars + +# Public app URL β used for CORS allow-list and base URL resolution +NEXT_PUBLIC_APP_URL=http://localhost:3000 + +# Optional: Redis for cross-pod room management +# Leave unset for single-pod / in-memory rooms +# REDIS_URL=redis://localhost:6379 + +# Optional: extra Socket.IO CORS allow-list (comma-separated) +# ALLOWED_ORIGINS=https://embed.example.com,https://admin.example.com + +# Optional: disable auth entirely for trusted private networks +# DISABLE_AUTH=true diff --git a/apps/realtime/src/env.ts b/apps/realtime/src/env.ts index 7794ef4115..91c7e4c648 100644 --- a/apps/realtime/src/env.ts +++ b/apps/realtime/src/env.ts @@ -8,12 +8,9 @@ const EnvSchema = z.object({ BETTER_AUTH_SECRET: z.string().min(32), INTERNAL_API_SECRET: z.string().min(32), NEXT_PUBLIC_APP_URL: z.string().url(), - INTERNAL_API_BASE_URL: z.string().url().optional(), ALLOWED_ORIGINS: z.string().optional(), - SOCKET_SERVER_URL: z.string().url().optional(), PORT: z.coerce.number().int().positive().default(3002), SOCKET_PORT: z.coerce.number().int().positive().optional(), - HOSTNAME: z.string().default('0.0.0.0'), DISABLE_AUTH: z .string() .optional() @@ -46,7 +43,3 @@ export const isAuthDisabled = env.DISABLE_AUTH === true && !isHosted export function getBaseUrl(): string { return env.NEXT_PUBLIC_APP_URL } - -export function getInternalApiBaseUrl(): string { - return env.INTERNAL_API_BASE_URL ?? env.NEXT_PUBLIC_APP_URL -} diff --git a/apps/realtime/src/index.test.ts b/apps/realtime/src/index.test.ts index 21d0decc77..c00592e0d6 100644 --- a/apps/realtime/src/index.test.ts +++ b/apps/realtime/src/index.test.ts @@ -45,7 +45,6 @@ vi.mock('@/env', () => ({ INTERNAL_API_SECRET: 'test-internal-api-secret-at-least-32-chars', NEXT_PUBLIC_APP_URL: 'http://localhost:3000', PORT: 3002, - HOSTNAME: '0.0.0.0', DISABLE_AUTH: false, }, isProd: false, @@ -54,7 +53,6 @@ vi.mock('@/env', () => ({ isHosted: false, isAuthDisabled: false, getBaseUrl: () => 'http://localhost:3000', - getInternalApiBaseUrl: () => 'http://localhost:3000', })) vi.mock('@/middleware/auth', () => ({ diff --git a/package.json b/package.json index 281a1daab1..b857f3c0f8 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ "scripts": { "build": "turbo run build", "dev": "turbo run dev", - "dev:sockets": "bun --cwd apps/realtime run dev", - "dev:full": "bunx concurrently -n \"App,Realtime\" -c \"cyan,magenta\" \"bun --cwd apps/sim run dev\" \"bun --cwd apps/realtime run dev\"", + "dev:sockets": "cd apps/realtime && bun run dev", + "dev:full": "bunx concurrently -n \"App,Realtime\" -c \"cyan,magenta\" \"cd apps/sim && bun run dev\" \"cd apps/realtime && bun run dev\"", "test": "turbo run test", "format": "turbo run format", "format:check": "turbo run format:check", diff --git a/packages/db/.env.example b/packages/db/.env.example index bc06b7099c..14459e61f5 100644 --- a/packages/db/.env.example +++ b/packages/db/.env.example @@ -1,2 +1,5 @@ -# Database URL (Required for migrations and database operations) -DATABASE_URL="postgresql://postgres:your_password@localhost:5432/simstudio" \ No newline at end of file +# Database connection used by @sim/db scripts (drizzle-kit generate, +# db:migrate, register-sso-provider, etc.). Must match DATABASE_URL in +# apps/sim/.env and apps/realtime/.env. + +DATABASE_URL="postgresql://postgres:postgres@localhost:5432/simstudio"