The AOC Framework
github logodiscord logo

GETTING STARTED

Server Configuration #

The server configuration is done with two files located within the server folder:

  • aoc-server-config.json
  • aoc-server-secrets.json (optional)

The second file is intended to contain confidential parameters and should be in .gitignore, therefore, it would not be included in the version control system.

When starting the server, if it detects the existence of the aoc-server-secrets.json file, it will merge its content with aoc-server-config.json, overwriting only the defined properties. Therefore, it is a good place to specify the database password, etc.

In the configuration file, you can specify as many configurations as you need. You will see that by default there is a configuration named "base". This configuration is taken as a reference. If you specify another configuration, named "production", it will automatically merge with the "base" configuration, overwriting repeated parameters.

Advanced Configuration #

When starting the server application, the configuration to use is determined following this order:

  1. The secrets file (if it exists) is merged with the configuration file.
  2. If the AOC_CONFIG_ENV environment variable exists, it is used as the configuration name.
  3. Otherwise, if the NODE_ENV environment variable exists, it is used as the configuration name.
  4. If neither of the two previous variables exists, "base" is used.
  5. If you have specified environment variables identifiable with properties, they are used.

The last point refers to specifying environment variables with the name AOC_ followed by the property in question, for example, AOC_programName, AOC_postgres_password, or AOC_mail_options_auth_pass.

Properties #

All properties are explained through the schema file aoc-server-config.schema.json.

Here is an example of aoc-server-config.json:

{
  "$schema": "node_modules/@atlantis-of-code/aoc-server/aoc-server-config.schema.json",
  "base": {
    "appId": "myApp",
    "programName": "MyApp",
    "locale": "en",
    "multiTenancy": false,
    "node": {
      "port": 3000,
      "logLevel": "trace",
      "requestLimit": "10mb",
      "useAuthHelper": true,
      "sessionSecret": "m1s3cr37",
      "socketIo": {
        "postgresAdapter": {}
      }
    },
    "postgres": {
      "host": "localhost",
      "port": 5432,
      "username": "postgres",
      "password": "xxx",
      "db": "myapp", // for multi tenancy, use any representative database
      "debug": false // true to see SQL queries in the console
    },
    "mail": { // RECOMMENDED: to send emails through the application
      "options": {
        "host": "smtp.myserver.com",
        "port": 587,
        "secure": false,
        "auth": {
          "user": "my@email.com",
          "pass": "xxx"
        },
        "tls": {
          "rejectUnauthorized": false
        }
      },
      "defaults": {
        "from": "my@email.com"
      }
    },
    "reports": {
      "workflows": { // OPTIONAL: in case you need extra data in reports workflows
        "qpdfAbsolutePath": "H:\\Path\\To\\qpdf.exe"
      }
    },
    "custom": { // OPTIONAL: in case you need extra values
      ...
    }
  }
}

Please note, browse Issues and Discussions in Github for more information

© 2025 Atlantis of Code. All rights reserved.
All trademarks are the property of their respective owners.