2025-01-01 07:33:33 +01:00
2026-04-29 13:53:20 +00:00
2026-04-29 13:53:20 +00:00
2026-04-29 13:53:20 +00:00
2025-01-01 07:33:33 +01:00
2025-01-01 07:33:33 +01:00
2025-01-01 07:33:33 +01:00
2025-01-01 07:33:33 +01:00
2026-04-29 13:53:20 +00:00
2026-05-07 20:22:12 +00:00
2026-05-07 20:22:12 +00:00
2026-04-29 13:53:20 +00:00

corerender

corerender is a serve.zone prerendering service that fetches requested URLs, passes HTML pages through @push.rocks/smartssr, caches rendered output in Smartdata, and serves non-HTML assets through unchanged.

Issue Reporting and Security

For reporting bugs, issues, or security vulnerabilities, please visit community.foss.global/. This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a code.foss.global/ account to submit Pull Requests directly.

What It Does

corerender is a small service wrapper around a prerender pipeline. It is useful when crawlers, link previews, or static cache warmers need HTML after web components have rendered, while regular assets should be streamed from origin without SSR overhead.

Runtime flow:

GET /render/https://example.com/page?x=1
  -> fetch origin URL
  -> if content-type is HTML, render through SmartSSR
  -> cache PrerenderResult in Smartdata
  -> return rendered HTML with origin status and headers

Highlights

  • 🧩 SmartSSR-based rendering for web-component applications
  • 🗃️ Smartdata-backed PrerenderResult cache
  • 🕒 cached render reuse for fresh results and automatic stale-result refresh
  • 🗺️ sitemap and robots.txt aware prerender helpers
  • 🧹 scheduled cleanup for old prerender results
  • 🖥️ UtilityServiceServer with a /render/* route
  • 🧰 exported Rendertron, runCli(), and stop() entry points

Install

In this workspace, install dependencies with pnpm and run the package scripts from the repo root.

pnpm install

For internal registry consumption:

pnpm add corerender

Quick Start

import { Rendertron } from 'corerender';

const rendertron = new Rendertron();

await rendertron.start();

process.once('SIGTERM', async () => {
  await rendertron.stop();
  process.exit(0);
});

The package-level CLI runner does the same bootstrapping:

import { runCli, stop } from 'corerender';

await runCli();
await stop();

Service Route

The service registers one custom route on its UtilityServiceServer:

GET /render/*

The remainder of the path is interpreted as the origin URL. Query strings are preserved.

Examples:

/render/https://example.com/
/render/https://example.com/products?id=123

Behavior:

  • origin fetch errors return 502
  • malformed relative protocol artifacts such as https://url(...) return 500
  • HTML origin responses are rendered with SmartSSR and cached
  • non-HTML origin responses are returned directly as binary data

Cache and Prerendering

PrerenderManager coordinates SmartSSR, Smartrobots, and SmartSitemap.

The current cache behavior in PrerenderResult is:

  • render results younger than 12 hours are reused
  • older render results are marked for rerendering
  • cleanup deletes results older than 24 hours

Sitemap helpers are available through the service instance after startup:

await rendertron.prerenderManager.prerenderDomain('example.com');
await rendertron.prerenderManager.prerenderSitemap('https://example.com/sitemap.xml');

The scheduled prerenderLocalDomains task currently has the domain source stubbed out in this repo. The cleanup task is scheduled daily.

Operational Notes

Concern Current implementation
Persistence rendertron.db.ts initializes a Smartdata MongoDB connection for PrerenderResult documents.
HTTP server Rendertron.start() creates a UtilityServiceServer named rendertron.
Rendering PrerenderManager creates SmartSSR, Smartrobots, and SmartSitemap instances.
Task scheduling TaskManager starts scheduled prerender and cleanup tasks through @push.rocks/taskbuffer.
Shutdown Rendertron.stop() stops the server, prerender manager, task manager, and database connection.

API Surface

Export Purpose
Rendertron Main service class with start() and stop().
runCli() Starts a singleton Rendertron instance.
stop() Stops the singleton instance started by runCli().

Important public instance properties after startup:

Property Purpose
serviceServerInstance Underlying UtilityServiceServer.
prerenderManager Rendering, robots.txt, sitemap, and cache helper manager.
taskManager Scheduled prerender/cleanup task manager.

Development

pnpm run build
pnpm test
pnpm start

Useful source entry points:

  • ts/index.ts exports Rendertron, runCli(), and stop().
  • ts/rendertron.classes.rendertron.ts owns service startup and /render/* routing.
  • ts/rendertron.classes.prerendermanager.ts owns SmartSSR, robots.txt, and sitemap rendering helpers.
  • ts/rendertron.classes.prerenderresult.ts owns cached render document behavior.
  • ts/rendertron.taskmanager.ts owns scheduled prerender and cleanup tasks.

This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the license file.

Please note: The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.

Trademarks

This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.

Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.

Company Information

Task Venture Capital GmbH Registered at District Court Bremen HRB 35230 HB, Germany

For any legal inquiries or further information, please contact us via email at hello@task.vc.

By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.

S
Description
a rendering service for serve.zone that preserves styles for web components
Readme 307 KiB
Languages
TypeScript 87.5%
Dockerfile 5.6%
Shell 4.7%
JavaScript 2.2%