Installing and Running TeqCMS
TeqCMS is installed as a regular npm dependency. You create your own project with HTML templates
and connect the CMS via @flancer32/teq-cms
.
1. Creating a Project
mkdir my-site
cd my-site
npm init -y
npm install @flancer32/teq-cms
2. Directory Structure
tmpl/web/{locale}/
— localized HTML templatesweb/
— public static resourcesvar/teq-cms/
— system files (translation database, system prompts)
3. Environment Variables (.env)
SERVER_TYPE=express # or fastify
SERVER_PORT=3000
TEQ_CMS_TMPL_ENGINE=nunjucks # or mustache
TEQ_CMS_LOCALE_ALLOWED=en,ru
TEQ_CMS_LOCALE_BASE_DISPLAY=en
TEQ_CMS_LOCALE_BASE_TRANSLATE=ru
TEQ_CMS_AI_API_BASE_URL=https://api.deepseek.com/v1
TEQ_CMS_AI_API_KEY=sk-...
TEQ_CMS_AI_API_MODEL=deepseek-chat
TEQ_CMS_AI_API_ORG=...
4. Starting the Web Server
Option 1 — without an external server: In this case, the CMS configures and runs its built-in HTTP server:const cfg = configWeb.create({port});
await server.start(cfg);
Option 2 — with an external server (Express or Fastify):
You need to explicitly connect the library and create the server:
"dependencies": {
"express": "^4.18.2",
"fastify": "^4.25.1"
}
Express:
const app = Express();
app.use(async (req, res) => {
await dispatcher.onEventRequest(req, res);
});
app.listen(port, () => {
console.info(`Listening on port ${port} with Express`);
});
Fastify:
const fastify = Fastify();
fastify.all('*', async (request, reply) => {
const req = request.raw;
const res = reply.raw;
await dispatcher.onEventRequest(req, res);
});
await fastify.listen({port});
In this case, server startup and configuration are fully controlled by the project developer.
TeqCMS can be run directly or hidden behind an external proxy (e.g., Nginx).
5. Running AI Translations
Translations are started with the command:npm run translate
The CMS compares timestamps and updates only outdated translations.
For the target locale, you can add a *.prompt.md
file next to the HTML file with clarifying instructions for the LLM.
6. Variable Substitution in Templates
TheFl32_Cms_Back_Api_Adapter
adapter is used to pass data to templates. It can be replaced via
TeqFw_Di_Pre_Replace
:
Example:
import Container from '@teqfw/di';
import Replace from '@teqfw/di/src/Pre/Replace.js';
const container = new Container();
const replace = new Replace();
replace.add('Fl32_Cms_Back_Api_Adapter', 'Fl32_Cms_Demo_Back_Di_Replace_Cms');
container.getPreProcessor().addChunk(replace);
This allows flexible management of variable sources without changing the core CMS logic.