Registry / web-framework / atma-server

atma-server

JSON →
library0.5.30jsnpmunverified

Atma.js Server is a Node.js server module providing a framework for building HTTP applications, leveraging other components within the Atma.js ecosystem like `atma-logger`, `atma-io`, and `appcfg`. It allows for flexible routing, middleware processing (compatible with Connect.js middleware), and resource management for both server-side and client-side assets. The module is currently at version 0.5.30, indicating a pre-1.0 development stage, and is likely in a maintenance or active development phase within its specific ecosystem, rather than a general-purpose, high-cadence release cycle. Key differentiators include its tight integration with Atma.js libraries for configuration, logging, and I/O, and its structured approach to defining application, service, handler, and page endpoints with custom pipelines.

npm install atma-server
INSTALL
IMPORT
SIG · ATMA-SERVER
A
atma-server
web-frameworkjavascriptv0.5.30
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Application
import { server } from 'atma-server'; const app = server.Application(...);
import AtmaServer from 'atma-server'; const app = AtmaServer.Application(...);
The `Application` factory is nested under the `server` property of the main export. For CommonJS, `const atma = require('atma-server'); const app = atma.server.Application(...);` is correct.
middleware.static
import { server } from 'atma-server'; const staticMiddleware = server.middleware.static;
import { static } from 'atma-server/middleware';
Static file middleware is exported under the `middleware` property of the `server` object. The `static` keyword cannot be directly imported as a named export without aliasing.
HttpApplicationOptions
import type { HttpApplicationOptions } from 'atma-server';
Type import for configuring the server application. The library ships with TypeScript types.

This quickstart initializes an Atma.js server application, configures its base path and configuration file location, and sets up request processing pipelines with `before`, `middleware`, and `after` stages. It includes `body-parser` as a common middleware and the built-in static file handler, then starts the server to listen for incoming requests based on its configuration.

import { server } from 'atma-server'; import bodyParser from 'body-parser'; import path from 'path'; const __dirname = path.resolve(); server .Application({ base: __dirname, configs: '/server/config/**.yml' // Configure path to YAML configs }) .done(function(app){ console.log('Atma server application loaded and configured.'); app.processor({ before: [ (req, res, next) => { console.log('Before pipeline:', req.url); next(); }, ], middleware: [ (req, res, next) => { console.log('Middleware pipeline:', req.url); next(); }, bodyParser.json(), // Common middleware for JSON body parsing ], after: [ (req, res, next) => { console.log('After pipeline:', req.url); next(); }, server.middleware.static // Serve static files as a fallback ] }) .listen(); // Start the server on the configured port console.log(`Server attempting to listen on port from config or default.`); // Example manual server start (optional, listen() is preferred): // const httpServer = require('http') // .createServer(app.process) // .listen(app.config.$get('port') || 3000); // if (app.config.debug) // app.autoreload(httpServer); });
Debug
Known issues
gotchaResource compilation for production environments differs significantly from development. In development, client-side scripts/styles are served individually; for production, they must be manually compiled using `atma custom node_modules/atma-server/tools/compile`.
fix
Ensure a build step is in place for production deployments that executes `atma custom node_modules/atma-server/tools/compile` to bundle client-side resources.
affects: >=0.1.0
gotchaThe `atma-server` library examples and internal structure primarily demonstrate CommonJS usage (`require`). While it ships with TypeScript types, users targeting pure ESM environments may need to adapt import statements and potentially configure their build process for compatibility.
fix
Use `import { server } from 'atma-server';` for ESM. For projects strictly enforcing ESM, ensure your `tsconfig.json` and `package.json` (`"type": "module"`) are correctly configured to handle hybrid modules.
affects: >=0.1.0
gotchaConfiguration files are loaded via `appcfg` from the `/server/config/**.yml` path by default. Misconfigurations or incorrect paths in `configs` property of `Application` can lead to the server failing to start or behave as expected.
fix
Verify that your `configs` path in `server.Application` correctly points to your YAML configuration files and that the files themselves are syntactically valid and contain expected keys like `port` and resource definitions.
affects: >=0.1.0
gotchaThe primary method to start the HTTP server is `app.listen()`. While it's possible to manually create an HTTP server with `require('http').createServer(app.process).listen(...)`, this bypasses some internal features like `app.autoreload` (for debug mode) and relies on manually retrieving the port from configuration.
fix
Prefer `app.listen()` for starting the server to ensure all integrated features, including automatic port discovery from configuration and debug autoreload, function correctly.
affects: >=0.1.0
Errors
Common errors & fixes
Error: listen EADDRINUSE: address already in use :::3000
The configured port for the Atma server is already in use by another process on the system.
fix
Change the `port` setting in your `app.yml` or relevant configuration file, or ensure no other application is using the intended port. You can find and terminate the process using `lsof -i :PORT` (macOS/Linux) or `netstat -ano | findstr :PORT` (Windows).
TypeError: app.processor is not a function
The `Application` instance (`app`) did not correctly initialize or was not returned as expected, leading to a missing `processor` method.
fix
Ensure the `Application` factory completes successfully before calling `app.processor()`. This typically means waiting for the `.done()` callback to execute. Check for any errors during the `Application` initialization, potentially in your configuration files.
Error: ENOENT: no such file or directory, stat '/path/to/server/config/default.yml'
The `atma-server` application cannot find one or more of the configuration files specified in the `configs` option during initialization.
fix
Double-check the `base` and `configs` paths provided to `server.Application`. Ensure they are correct and that the YAML files exist at the specified locations relative to the base path. Use absolute paths for `base` if unsure about relative resolution.
Upgrade
Version history
0.5.30latest on npm
Audit
Dependencies
atma-loggerrequiredUsed for logging within the Atma.js ecosystem.
atma-iorequiredUsed for file system operations and resource handling.
appcfgrequiredUsed for loading and managing application configurations.
connectoptionalCan be used as a Connect middleware; compatible with Connect-style middleware functions.
body-parseroptionalCommonly integrated as middleware for handling request bodies.
Agent activity
17 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources