npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jelenjs-ssr

v0.1.0

Published

Server-Side Rendering runtime for JelenJS framework

Readme

JelenJS SSR

Server-Side Rendering package for JelenJS framework. Enables rendering JelenJS components to HTML strings on the server for improved SEO and initial page load performance.

Features

  • 🚀 Server-Side Rendering - Render JelenJS components to HTML strings
  • 🔄 Hydration Support - Seamless client-side hydration
  • 🎯 DOM Shim - Complete DOM API emulation for Node.js
  • 📦 Zero Dependencies - Lightweight and self-contained
  • 🛠️ TypeScript Support - Full type safety

Installation

npm install jelenjs-ssr

Quick Start

Basic SSR

import { renderToString } from 'jelenjs-ssr';
import { signal } from 'jelenjs';

// Define a simple component
function Counter({ initialCount = 0 }) {
  const [count, setCount] = signal(initialCount);
  
  return (
    <div>
      <h1>Count: {count}</h1>
      <button onClick={() => setCount(count() + 1)}>
        Increment
      </button>
    </div>
  );
}

// Render to HTML string
const html = await renderToString(Counter, { initialCount: 5 });
console.log(html);
// Output: <div><h1>Count: 5</h1><button>Increment</button></div>

Complete HTML Document

import { renderToDocument } from 'jelenjs-ssr';

const document = await renderToDocument(Counter, { initialCount: 0 }, {
  title: 'My JelenJS App',
  meta: [
    { name: 'description', content: 'A counter app built with JelenJS' }
  ],
  scripts: ['/assets/main.js']
});

console.log(document);
// Output: Complete HTML document with head, body, and hydration data

With Hydration Data

import { renderToStringWithData } from 'jelenjs-ssr';

const result = await renderToStringWithData(Counter, { initialCount: 10 }, {
  includeHydrationData: true,
  prettyPrint: true
});

console.log(result.html);           // Rendered HTML
console.log(result.hydrationData);  // Data for client-side hydration

API Reference

renderToString(component, props?, options?)

Renders a component to an HTML string.

Parameters:

  • component - JelenJS component function
  • props - Props to pass to the component
  • options - Rendering options

Returns: Promise<string>

renderToStringWithData(component, props?, options?)

Renders a component with hydration data.

Returns: Promise<SSRRenderResult>

interface SSRRenderResult {
  html: string;
  hydrationData?: HydrationData;
  styles?: string[];
  meta?: MetaTag[];
}

renderToDocument(component, props?, documentOptions?, renderOptions?)

Renders a component to a complete HTML document.

Returns: Promise<string>

createHTMLDocument(content, options?)

Creates a complete HTML document from rendered content.

DOM Shim

The package includes a complete DOM shim for Node.js:

import { setupSSRGlobals, document, window } from 'jelenjs-ssr/dom-shim';

// Setup global DOM objects
setupSSRGlobals();

// Now you can use document and window in Node.js
const element = document.createElement('div');
element.textContent = 'Hello, SSR!';
console.log(element.toString()); // <div>Hello, SSR!</div>

Integration Examples

Express.js

import express from 'express';
import { renderToDocument } from 'jelenjs-ssr';
import App from './App';

const app = express();

app.get('*', async (req, res) => {
  try {
    const html = await renderToDocument(App, { url: req.url }, {
      title: 'My App',
      scripts: ['/client.js']
    });
    
    res.send(html);
  } catch (error) {
    res.status(500).send('Server Error');
  }
});

app.listen(3000);

Next.js Style API

// pages/blog/[slug].tsx
export default function BlogPost({ post }) {
  return (
    <article>
      <h1>{post.title}</h1>
      <div>{post.content}</div>
    </article>
  );
}

export async function getStaticProps({ params }) {
  const post = await fetchPost(params.slug);
  return { props: { post } };
}

export async function getStaticPaths() {
  const posts = await fetchAllPosts();
  return {
    paths: posts.map(post => ({ params: { slug: post.slug } })),
    fallback: false
  };
}

Performance Tips

  1. Use Static Analysis - Pre-analyze components to identify static vs dynamic parts
  2. Cache Rendered Content - Cache HTML output for static content
  3. Selective Hydration - Only hydrate interactive components
  4. Stream Rendering - Use streaming for large pages (coming soon)

Limitations

  • Effects in SSR - Effects don't run during SSR (by design)
  • Browser APIs - Browser-specific APIs need polyfills or conditional usage
  • Async Components - Async components require special handling

Roadmap

  • [ ] Streaming SSR support
  • [ ] Automatic static/dynamic component detection
  • [ ] Built-in caching strategies
  • [ ] Performance profiling tools
  • [ ] Integration with popular frameworks

License

MIT