Building
Apps
Describe the application, without changing how you like to build it.
Define an app
An app block names an application and describes its source. A source "nodejs" block holds the package manager, source path, and build command.
version = 1
app "api" {
visibility = "private"
source "nodejs" {
path = "./api"
package_manager = "pnpm"
build = "pnpm build"
}
}Declare apps at the top level, as shown in your first project. No output block is needed.
Apps are public by default. Set visibility = "private" to let only members of the owning Nubes workspace reach the app; the app itself does not need to implement Nubes authentication.
Configure the runtime
Your server should bind to 0.0.0.0 and use the PORT environment variable. Avoid hardcoding a port that only works on your development machine.
Treat environment configuration as part of the application contract. Document which values are required and what each one controls.
Connect resources
An application’s env can reference the output of another resource. That keeps the relationship between the app and its dependencies visible in code.
Use secret references for sensitive values, and add SQLite only when your application needs persistent data.