Skip to main content
One idea at a time

Node runs JavaScript outside the browser

You already know JavaScript. Node changes the environment around that language.

A browser provides the DOM, browser storage, and a page lifecycle. Node provides server-oriented capabilities, including access to files, network sockets, environment variables, and process signals. Node has no page to render.

Taskboard starts a Node process, creates an Express application, and listens for incoming connections. That process stays alive across many requests. A module-level variable can therefore outlive the user action that created it.

Process memory has limits​

Suppose the API stores tasks in an array:

// Illustrative temporary storage.
const tasks = [];

The array belongs to one process. Restarting that process loses the tasks. Starting a second API process creates a second array. Requests routed to different processes can see different data.

That is why Taskboard stores durable business state in PostgreSQL. Process memory remains useful for temporary calculations and configuration. It is not the shared authority for tasks, sessions, or job completion.

Modules help organize that process. The project uses ES module syntax and TypeScript source. The build converts TypeScript into JavaScript that Node executes. Type annotations disappear during that conversion. They do not validate incoming JSON at runtime.

Configuration is runtime input​

Database URLs, cookie settings, and email configuration differ between environments. The application reads these values through its configuration module rather than scattering process.env access through each route.

A variable named DATABASE_URL is still an unvalidated string. Configuration validation checks required values and rejects unusable settings before serving requests. Discovering a missing database URL at startup is easier to diagnose than a failure inside the first task request.

The API process and the background worker are separate Node processes. They share PostgreSQL, not JavaScript variables. Stopping the API must not erase the worker's pending email jobs.

A frequent mistake is expecting development restart behavior to preserve in-memory state. A file watcher starts another process. It does not restore the previous process's arrays, active connections, or timers.

Can two Node processes share an imported array?

No. Each process has its own memory. Shared durable state needs a shared service such as PostgreSQL.

Node is the runtime, a process is one running instance, and PostgreSQL stores the state that must survive that instance.

Read api/src/config.ts Read api/src/server.ts