Skip to content

stefanwerfling/figtree

Repository files navigation

Discord Ask DeepWiki

FigTree - Server Core/Backend Framework



FigTree is a comprehensive Node.js backend framework designed for rapid development of server applications. It provides a complete foundation with integrated database support, HTTP server capabilities, plugin architecture, schema validation, and service management. This framework abstracts common backend development patterns into reusable, well-structured components.

Implementation

  • Schemas declaration && validation (VTS)
  • Load environment variables (example for use over docker compose)
  • Config loading (json file)
  • Logging (Winston)
  • DB loading and handling (MariaDB, InfluxDB, Redis)
    • History (For data change)
    • Add ChromaDB
  • Process handling
  • Server TCP Raw
  • HTTP/s Server and handling (Express.js, rateLimit, helmet, cookieParser, session parser, self-temporary cert generation)
    • Swagger UI Route and auto generation description from the schemas
    • Unix HTTP Server (for intern communication)
    • File Upload helper
    • AsyncLocalStorage for Context
    • Websocket Server
  • Service Manager (for initialized services or schedule)
  • Backend Main
  • Provider handler
  • Plugin Manager/Loader
    • Plugin Merkle-Hash Validation (Protection)
    • Plugin Signing the hash (CA)
  • Crypto Managment
    • Pem Helper/Parser
    • Certificate generator (node-forge)
  • Access Control List
  • Cluster
    • SharedStore (IPC/Redis)

Installation

You can install FigTree via npm:

npm install git+https://github.com/stefanwerfling/figtree.git

TypeScript Users

If you're using TypeScript, it is highly recommended to install the necessary types.

npm install --save-dev \
  @types/express \
  @types/express-session \
  @types/async-exit-hook \
  @types/cookie-parser \
  @types/uuid \
  @types/node \
  git+https://github.com/stefanwerfling/node-forge-types.git

Used

Appropriate user interface

To build a suitable interface for the API, the framework Bambooo can be used.

Routes and Swagger

Using schemas as route registered on the HTTP server can be automatically generated (for OpenAPI) for the Swagger UI API. The process consists of defining the schema, registering the route, and its types. Generics ensure that all types are correct in the route handle. Data that does not match the schema is automatically returned with an error. This reduces the development process and allows the focus to be on functionality.

Login page Login page Login page Login page

Reverse proxy

The framework is designed to be used in production behind a reverse proxy. For local development (some functions require HTTPS in the browser), a local certificate for HTTPS is already issued.

It's best to use FlyingFish, NPM, or Nginx directly.

Plugin Hash

For creating the plugin hash, FigTree now has a CLI tool that can be called in your own project (plugin project) with:

npm run figtree -create-plugin-hash

The CLI tool goes into the "dist" directory based on the current directory and creates a merkle hash of all files.

Where is the framework already used

  • PuppeteerCast
    • PuppeteerCast is a system that converts web browser content into live video streams accessible via HTTP endpoints. The system uses headless browser automation to navigate and interact with web pages, captures the visual and audio output, encodes it into streaming formats, and serves it through multiple API interfaces compatible with various client applications.
    • The core transformation process involves running a web browser in a virtual display environment, capturing both screen content and audio output, and encoding this media into transport streams that can be consumed by streaming clients, TV applications, and media players.

  • Coming soon FlyingFish
    • FlyingFish is a reverse proxy manager with own WebUI, DNS server, SSH server, DynDNS, UPNP support, Lets Encrypt and much more.

  • Coming soon MWPA
    • MWPA provides the acquisition of scientific observational data, an easy-to-use user interface for viewing, confirming and reviewing the data. This includes the backend for data collection, the frontend and a mobile phone app for snycronization. The recorded ones relate to mammals and their observations. The aim is to record the observations cleanly and quickly. For this purpose, the old data is processed again and imported.

About

Figtree - Server/Backend Core

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published