SEAM API reads all of its runtime settings from environment variables, loaded byDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/TheSerchCp/SEAM-API/llms.txt
Use this file to discover all available pages before exploring further.
dotenv from a .env file at project startup via src/config/env.js. Required variables are validated immediately when the process starts — a missing required variable throws an error and halts the server before any connections are accepted, preventing silent misconfiguration in any environment.
Environment Variables
Required Variables
These six variables must be present in your environment. The server will throwError: Variable de entorno requerida faltante: <KEY> and exit if any of them are absent or empty.
The port number the HTTP server binds to. Parsed as an integer with
parseInt(process.env.PORT, 10).Example: 3000Hostname or IP address of the MySQL server SEAM API connects to.Example:
localhost or db.internal.mycompany.comThe MySQL username used to authenticate the connection pool. This account needs
SELECT, INSERT, UPDATE, and DELETE privileges on the target database.Example: seam_userThe password for
DB_USER. Keep this value secret and never commit it to source control.Example: s3cur3P@ssw0rdThe name of the MySQL database SEAM API uses for all queries.Example:
seam_dbThe secret key used to sign and verify all JWT tokens with the HS256 algorithm. This value must be kept private — anyone who knows it can forge valid tokens.Example:
a8f3d2e1b7c94f5d8e6a1b3c5d7e9f2a4b6c8d0eOptional Variables
These variables have built-in defaults and are safe to omit during local development. You should set them explicitly in production.The port MySQL is listening on. Parsed as an integer. Override only if your MySQL instance runs on a non-standard port.Default:
3306Example: 3307Controls how long a JWT remains valid after it is issued. Accepts any value supported by the
jsonwebtoken library’s expiresIn option: a number of seconds (integer) or a time-span string such as 60, 2d, 10h, or 7d.Default: 1hExamples: 15m, 8h, 7dThe origin (or origins) allowed by the CORS middleware applied in
app.js. This value is passed directly to the cors package’s origin option and to the Socket.IO server’s CORS config.Default: * (all origins — convenient for development, unsafe for production)Example: http://localhost:5173 or https://app.mycompany.comComplete .env Example
Copy this template to the root of the project (next topackage.json), fill in your values, and remove any comments you do not need:
MySQL Connection Pool
SEAM API usesmysql2/promise and creates a connection pool at startup (src/config/db.js). The pool configuration is fixed in code:
| Setting | Value | Description |
|---|---|---|
connectionLimit | 10 | Maximum number of simultaneous connections held in the pool |
waitForConnections | true | Queue requests when the pool is exhausted rather than rejecting them |
queueLimit | 0 | Unlimited queue depth (0 = no cap) |
pool.execute() and pool.query() automatically borrow and return connections.
For high-traffic deployments consider increasing
connectionLimit to match the concurrency of your workload, keeping in mind the max_connections setting of your MySQL server. A common rule of thumb is to set the pool limit to no more than (max_connections / number_of_app_instances) - buffer.Graceful Shutdown
SEAM API listens forSIGINT (Ctrl+C) and SIGTERM (sent by process managers such as systemd or Docker) and performs an orderly shutdown:
- The HTTP server stops accepting new connections (
server.close()). - Once all in-flight requests complete, the MySQL connection pool is drained (
pool.end()). - The process exits with code
0.