PageSourceSearch

https://cromwellcms.com/assets/js/982ac012.041b5389.js

js cromwellcms.com collected 2026-10-04 13:33:16 UTC 10,240 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_cromwell_website=self.webpackChunk_cromwell_website||[]).push([[6983],{4392:function(e,t,n){n.r(t),n.d(t,{frontMatter:function(){return o},contentTitle:function(){return s},metadata:function(){return p},toc:function(){return c},default:function(){return m}});var r=n(5773),l=n(808),a=(n(7378),n(5318)),i=["components"],o={},s=void 0,p={unversionedId:"api/README",id:"api/README",isDocsHomePage:!1,title:"README",description:"@cromwell/root / Exports",source:"@site/docs/api/README.md",sourceDirName:"api",slug:"/api/README",permalink:"/docs/api/README",tags:[],version:"current",frontMatter:{}},c=[{value:"Prerequisites",id:"prerequisites",children:[]},{value:"Install",id:"install",children:[]},{value:"Configure",id:"configure",children:[]},{value:"Services",id:"services",children:[{value:"1. API Server and Proxy",id:"1-api-server-and-proxy",children:[]},{value:"2. Renderer",id:"2-renderer",children:[]},{value:"3. Admin Panel",id:"3-admin-panel",children:[]},{value:"4. Utils",id:"4-utils",children:[]},{value:"5. Manager",id:"5-manager",children:[]},{value:"6. CLI",id:"6-cli",children:[]}]},{value:"Develop services",id:"develop-services",children:[]}],u={toc:c};function m(e){var t=e.components,n=(0,l.Z)(e,i);return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"@cromwell/root / ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/modules"},"Exports")),(0,a.kt)("h1",{id:"cms-core-development"},"CMS Core Development"),(0,a.kt)("h3",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Node.js v12-16"),(0,a.kt)("li",{parentName:"ul"},"Python"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"npm install node-gyp -g"))),(0,a.kt)("h3",{id:"install"},"Install"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"$ git clone https://github.com/CromwellCMS/Cromwell\n$ npm run build\n$ npx cromwell start\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"You don't need to run ",(0,a.kt)("inlineCode",{parentName:"strong"},"npm install")),", installation/build handled by startup.js script in the root which invoked by ",(0,a.kt)("inlineCode",{parentName:"p"},"npm run build"),". In development use yarn to install/update dependencies."),(0,a.kt)("h3",{id:"configure"},"Configure"),(0,a.kt)("p",null,"By default the CMS will launch with SQLite database.",(0,a.kt)("br",{parentName:"p"}),"\n","But you may need to use some specific development databases. Copy config file in the root from ",(0,a.kt)("inlineCode",{parentName:"p"},"cmsconfig.json.example")," to ",(0,a.kt)("inlineCode",{parentName:"p"},"cmsconfig.json"),". Rename property of needed DB to ",(0,a.kt)("inlineCode",{parentName:"p"},"orm")," for the CMS to use it. For example ",(0,a.kt)("inlineCode",{parentName:"p"},"orm-mariadb")," to ",(0,a.kt)("inlineCode",{parentName:"p"},"orm"),".  "),(0,a.kt)("p",null,"Launch development databases: "),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"npm run docker:start-dev-mariadb")," for MariaDB"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"docker:start-dev-postgres")," for Postgres")),(0,a.kt)("h2",{id:"services"},"Services"),(0,a.kt)("p",null,"In runtime Cromwell CMS is a set of services (npm packages).",(0,a.kt)("br",{parentName:"p"}),"\n","Below listed core services with default settings (ports at localhost address can be configured in cmsconfig.json):"),(0,a.kt)("h3",{id:"1-api-server-and-proxy"},"1. API Server and Proxy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Path - system/server"),(0,a.kt)("li",{parentName:"ul"},"NPM Module - @cromwell/server"),(0,a.kt)("li",{parentName:"ul"},"Run command - ",(0,a.kt)("inlineCode",{parentName:"li"},"npx crw s --sv s")),(0,a.kt)("li",{parentName:"ul"},"Available at - http://localhost:4016")),(0,a.kt)("p",null,"API server and Proxy. That's two servers in one service.",(0,a.kt)("br",{parentName:"p"}),"\n","Proxy server handles all incoming requests and distributes them for other services. So all services of CMS will be available at http://localhost:4016 in development. In production it's recommended to setup Nginx config to proxy services instead. CMS goes with configured Nginx config for this purpose.\nProxy manages API Server, that's how ",(0,a.kt)("a",{parentName:"p",href:"https://cromwellcms.com/docs/development/plugin-development#how-exported-extensions-will-be-applied-in-the-production-server"},(0,a.kt)("inlineCode",{parentName:"a"},"safe reloads"))," are working."),(0,a.kt)("p",null,"API Server Implements REST API for transactions or internal usage and GraphQL API for data flow. Uses Fastify and Nest.js"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Swagger - http://localhost:4016/api/api-docs/"),(0,a.kt)("li",{parentName:"ul"},"GraphQL endpoint at: http://localhost:4016/api/graphql. ",(0,a.kt)("a",{parentName:"li",href:"https://studio.ap
1ollographql.com/sandbox/explorer?endpoint=http%3A%2F%2Flocalhost%3A4016%2Fapi%2Fgraphql"},"Playground / Schema docs"))),(0,a.kt)("h3",{id:"2-renderer"},"2. Renderer"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Path - system/renderer"),(0,a.kt)("li",{parentName:"ul"},"NPM Module - @cromwell/renderer"),(0,a.kt)("li",{parentName:"ul"},"Run command - ",(0,a.kt)("inlineCode",{parentName:"li"},"npx crw s --sv r")),(0,a.kt)("li",{parentName:"ul"},"Available at - http://localhost:4128")),(0,a.kt)("p",null,"Next.js service, compiles (using Utils) and serves files of an active Theme and Plugins to end-users."),(0,a.kt)("h3",{id:"3-admin-panel"},"3. Admin Panel"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Path - system/admin-panel"),(0,a.kt)("li",{parentName:"ul"},"NPM Module - @cromwell/admin-panel"),(0,a.kt)("li",{parentName:"ul"},"Run command - ",(0,a.kt)("inlineCode",{parentName:"li"},"npx crw s --sv a")),(0,a.kt)("li",{parentName:"ul"},"Available at - http://localhost:4064")),(0,a.kt)("p",null,"Uses dedicated Fastify server to serve Admin Panel files and public media files. "),
1(0,a.kt)("h3",{id:"4-utils"},"4. Utils"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Path - system/utils"),(0,a.kt)("li",{parentName:"ul"},"NPM Module - @cromwell/utils")),(0,a.kt)("p",null,"Modules bundler / compiler / package manager"),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},(0,a.kt)("a",{parentName:"p",href:"https://github.com/CromwellCMS/Cromwell/tree/master/system/utils#readme"},"https://github.com/CromwellCMS/Cromwell/tree/master/system/utils#readme"))),(0,a.kt)("h3",{id:"5-manager"},"5. Manager"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Path - system/manager"),(0,a.kt)("li",{parentName:"ul"},"NPM Module - @cromwell/cms")),(0,a.kt)("p",null,"Cromwell CMS main module. Starts and controls other services"),(0,a.kt)("h3",{id:"6-cli"},"6. CLI"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Path - system/cli"),(0,a.kt)("li",{parentName:"ul"},"NPM Module - @cromwell/cli")),(0,a.kt)("p",null,'Provides "cromwell" CLI.'),(0,a.kt)("h2",{id:"develop-services"},"Develop services"),(0,a.kt)("p",null,"After cloning and building the repo you can start services in development mode (with watchers) by adding --dev flag:",(0,a.kt)("br",{parentName:"p"}),"\n",(0,a.kt)("inlineCode",{parentName:"p"},"npx crw s --sv s --dev")," - Will start API Server service with Nodemon and Rollup watching code changes.",(0,a.kt)("br",{parentName:"p"}),"\n",(0,a.kt)("inlineCode",{parentName:"p"},"npx crw s --sv a --dev")," - Start Admin panel service with Webpack watcher and hot reloading.   "),(0,a.kt)("p",null,"For other services you can run scripts from their location:",(0,a.kt)("br",{parentName:"p"}),"\n",(0,a.kt)("inlineCode",{parentName:"p"},"cd system/core/common && npm run watch")," - Will launch watcher on ",(0,a.kt)("inlineCode",{parentName:"p"},"@cromwell/core")," package.  "),(0,a.kt)("p",null,"Same for Theme development:\n",(0,a.kt)("inlineCode",{parentName:"p"},"cd themes/store && npm run watch")))}m.isMDXComponent=!0},5318:function(e,t,n){n.d(t,{Zo:function(){return c},kt:function(){return d}});var r=n(7378);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,l=function(e,t){if(null==e)return{};var n,r,l={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,l=e.mdxType,a=e.originalType,s=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),m=p(n),d=l,h=m["".concat(s,".").concat(d)]||m[d]||u[d]||a;return n?r.createElement(h,i(i({ref:t},c),{},{components:n})):r.createElement(h,i({ref:t},c))}));function d(e,t){var n=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var a=n.length,i=new Array(a);i[0]=m;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o.mdxType="string"==typeof e?e:l,i[1]=o;for(var p=2;p<a;p++)i[p]=n[p];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}
1m.displayName="MDXCreateElement"}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.