{
  "id": "xTJpZ7LFJ7pIK6v8",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Set Up Full MERN Stack Development Environment in 10 Seconds",
  "tags": [],
  "nodes": [
    {
      "id": "a05a9421-9722-4b8a-8105-fa5568137783",
      "name": "Start",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "3e777158-c7ea-44df-9da3-6382f9909ceb",
      "name": "Set Parameters",
      "type": "n8n-nodes-base.set",
      "position": [
        220,
        0
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "server_host",
              "value": "={{ $json.server_host || '192.168.1.100' }}"
            },
            {
              "name": "server_user",
              "value": "{{ $json.server_user || 'root' }}"
            },
            {
              "name": "server_password",
              "value": "{{ $json.server_password || 'your_password' }}"
            },
            {
              "name": "setup_type",
              "value": "={{ $json.setup_type || 'full' }}"
            },
            {
              "name": "node_version",
              "value": "{{ $json.node_version || '20' }}"
            },
            {
              "name": "mongodb_version",
              "value": "{{ $json.mongodb_version || '7.0' }}"
            },
            {
              "name": "username",
              "value": "{{ $json.username || 'developer' }}"
            },
            {
              "name": "user_password",
              "value": "{{ $json.user_password || 'dev123' }}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "871544b0-9465-4c48-9b27-8f75ec5307bd",
      "name": "System Preparation",
      "type": "n8n-nodes-base.ssh",
      "position": [
        440,
        0
      ],
      "parameters": {
        "command": "#!/bin/bash\n\necho \"\ud83d\ude80 Starting MERN Stack Development Environment Setup...\"\necho \"YOUR_AWS_SECRET_KEY_HERE==============\"\n\n# Update system packages\necho \"\ud83d\udce6 Updating system packages...\"\napt update -y && apt upgrade -y\n\n# Install essential development tools\necho \"\ud83d\udd27 Installing essential development tools...\"\napt install -y curl wget git vim nano build-essential software-properties-common apt-transport-https ca-certificates gnupg lsb-release\n\n# Install Python and pip (for some Node.js native modules)\napt install -y python3 python3-pip\n\n# Install snapd for VS Code installation\napt install -y snapd\n\necho \"\u2705 System preparation completed!\"",
        "authentication": "privateKey"
      },
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e9df114a-a901-483a-a1f8-8664fdfeb688",
      "name": "Install Node.js & npm",
      "type": "n8n-nodes-base.ssh",
      "position": [
        660,
        0
      ],
      "parameters": {
        "command": "#!/bin/bash\n\necho \"\ud83d\udcf1 Installing Node.js and npm...\"\necho \"================================\"\n\n# Install Node.js using NodeSource repository\ncurl -fsSL https://deb.nodesource.com/setup_{{ $json.node_version }}.x | bash -\napt install -y nodejs\n\n# Verify installation\necho \"Node.js version: $(node --version)\"\necho \"npm version: $(npm --version)\"\n\n# Install global npm packages for MERN development\necho \"\ud83d\udce6 Installing global npm packages...\"\nnpm install -g create-react-app\nnpm install -g @angular/cli\nnpm install -g express-generator\nnpm install -g nodemon\nnpm install -g pm2\nnpm install -g serve\nnpm install -g typescript\nnpm install -g ts-node\nnpm install -g @nestjs/cli\nnpm install -g next\nnpm install -g vite\nnpm install -g eslint\nnpm install -g prettier\nnpm install -g json-server\nnpm install -g http-server\nnpm install -g concurrently\nnpm install -g cross-env\nnpm install -g dotenv-cli\n\necho \"\u2705 Node.js and npm packages installed successfully!\"",
        "authentication": "privateKey"
      },
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "29ff40ce-a21d-4734-b3a7-97808734640f",
      "name": "Install MongoDB",
      "type": "n8n-nodes-base.ssh",
      "position": [
        880,
        0
      ],
      "parameters": {
        "command": "#!/bin/bash\n\necho \"\ud83c\udf43 Installing MongoDB...\"\necho \"========================\"\n\n# Import MongoDB GPG key\nwget -qO - https://www.mongodb.org/static/pgp/server-{{ $json.mongodb_version }}.asc | apt-key add -\n\n# Add MongoDB repository\necho \"deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/{{ $json.mongodb_version }} multiverse\" | tee /etc/apt/sources.list.d/mongodb-org-{{ $json.mongodb_version }}.list\n\n# Update package list\napt update\n\n# Install MongoDB\napt install -y mongodb-org\n\n# Start and enable MongoDB\nsystemctl start mongod\nsystemctl enable mongod\n\n# Install MongoDB Compass (GUI)\nwget https://downloads.mongodb.com/compass/mongodb-compass_1.40.4_amd64.deb\ndpkg -i mongodb-compass_1.40.4_amd64.deb\napt-get install -f -y\n\n# Install MongoDB Shell (mongosh)\nwget -qO - https://www.mongodb.org/static/pgp/server-{{ $json.mongodb_version }}.asc | apt-key add -\necho \"deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/{{ $json.mongodb_version }} multiverse\" | tee /etc/apt/sources.list.d/mongodb-org-{{ $json.mongodb_version }}.list\napt update\napt install -y mongodb-mongosh\n\n# Verify MongoDB installation\necho \"MongoDB version: $(mongod --version | head -n 1)\"\necho \"MongoDB Shell version: $(mongosh --version)\"\n\necho \"\u2705 MongoDB installed and started successfully!\"",
        "authentication": "privateKey"
      },
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "29ffdf78-1261-4014-82d8-df503855bd77",
      "name": "Install Git & GitHub CLI",
      "type": "n8n-nodes-base.ssh",
      "position": [
        1100,
        0
      ],
      "parameters": {
        "command": "#!/bin/bash\n\necho \"\ud83d\udc19 Installing Git and Version Control Tools...\"\necho \"YOUR_AWS_SECRET_KEY_HERE=====\"\n\n# Git is already installed in system preparation, but let's configure it\necho \"Git version: $(git --version)\"\n\n# Install GitHub CLI\ncurl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg\necho \"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main\" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null\napt update\napt install -y gh\n\necho \"GitHub CLI version: $(gh --version)\"\necho \"\u2705 Git and version control tools installed successfully!\"",
        "authentication": "privateKey"
      },
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a5525dae-7d94-4b11-b970-f77eff362c81",
      "name": "Install Development Tools",
      "type": "n8n-nodes-base.ssh",
      "position": [
        1320,
        0
      ],
      "parameters": {
        "command": "#!/bin/bash\n\necho \"\ud83d\udcbb Installing Development Tools and IDEs...\"\necho \"YOUR_AWS_SECRET_KEY_HERE==\"\n\n# Install Visual Studio Code\nwget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg\ninstall -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/\necho \"deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main\" > /etc/apt/sources.list.d/vscode.list\napt update\napt install -y code\n\n# Install Postman (API testing tool)\nsnap install postman\n\n# Install Docker (for containerization)\napt install -y docker.io docker-compose\nsystemctl start docker\nsystemctl enable docker\n\n# Install Nginx (web server)\napt install -y nginx\nsystemctl start nginx\nsystemctl enable nginx\n\n# Install Redis (caching)\napt install -y redis-server\nsystemctl start redis-server\nsystemctl enable redis-server\n\n# Install PostgreSQL (alternative database)\napt install -y postgresql postgresql-contrib\nsystemctl start postgresql\nsystemctl enable postgresql\n\necho \"\u2705 Development tools installed successfully!\"",
        "authentication": "privateKey"
      },
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c77aa619-580a-426e-9810-d68d885d6c78",
      "name": "Create Dev User",
      "type": "n8n-nodes-base.ssh",
      "position": [
        1540,
        0
      ],
      "parameters": {
        "command": "#!/bin/bash\n\necho \"\ud83d\udc64 Creating Development User Account...\"\necho \"======================================\"\n\n# Create a new user for development\nuseradd -m -s /bin/bash {{ $json.username }}\necho \"{{ $json.username }}:{{ $json.user_password }}\" | chpasswd\n\n# Add user to sudo group\nusermod -aG sudo {{ $json.username }}\n\n# Add user to docker group\nusermod -aG docker {{ $json.username }}\n\n# Create development directories\nsu - {{ $json.username }} -c \"mkdir -p ~/projects ~/websites ~/apis ~/mobile-apps\"\nsu - {{ $json.username }} -c \"mkdir -p ~/tools ~/scripts ~/backup\"\n\n# Set up SSH key for the user\nsu - {{ $json.username }} -c \"ssh-keygen -t rsa -b 4096 -C '{{ $json.username }}@mern-dev' -N '' -f ~/.ssh/id_rsa\"\n\n# Configure Git for the user\nsu - {{ $json.username }} -c \"git config --global user.name '{{ $json.username }}'\"\nsu - {{ $json.username }} -c \"git config --global user.email '{{ $json.username }}@example.com'\"\nsu - {{ $json.username }} -c \"git config --global init.defaultBranch main\"\n\necho \"\u2705 Development user created successfully!\"\necho \"Username: {{ $json.username }}\"\necho \"Password: {{ $json.user_password }}\"\necho \"SSH Key: /home/{{ $json.username }}/.ssh/id_rsa.pub\"",
        "authentication": "privateKey"
      },
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b2604ff6-7fde-409e-99da-02a938c3aa00",
      "name": "Install Additional Tools",
      "type": "n8n-nodes-base.ssh",
      "position": [
        1760,
        0
      ],
      "parameters": {
        "command": "#!/bin/bash\n\necho \"\ud83d\ude80 Installing Additional MERN Stack Tools...\"\necho \"YOUR_AWS_SECRET_KEY_HERE====\"\n\n# Install Yarn (alternative package manager)\nnpm install -g yarn\n\n# Install pnpm (fast package manager)\nnpm install -g pnpm\n\n# Install Heroku CLI (for deployment)\ncurl https://cli-assets.heroku.com/install.sh | sh\n\n# Install Vercel CLI (for deployment)\nnpm install -g vercel\n\n# Install Netlify CLI (for deployment)\nnpm install -g netlify-cli\n\n# Install Firebase CLI (for deployment)\nnpm install -g firebase-tools\n\n# Install AWS CLI (for deployment)\napt install -y awscli\n\n# Install Google Cloud SDK\necho \"deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main\" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list\ncurl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -\napt update\napt install -y google-cloud-cli\n\n# Install additional development utilities\nnpm install -g @storybook/cli\nnpm install -g webpack webpack-cli\nnpm install -g parcel-bundler\nnpm install -g rollup\nnpm install -g gulp-cli\nnpm install -g grunt-cli\nnpm install -g lerna\nnpm install -g nx\n\necho \"\u2705 Additional MERN Stack tools installed successfully!\"",
        "authentication": "privateKey"
      },
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "74607dbf-dae5-4fad-b3a6-27d6b508118e",
      "name": "Final Configuration",
      "type": "n8n-nodes-base.ssh",
      "position": [
        1980,
        0
      ],
      "parameters": {
        "command": "#!/bin/bash\n\necho \"\ud83d\udd27 Final Configuration and Setup...\"\necho \"===================================\"\n\n# Configure firewall\nufw enable\nufw allow 22/tcp    # SSH\nufw allow 80/tcp    # HTTP\nufw allow 443/tcp   # HTTPS\nufw allow 3000/tcp  # React dev server\nufw allow 3001/tcp  # Express API\nufw allow 27017/tcp # MongoDB\nufw allow 5000/tcp  # Development server\nufw allow 8000/tcp  # Alternative dev server\n\n# Set up environment variables template\ncat > /home/{{ $json.username }}/.env.example << 'EOF'\n# MongoDB Configuration\nMONGO_URI=mongodb://user:user@example.com\nEMAIL_PASS=your-app-password\n\n# Cloud Storage (optional)\nCLOUDINARY_CLOUD_NAME=your-cloud-name\nCLOUDINARY_API_KEY=your-api-key\nCLOUDINARY_API_SECRET=your-api-secret\n\n# Payment Gateway (optional)\nSTRIPE_PUBLIC_KEY=your-stripe-public-key\nSTRIPE_SECRET_KEY=your-stripe-secret-key\nEOF\n\n# Create a sample MERN project structure\nsu - {{ $json.username }} -c \"mkdir -p ~/projects/sample-mern-app/{client,server,database}\"\n\n# Create package.json for the root project\ncat > /home/{{ $json.username }}/projects/sample-mern-app/package.json << 'EOF'\n{\n  \"name\": \"sample-mern-app\",\n  \"version\": \"1.0.0\",\n  \"description\": \"A sample MERN stack application\",\n  \"main\": \"server/index.js\",\n  \"scripts\": {\n    \"dev\": \"concurrently \\\"npm run server\\\" \\\"npm run client\\\"\",\n    \"server\": \"cd server && npm run dev\",\n    \"client\": \"cd client && npm start\",\n    \"build\": \"cd client && npm run build\",\n    \"install-deps\": \"npm install && cd client && npm install && cd ../server && npm install\"\n  },\n  \"keywords\": [\"mern\", \"mongodb\", \"express\", \"react\", \"nodejs\"],\n  \"author\": \"{{ $json.username }}\",\n  \"license\": \"MIT\",\n  \"devDependencies\": {\n    \"concurrently\": \"^8.2.2\"\n  }\n}\nEOF\n\n# Change ownership of the project files\nchown -R {{ $json.username }}:{{ $json.username }} /home/{{ $json.username }}/projects/\n\necho \"\u2705 Final configuration completed!\"\necho \"\ud83c\udf89 MERN Stack Development Environment Setup Complete!\"\necho \"YOUR_AWS_SECRET_KEY_HERE============\"\necho \"\ud83d\udcca Installation Summary:\"\necho \"\u2022 Node.js version: $(node --version)\"\necho \"\u2022 npm version: $(npm --version)\"\necho \"\u2022 MongoDB: Installed and running\"\necho \"\u2022 Git: $(git --version)\"\necho \"\u2022 Docker: $(docker --version)\"\necho \"\u2022 VS Code: Installed\"\necho \"\u2022 Development User: {{ $json.username }}\"\necho \"\u2022 Project Directory: /home/{{ $json.username }}/projects/\"\necho \"\"\necho \"\ud83d\ude80 Your MERN Stack development environment is ready!\"\necho \"Login as: {{ $json.username }}\"\necho \"Password: {{ $json.user_password }}\"\necho \"Happy coding! \ud83c\udfaf\"",
        "authentication": "privateKey"
      },
      "credentials": {
        "sshPrivateKey": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4f12469f-3045-4a24-a0bc-f60ad1f3c8ff",
      "name": "Setup Complete",
      "type": "n8n-nodes-base.set",
      "position": [
        2200,
        0
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "setup_status",
              "value": "\u2705 MERN Stack Development Environment Setup Complete!"
            },
            {
              "name": "server_info",
              "value": "Host: {{ $('Set Parameters').item.json.server_host }}"
            },
            {
              "name": "dev_user",
              "value": "Username: {{ $('Set Parameters').item.json.username }}"
            },
            {
              "name": "dev_password",
              "value": "Password: {{ $('Set Parameters').item.json.user_password }}"
            },
            {
              "name": "installed_tools",
              "value": "Node.js, MongoDB, Git, Docker, VS Code, Postman, Nginx, Redis, PostgreSQL"
            },
            {
              "name": "project_directory",
              "value": "/home/{{ $('Set Parameters').item.json.username }}/projects/"
            },
            {
              "name": "next_steps",
              "value": "SSH into server, switch to dev user, and start building MERN applications!"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "9b9e73a5-ee17-4101-8480-ee6208e9ef39",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -30,
        -240
      ],
      "parameters": {
        "color": 3,
        "width": 160,
        "height": 400,
        "content": "Start workflow "
      },
      "typeVersion": 1
    },
    {
      "id": "5ddce496-b4fc-466e-85bb-5f0a99ceed6b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1290,
        -240
      ],
      "parameters": {
        "color": 5,
        "width": 160,
        "height": 400,
        "content": " Installs VS Code, Docker, Docker Compose, Postman, Nginx, Redis, and PostgreSQL"
      },
      "typeVersion": 1
    },
    {
      "id": "61c05631-96fc-499a-91a6-a161200ab8ef",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1510,
        -240
      ],
      "parameters": {
        "width": 160,
        "height": 400,
        "content": "Creates a development user account"
      },
      "typeVersion": 1
    },
    {
      "id": "98575397-0e35-4895-a844-1681d2f236bd",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1730,
        -240
      ],
      "parameters": {
        "color": 4,
        "width": 160,
        "height": 400,
        "content": "Installs package managers (npm, Yarn, pnpm), global npm packages, deployment tools, build tools, and security tools"
      },
      "typeVersion": 1
    },
    {
      "id": "c8bb21d0-1dee-4c52-87ba-405b11aec972",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1950,
        -240
      ],
      "parameters": {
        "color": 3,
        "width": 160,
        "height": 400,
        "content": "Configures firewall, SSH keys, and environment variables template"
      },
      "typeVersion": 1
    },
    {
      "id": "51859ab3-876d-4624-9ade-8880884844d6",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2170,
        -240
      ],
      "parameters": {
        "color": 2,
        "width": 160,
        "height": 400,
        "content": "Marks the completion of the setup process"
      },
      "typeVersion": 1
    },
    {
      "id": "0b397e0e-7915-40df-9ace-0166af2af7ab",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        850,
        -240
      ],
      "parameters": {
        "color": 2,
        "width": 160,
        "height": 400,
        "content": "Installs MongoDB (v7.0 by default) with Compass & Shell"
      },
      "typeVersion": 1
    },
    {
      "id": "8fb206ab-8781-404a-9b16-033167434879",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        630,
        -240
      ],
      "parameters": {
        "color": 6,
        "width": 160,
        "height": 400,
        "content": "Installs Node.js (v20 by default) with npm"
      },
      "typeVersion": 1
    },
    {
      "id": "c6d8019d-713b-41a6-b1e4-8c6208ec9f6a",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        410,
        -240
      ],
      "parameters": {
        "color": 4,
        "width": 160,
        "height": 400,
        "content": "Prepares the system for installation"
      },
      "typeVersion": 1
    },
    {
      "id": "bc912ffd-b6e1-40d7-b0e6-78a6c5c287cf",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        190,
        -240
      ],
      "parameters": {
        "width": 160,
        "height": 400,
        "content": "Configures server host, user, password, setup type, Node.js version, MongoDB version, username, and user password"
      },
      "typeVersion": 1
    },
    {
      "id": "702c6303-c249-4be8-b2e7-a8659aeaf916",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1070,
        -240
      ],
      "parameters": {
        "color": 3,
        "width": 160,
        "height": 400,
        "content": "Installs Git and GitHub CLI"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ad90122a-5c03-4c2e-8170-dc563ec3dccd",
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Set Parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Parameters": {
      "main": [
        [
          {
            "node": "System Preparation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Dev User": {
      "main": [
        [
          {
            "node": "Install Additional Tools",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Install MongoDB": {
      "main": [
        [
          {
            "node": "Install Git & GitHub CLI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "System Preparation": {
      "main": [
        [
          {
            "node": "Install Node.js & npm",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Final Configuration": {
      "main": [
        [
          {
            "node": "Setup Complete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Install Node.js & npm": {
      "main": [
        [
          {
            "node": "Install MongoDB",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Install Additional Tools": {
      "main": [
        [
          {
            "node": "Final Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Install Git & GitHub CLI": {
      "main": [
        [
          {
            "node": "Install Development Tools",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Install Development Tools": {
      "main": [
        [
          {
            "node": "Create Dev User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}