KOSUNI KOREA
Korean News in English
Technology

AI Creates Servers Automatically! Completing Project Setup with Shell Script and Claude (Part 2)

Published October 15, 2026 · 2 views



AI Creates Servers Automatically! Completing Project Setup with Shell Script and Claude (Part 2)

In the previous lesson, we created a project creation interface and designed the project setup process.

This time, let's implement the actual functionality to create projects on the server.

When an administrator enters a project name and clicks the Create Button, the server automatically performs the following tasks:

  • Creates a project folder

  • Prepares a Git repository

  • Creates a MySQL database

  • Creates a MySQL account

  • Generates an Nginx Virtual Host

  • Creates environment variables (.env)

  • Sets permissions

  • Applies the service configuration

These tasks are handled automatically by Shell Script and Node.js, eliminating the need for manual input.


Why Use Shell Script?

Node.js is an excellent environment for building web applications.

However, when it comes to directly controlling the operating system, Shell Script is much more efficient.

For example, commands like these are best handled by Shell Script:

  • mkdir

  • cp

  • mv

  • chmod

  • chown

  • ln -s

  • systemctl

  • nginx -t

The most stable approach is for Node.js to handle user requests while Shell Script performs the actual server operations.


Project Creation Workflow

Creating a project requires executing multiple steps in sequence.

The recommended order of execution is as follows:

Step

Action

1

Project name validation

2

Create project folder

3

Initialize or clone Git repository

4

Create MySQL database

5

Create MySQL account

6

Create Nginx configuration

7

Create .env file

8

Set permissions

9

Reload Nginx

10

Return results

Maintaining this order makes it easier to identify the source of errors if they occur.


Node.js Executes Shell Script

Instead of directly executing server commands, Node.js calls Shell Script.

For example, when a project creation request is received:

  1. Validate input values

  2. Execute the Shell Script

  3. Receive the execution result

  4. Display it on the admin interface

This separation of responsibilities makes maintenance easier and allows reusing the same script across different projects.


Create MySQL Databases Automatically Too

Once a project is created, its database should also be prepared.

The following items can be automatically generated:

Item to Create

Description

Database

Dedicated database for the project

User

Dedicated account for the project

Password

Random or specified password

Grant

Automatic permission assignment

Using separate databases for each project simplifies management and backups.


Automatically Generate Nginx Virtual Hosts Too

Nginx configuration is essential for running web services.

During project creation, the following tasks can also be automated:

  • Create Virtual Host

  • Set root path

  • Connect to PHP or Node.js

  • Configure Rewrite rules

  • Prepare SSL settings

The goal is to create an environment where administrators don't need to manually modify configuration files.


Automatically Generate .env Files Too

Environment variables for each project typically follow the same format.

For example:

  • DB_HOST

  • DB_NAME

  • DB_USER

  • DB_PASSWORD

  • PORT

  • SESSION_SECRET

Automatically generating these files allows projects to run immediately.

This means the basic environment is ready at the time of project creation.


Show Execution Results on Admin Interface

Automation also includes displaying execution results for verification.

The following information can be shown:

Item

Status

Project folder

Completed

Git repository

Completed

Database

Completed

Nginx

Completed

.env file

Completed

Error

No errors

This makes it easy to identify where issues occurred, simplifying maintenance.


Automatically Recover from Failed Tasks

Errors can occur during project creation.

For example, if database creation succeeds but Nginx configuration fails, some tasks might be partially completed.

To handle such cases, it's recommended to implement rollback functionality:

  • Delete created databases

  • Delete project folders

  • Remove Nginx configurations

  • Undo Git initialization

Just as automation is important, automatic recovery is equally crucial.


Let Claude Handle the Automation Too

Shell Script is one area where Claude excels at writing code.

Developers only need to define:

  • The order of tasks

  • The rules for creation

And Claude will generate the Shell Script and Node.js code accordingly.

This structure becomes increasingly valuable as more projects are created.


Project Creation is a Platform Feature

Today, project creation isn't just about creating folders.

With a single click on the Create button:

  • Development environment setup

  • Database creation

  • Git connection

  • Server configuration

All these steps are completed automatically.

As such features accumulate, the project management system evolves from a simple admin page into a development platform.


Frequently Asked Questions (FAQ)

Q1. Can I automate everything with just Node.js without Shell Script?

It's possible, but using Shell Script alongside Node.js for system commands and server configuration provides greater stability and easier maintenance.

Q2. What happens if an error occurs during project creation?

We recommend logging each step's results and implementing automatic rollback to undo previous actions when failures occur.

Q3. Is this approach limited to Ubuntu servers?

The examples are based on Ubuntu, but with appropriate Shell Script adjustments, the same structure can be used across other Linux environments.


Conclusion

Automating repetitive tasks when starting a project significantly improves both development speed and operational efficiency.

By combining Node.js, Shell Script, and Claude's assistance, you can create a development platform that sets up server environments with just one button click on the project creation button.

In this lesson, we completed the automated project setup feature and connected it to actual server operations.

In the next lesson, we'll implement a fully automated system where Git repository connection, first commit, and development server deployment are all handled by a single button click.




FAQ

Can I automate everything with just Node.js without Shell Script?

It's possible, but using Shell Script alongside Node.js for system commands and server configuration provides greater stability and easier maintenance.

What happens if an error occurs during project creation?

We recommend logging each step's results and implementing automatic rollback to undo previous actions when failures occur.

Is this approach limited to Ubuntu servers?

The examples are based on Ubuntu, but with appropriate Shell Script adjustments, the same structure can be used across other Linux environments.

Korean Source

This article is an English localization of a Korean-language report from BlogScore. Original: 12강-2 AI가 서버를 직접 생성한다! Shell Script와 Claude로 프로젝트 자동 구축 완성하기(2편)