Skip to main content

Comprehensive Guide to Setting Up a JS Project Using Git

This guide will walk you through the process of setting up a JS project using Git. By following these steps, you can quickly and confidently start your project.

1. Initial Setup

JS Initial Setup

Application Name

First, choose a suitable name for your application. This name will be used as the identifier in your project's domain.

caution
  • Use lowercase letters and only - as a separator between words.
  • The application name cannot be changed after creation.

Node Version

Selecting the appropriate Node version for your project is crucial. Choose from the available list or enter your desired version. Note that the selected version must be available in Docker repositories (e.g., DockerHub).

Repository

Repository URL

Enter the Git repository URL for your project. Example: https://github.com/username/repo

danger

Ensure that the package.json file exists in your project.

Repository Type and Access

  • Public: Enter the URL directly.
  • Private: You can connect your private repository to Kubar in two ways:

Connect with Access Token

Connect with SSH Key

After completing this step, select the "Next" option.

2. Advanced Settings (Optional)

JS Advanced Settings

In this section, you can apply more precise settings for your project:

Build

Sample package.json file:

{
"name": "your-project-name",
"version": "1.0.0",
"description": "Your project description",
"main": "index.js",
"type": "commonjs", // Use "module" for ES modules
"private": true,

"scripts": {
"start": "node index.js",
"dev": "nodemon index.js",
"test": "jest",
"lint": "eslint .",
"build": "tsc",
"clean": "rm -rf dist"
},

"keywords": [
"nodejs",
"express",
"api"
],

"author": "Your Name <your.email@example.com>",
"license": "MIT",

"dependencies": {
"express": "^4.18.2",
"dotenv": "^16.3.1",
"mongoose": "^7.6.3",
"cors": "^2.8.5",
"helmet": "^7.0.0",
"jsonwebtoken": "^9.0.2",
"bcryptjs": "^2.4.3"
},

"devDependencies": {
"nodemon": "^3.0.1",
"jest": "^29.7.0",
"eslint": "^8.51.0",
"typescript": "^5.2.2",
"@types/node": "^20.8.6",
"@types/express": "^4.17.18"
},

"engines": {
"node": ">=16.0.0",
"npm": ">=8.0.0"
},

"repository": {
"type": "git",
"url": "git+https://github.com/yourusername/your-repo.git"
},

"bugs": {
"url": "https://github.com/yourusername/your-repo/issues"
},

"homepage": "https://github.com/yourusername/your-repo#readme"
}

Build Command

  • Specific command(s) for building the project
  • Default: npm run build
  • To use multiple commands, use ; as a separator (example: npm run build;npm run start)

Run Command

  • Command to run the project
  • For JS.js, it is better not to enter any command

Output Folder

  • Location of the built files
  • Default: dist/

Port

Specify the port number on which your application will run. The default port is 3000, but you can change it.

tip
  • The port can be changed after the initial setup
  • When specifying the port, always use the address 0.0.0.0.

Resource Scheduling

Disk

Environment Variables

4. Plan Selection

JS Plan Selection

In this step, select your desired plan. You can choose from the available list or configure it manually.

Replica

Specify the number of replicas (running instances) for your application. This number affects the performance and availability of your application.

Importance of Replica Count

  • Scalability: Increase processing power by increasing the number of replicas
  • High Availability: Maintain performance if one instance fails
  • Load Distribution: Distribute the load across multiple instances

After selecting the desired plan, choose the Create App option.

5. Project Management

JS Project Management

After setup, various management features will be available to you:

  • Check project status

  • Manage connections and resources

  • Manage ports

    info

    The port you defined in your project must also be defined in this section.

  • Change Dockerfile name (if needed)

    tip

    If your project requires very specific settings, you can create your own custom Dockerfile. For more information, refer to this link.

  • Change build command

    JS Project Management

  • Change run command

    JS Project Management

  • Specify output folder location

    JS Project Management

  • Manage Git repository and rebuild operations

  • Set project branch

  • Restart project

tip

If you want to use multiple commands for building the project, use ; as a separator (e.g., npm run build;npm run start)

Using these features, you can efficiently and professionally manage your JS project.