back to home

krakenjs / kraken-js

An express-based Node.js web application bootstrapping module.

4,929 stars
457 forks
0 issues
JavaScript

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing krakenjs/kraken-js in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/krakenjs/kraken-js)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

> [!CAUTION] > The kraken-js repo is not actively monitored or accepting new features. It is recommended not to use this for new products and migrate away for existing ones. kraken.js Kraken builds upon express and enables environment-aware, dynamic configuration, advanced middleware capabilities, security, and app lifecycle events. For more information and examples check out krakenjs.com Table of Contents ================= • Basic Usage • API • Options • Config Protocols • Features • Configuration • Environment-aware • Middleware • Included Middleware • Extending Default Middleware • Application Security • Lifecycle Events • Configuration-based express Settings • View Engine Configuration • Tests • Coverage • Reading app configs from within the kraken app Basic Usage API kraken-js is used just like any normal middleware, however it does more than just return a function; it configures a complete express 4 application. See below for a list of features, but to get started just use it like middleware. Options Pass the following options to kraken via a config object such as this: Note: All kraken-js configuration settings are optional. (*String*, optional) The working directory for kraken to use. kraken loads configuration files, routes, and registers middleware so this directory is the path against all relative paths are resolved. The default value is the directory of the file that uses kraken, which is generally (or ). (*Function*, optional) Provides an asynchronous hook for loading additional configuration. When invoked, a confit configuration object containing all loaded configuration value passed as the first argument, and a callback as the second. The signature of this handler is and the callback is a standard error-back which accepts an error as the first argument and the config object as the second, e.g. . (*Object*, optional) Protocol handler implementations for use when processing configuration. For more information on protocols see shortstop and shortstop-handlers. By default, kraken comes with a set of shortstop protocols which are described in the "Config Protocols" section below, but you can add your own by providing an object with the protocol names as the keys and their implementations as properties, for example: (*Function*, optional) Provides a synchronous hook which executes once kraken mounts. It takes an express instance as the first argument, and as the second. The signature of this handler is . (*Function*, optional) Handler for errors outside of the middleware chain. See the endgame module for defaults. For uncaught errors in the middleware chain, see middleware instead. (*Object*, optional) In rare cases, it may be useful to pass options directly to the confit module used within lib/config.js. For example, if confit/shortstop is conflicting with environment variables, you can explicitly ignore those environment variables: Config Protocols kraken comes with the following shortstop protocol handlers by default: Merge the contents of the specified file into configuration under a given key. Replace with the value at a given key. Note that the keys in this case are dot (.) delimited. The path handler is documented in the shortstop-handlers repo. The file handler is documented in the shortstop-handlers repo. The base64 handler is documented in the shortstop-handlers repo. The env handler is documented in the shortstop-handlers repo. The require handler is documented in the shortstop-handlers repo. The exec handler is documented in the shortstop-handlers repo. The glob handler is documented in the shortstop-handlers repo. The resolve handler is documented in the shortstop-resolve repo. Features Configuration Environment-aware Using environment suffixes, configuration files are applied and overridden according to the current environment as set by . The application looks for a directory relative to the basedir and looks for as the baseline config specification. JSON files matching the current env are processed and loaded. Additionally, JSON configuration files may contain comments. Valid values are or (uses ), (uses ), (uses ), (uses ). Simply add a config file with the name, to have it read only in that environment, e.g. . Middleware Much like configuration, you shouldn't need to write a lot of code to determine what's in your middleware chain. meddleware is used internally to read, resolve, and register middleware with your express application. You can either specify the middleware in your or , (or) import it from a separate json file using the import protocol mentioned above. Included Middleware Kraken comes with common middleware already included in its file. The following is a list of the included middleware and their default configurations which can be overridden in your app's configuration: • - internal middleware which handles graceful shutdowns in production environments • Priority - 0 • Enabled - if *not* in a development environment • Module - • Arguments (*Array*) • *Object* • - milliseconds (default: ) • - template to render (default: ) • - custom headers to write while still disconnecting. • - custom handler - - for uncaught errors. Default behavior is to log the error and then trigger shutdown. • - adds compression to server responses • Priority - 10 • Enabled - (disabled in all environments by default) • Module - (npm) • - serves the site's favicon • Priority - 30 • Module - (npm) • Arguments (*Array*) • *String* - local path to the favicon file (default: ) • - serves static files from a specific folder • Priority - 40 • Module - (npm) • Arguments (*Array*) • *String* - local path to serve static files from (default: ) • - logs requests and responses • Priority - 50 • Module - (npm) • Arguments (*Array*) • *String* - log format type (default: ) • - parses JSON request bodies • Priority - 60 • Module - (npm) • Method - • - parses URL Encoded request bodies • Priority - 70 • Module - (npm) • Method - • Arguments (*Array*) • *Obje…