{"id":15305,"library":"cloudcms-server","title":"Cloud CMS Application Server","description":"The `cloudcms-server` package provides a robust Node.js application server framework specifically designed to integrate with Cloud CMS deployments. It offers core server-side functionalities, including request routing, error handling, view engine support (e.g., Handlebars), and a flexible storage mechanism. This storage mechanism can utilize local file systems, Amazon S3, or S3FS for managing application content, configuration, and temporary data. The current stable version is 3.2.353, indicating a mature and actively maintained project. It serves as the foundational backbone for the application server tier of Cloud CMS, typically hosted at cloudcms.net, enabling developers to build and deploy applications that deeply leverage Cloud CMS's Web Content Management (WCM) capabilities. Key differentiators include its deep, purpose-built integration with the Cloud CMS platform, highly extensible configuration options for various storage backends, and a pluggable architecture that allows for custom functions at different stages of the request lifecycle.","status":"active","version":"3.2.353","language":"javascript","source_language":"en","source_url":"git://github.com/gitana/cloudcms-server","tags":["javascript","wcm","web","cloudcms","cms","content","json","rest","mobile"],"install":[{"cmd":"npm install cloudcms-server","lang":"bash","label":"npm"},{"cmd":"yarn add cloudcms-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add cloudcms-server","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The primary entry point is likely a default export, providing the main server object. While CommonJS `require` is also supported, ESM is preferred for modern applications.","wrong":"import { cloudcmsServer } from 'cloudcms-server';","symbol":"cloudcmsServer","correct":"import cloudcmsServer from 'cloudcms-server';"},{"note":"The `start` method is invoked on the main server object obtained from the module's default export, not as a named export directly from the package root.","wrong":"import { start } from 'cloudcms-server';","symbol":"start","correct":"const cloudcmsServer = require('cloudcms-server');\ncloudcmsServer.start(config);"},{"note":"While configuration can be loaded from a file, the server expects a JavaScript object directly for its `start` method. Ensure the object structure matches the server's expectations.","wrong":"const config = require('./config.json');","symbol":"Server Configuration","correct":"const config = { /* ... */ };"}],"quickstart":{"code":"import cloudcmsServer from 'cloudcms-server';\n\nconst serverConfig = {\n    \"setup\": \"single\",\n    \"name\": \"My Cloud CMS Application\",\n    \"socketFunctions\": [],\n    \"routeFunctions\": [\n        async function(req, res, next) {\n            if (req.url === '/') {\n                return res.send('Welcome to your Cloud CMS powered application!');\n            }\n            next();\n        }\n    ],\n    \"errorFunctions\": [],\n    \"configureFunctions\": {},\n    \"viewEngine\": \"handlebars\",\n    \"wcm\": {\n        \"enabled\": true, // Enable WCM features\n        \"cache\": false\n    },\n    \"auth\": {\n        \"enabled\": true,\n        \"providers\": {}\n    },\n    \"port\": process.env.PORT ?? 3000,\n    \"host\": process.env.HOST ?? '0.0.0.0'\n};\n\nasync function startServer() {\n    try {\n        const server = await cloudcmsServer.start(serverConfig);\n        console.log(`Cloud CMS Application Server started successfully on port ${server.port}`);\n        console.log('Access it at http://localhost:' + server.port);\n    } catch (err) {\n        console.error('Failed to start Cloud CMS Application Server:', err);\n        process.exit(1);\n    }\n}\n\nstartServer();\n","lang":"typescript","description":"This quickstart initializes and starts a `cloudcms-server` instance with a basic configuration, including a custom route and WCM enabled. It demonstrates how to import the server module, define its configuration, and handle startup."},"warnings":[{"fix":"Carefully review the provided configuration examples and ensure all paths are correct for your deployment environment. Validate `accessKey`, `secretKey`, and `bucket` for S3 configurations. Use environment variables for sensitive data.","message":"The configuration object, especially `storeEngines` and `storeConfigurations`, is complex and critical for correct server operation. Misconfigurations in paths, types, or credentials for storage can lead to startup failures or runtime errors.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"If using S3 storage, run `npm install aws-sdk` (or equivalent for your package manager) in your project to provide the necessary runtime dependency.","message":"When enabling S3 or S3FS store engines, the underlying AWS SDK (or similar) library is a runtime dependency. While `cloudcms-server` might not explicitly list `aws-sdk` in its `package.json`'s dependencies, you may need to install it manually in your project (`npm install aws-sdk`) to ensure S3 functionality works correctly.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Check the `wcm.enabled`, `virtualHost.enabled`, `insight.enabled`, etc., flags in your configuration and set them to `true` as required for your application's functionality.","message":"Many advanced features like `wcm`, `virtualHost`, `insight`, and `serverTags` are disabled by default in the provided configuration snippet. If you intend to use these features, you must explicitly enable them in your `serverConfig` object.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Ensure all store names referenced within `storeConfigurations` exactly match a defined `type` within the `storeEngines` object. Double-check for typos.","cause":"The `storeConfigurations` block refers to a `storeEngine` name (e.g., 'oneteam') that is not defined in the `storeEngines` block, or a typo exists.","error":"Error: Configuration for store 'oneteam' not found"},{"fix":"Provide valid `accessKey` and `secretKey` within the `config` object for any S3 or S3FS store engines. It is recommended to use environment variables (e.g., `process.env.AWS_ACCESS_KEY_ID`) for these sensitive credentials.","cause":"An S3 or S3FS `storeEngine` is enabled and configured, but the required AWS credentials (`accessKey` or `secretKey`) are missing or empty in its configuration.","error":"Failed to start Cloud CMS Application Server: Error: Missing accessKeyId in config"},{"fix":"For CommonJS, use `const cloudcmsServer = require('cloudcms-server');`. For ESM, use `import cloudcmsServer from 'cloudcms-server';`. Avoid named imports for the main server object.","cause":"The `cloudcms-server` module was imported incorrectly, resulting in `cloudcmsServer` being `undefined` or not having a `start` method.","error":"TypeError: Cannot read properties of undefined (reading 'start')"}],"ecosystem":"npm"}