Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

@waleedlatif1 waleedlatif1 commented Oct 1, 2025

Summary

  • remove vercel deps,
  • remove railway socket server
  • remove crons from vercel
  • improve DB connection config to reflect new infra

Type of Change

  • New feature
  • Other: Performance

Testing

Manually,

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Oct 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Oct 1, 2025 11:28pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Oct 1, 2025 11:28pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This PR implements a comprehensive infrastructure cleanup that removes dependencies on Vercel and Railway deployment platforms while standardizing database connection configuration. The changes eliminate platform-specific environment variables, configuration files, and cron jobs in favor of a more streamlined, Docker-based deployment approach.

The core changes include:

  • Database Connection Standardization: All database connections now use DATABASE_URL exclusively, removing the POSTGRES_URL fallback that was previously used for Railway compatibility. This affects the main database client (packages/db/index.ts), socket server operations, and various scripts throughout the codebase.
  • Platform Configuration Removal: Complete removal of vercel.json and railway.json configuration files, eliminating scheduled cron jobs (schedule execution, email webhook polling, log cleanup) and platform-specific deployment settings.
  • Environment Variable Cleanup: Removal of Vercel-specific variables like NEXT_PUBLIC_VERCEL_URL from CORS configurations and @vercel/analytics dependency from package.json.
  • Database Connection Improvements: Enhanced connection pooling (increased max connections from 60 to 80), added development-mode connection caching to prevent pool exhaustion during hot reloads, and simplified connection string validation.

These changes align with a move toward container-based deployments using Docker, as evidenced by the existing Dockerfile configurations. The removal of Vercel cron jobs suggests migration to an alternative scheduling system like Trigger.dev, which is already configured in the environment variables.

Important Files Changed

Changed Files
Filename Score Overview
vercel.json 3/5 Complete removal of Vercel cron configuration eliminating 5 scheduled jobs including schedule execution and webhook polling
railway.json 5/5 Complete removal of Railway deployment configuration for socket server
packages/db/index.ts 4/5 Standardized database connection to use only DATABASE_URL, increased max connections to 80, added dev connection caching
packages/db/drizzle.config.ts 4/5 Simplified database URL configuration removing POSTGRES_URL fallback
apps/sim/lib/env.ts 4/5 Removed optional POSTGRES_URL environment variable from server configuration
apps/sim/lib/auth-client.ts 4/5 Simplified base URL function removing Vercel-specific environment handling
apps/sim/socket-server/config/socket.ts 5/5 Removed NEXT_PUBLIC_VERCEL_URL from CORS allowed origins
apps/sim/socket-server/rooms/manager.ts 4/5 Standardized database connection to use only DATABASE_URL
apps/sim/socket-server/database/operations.ts 5/5 Removed POSTGRES_URL fallback from database connection string
apps/sim/app/workspace/[workspaceId]/knowledge/hooks/use-knowledge-upload.ts 4/5 Removed VERCEL_MAX_BODY_SIZE constant while maintaining 4MB upload threshold
packages/db/scripts/register-sso-provider.ts 4/5 Standardized to use DATABASE_URL only for database connections
package.json 4/5 Removed @vercel/analytics dependency as part of Vercel cleanup
.devcontainer/docker-compose.yml 5/5 Removed redundant POSTGRES_URL environment variable
docker/app.Dockerfile 5/5 Removed redundant POSTGRES_URL from Docker build environment

Confidence score: 3/5

  • This PR introduces significant infrastructure changes that could break existing deployments relying on Vercel cron jobs or Railway-specific configurations
  • Score reflects the high-impact nature of removing critical scheduled tasks like webhook polling and log cleanup without clear migration path documented
  • Pay close attention to vercel.json removal as it eliminates 5 scheduled cron jobs that may be critical for application functionality

Sequence Diagram

sequenceDiagram
    participant User
    participant DevContainer as "Dev Container"
    participant App as "Sim App"
    participant SocketServer as "Socket Server" 
    participant DB as "PostgreSQL Database"
    participant Realtime as "Realtime Service"
    participant Storage as "Cloud Storage"

    User->>DevContainer: "Start development environment"
    DevContainer->>DB: "Start PostgreSQL with pgvector"
    DB-->>DevContainer: "Database ready"
    DevContainer->>App: "Run migrations"
    App->>DB: "CREATE/ALTER tables"
    DB-->>App: "Migration complete"
    DevContainer->>App: "Start application on port 3000"
    DevContainer->>Realtime: "Start realtime service on port 3002"
    DevContainer->>SocketServer: "Start socket server on port 3001"
    
    User->>App: "Upload knowledge files"
    App->>Storage: "Get presigned URLs"
    Storage-->>App: "Return upload URLs"
    App->>Storage: "Upload files directly"
    Storage-->>App: "Files uploaded"
    App->>DB: "Store file metadata"
    
    User->>App: "Join workflow room"
    App->>SocketServer: "Connect to workflow"
    SocketServer->>DB: "Get workflow state"
    DB-->>SocketServer: "Return workflow data"
    SocketServer-->>App: "Workflow state synchronized"
    
    User->>App: "Modify workflow blocks"
    App->>SocketServer: "Send workflow changes"
    SocketServer->>DB: "Persist block operations"
    SocketServer->>App: "Broadcast to other users"
Loading

Additional Comments (1)

  1. apps/sim/app/workspace/[workspaceId]/knowledge/hooks/use-knowledge-upload.ts, line 213 (link)

    style: The error message still mentions 4MB limit but no longer references the specific platform constraint. Consider updating the error message to be more generic about the API route limitation.

14 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@vercel vercel bot temporarily deployed to Preview – docs October 1, 2025 23:00 Inactive
@vercel vercel bot temporarily deployed to Preview – docs October 1, 2025 23:24 Inactive
@icecrasher321 icecrasher321 merged commit 6e63eaf into staging Oct 1, 2025
10 checks passed
@waleedlatif1 waleedlatif1 deleted the improvement/dependencies branch October 7, 2025 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants