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

@aokiapp/reark-server

v0.5.1

Published

Backend utilities for SSR, asset management, and data aggregation for Lark (Feishu) documents.

Downloads

32

Readme

@aokiapp/reark-server

Backend utilities for SSR, asset management, and data aggregation for Lark (Feishu) documents.


Overview

@aokiapp/reark-server is part of the AokiApp Reark monorepo, providing server-side tools for rendering and serving Lark documents in modern web frameworks. It is designed for seamless integration with frameworks like Next.js and works in concert with the core, lark-api, and renderer packages.

graph TD
    Core["@aokiapp/reark"]
    LarkAPI["@aokiapp/reark-lark-api"]
    Renderer["@aokiapp/reark-renderer"]
    Server["@aokiapp/reark-server"]
    Core --> LarkAPI
    Core --> Renderer
    Renderer --> LarkAPI
    Server --> LarkAPI

Key Features

  • SSR Data Aggregation: Fetch and prepare Lark documents for server-side rendering.
  • Efficient Asset Management: Download, cache, and serve images/files referenced in Lark documents.
  • Comment Aggregation: Fetch and include document comments for rendering.
  • Robust Error Handling: Lenient error handling and manifest management for production reliability.

Installation

npm install @aokiapp/reark-server
# or
pnpm add @aokiapp/reark-server
# or
yarn add @aokiapp/reark-server

Prerequisites:

  • Node.js v18+ recommended
  • Lark (Feishu) API credentials (App ID & App Secret)
  • See monorepo README for environment setup

Usage

Basic Example

import { setCredentials } from "@aokiapp/reark-lark-api";
import { getLarkInitialDataForSSR } from "@aokiapp/reark-server";

setCredentials(process.env.LARK_APP_ID, process.env.LARK_APP_SECRET);

const initialData = await getLarkInitialDataForSSR(
  documentId,
  "public/lark-files",
  "/lark-files/",
);

// Pass initialData to your renderer (e.g., <LarkRenderer initialData={initialData} />)

Integration


API Reference

Exports

  • getLarkInitialDataForSSR(documentId, publicDir, publicUrlBase?)
    Fetches and prepares Lark document data for SSR, handling asset storage and URL mapping.

  • LarkInitialData
    Interface describing the SSR data structure.

  • setCredentials(appId, appSecret)
    Re-exported from @aokiapp/reark-lark-api for convenience.

getLarkInitialDataForSSR

async function getLarkInitialDataForSSR(
  documentId: string,
  publicDir: string,
  publicUrlBase: string = "/lark-files/",
): Promise<LarkInitialData>;
  • documentId: Lark document ID (string)
  • publicDir: Directory to store downloaded files (string)
  • publicUrlBase: Public URL prefix for files (string, default: /lark-files/)

Returns:
A Promise resolving to a LarkInitialData object:

interface LarkInitialData {
  version: number;
  blocks: Block[];
  comments: CommentData[];
  files: Record<string, string>; // fileToken → public URL
}
  • blocks: Array of Lark document blocks (see @aokiapp/reark-lark-api for types)
  • comments: Array of comment data
  • files: Map of file tokens to public URLs

Behavior:

  • Downloads and caches files referenced in the document.
  • Skips already-downloaded files.
  • Handles errors gracefully (logs and continues).
  • Fetches comments for the document.

setCredentials

function setCredentials(appId: string, appSecret: string): void;

Sets Lark API credentials for all subsequent requests.


Development

  • npm run build – Build the package
  • npm run lint – Lint source files
  • npm run typecheck – Type-check code
  • npm run test – Run tests

See package.json for all scripts.


Extending & Customization

  • To customize file handling or error management, extend or wrap getLarkInitialDataForSSR.
  • For advanced use cases, refer to the source code and API reference.

Related Documentation


License

MIT © AokiApp Contributors