Deployment Example for Node/Express Projects

This flightcontrol.json example is for a standard Node.js project - for instance, one based on Express.

You may need to edit the buildCommand or startCommand based on what your particular Node.js application uses. You can check the package.json file to find the specific commands for your application.

While this example uses a PostgreSQL database, you can use a MySQL (or MariaDB) database instead.

For production use, you will want to adjust the instance size and number of instances to match the expected load on your application.

Configuration as Code

flightcontrol.json
{
  "$schema": "https://app.flightcontrol.dev/schema.json",
  "environments": [
    {
      "id": "production",
      "name": "Production",
      "region": "us-west-1",
      "source": {
        "branch": "main"
      },
      "services": [
        {
          "id": "my-webapp",
          "name": "My Webapp",
          "type": "web",
          "target": {"type": "fargate"},
          "buildType": "nixpacks",
          "ci": {
            "type": "ec2"
          },
          "cpu": 0.5,
          "memory": 1,
          "minInstances": 1,
          "maxInstances": 1,
          "buildCommand": "npm run build",
          "startCommand": "npm run start",
          "envVariables": {
            "DATABASE_URL": {
              "fromService": {
                "id": "db",
                "value": "dbConnectionString"
              }
            }
          }
        },
        {
          "id": "db",
          "name": "Database",
          "type": "rds",
          "engine": "postgres",
          "engineVersion": "13",
          "instanceSize": "db.t4g.micro",
          "storage": 20,
          "private": false
        }
      ]
    }
  ]
}