Registry / web-framework / super-simple-fastify-server

super-simple-fastify-server

JSON →
library1.0.0jsnpmunverified

This library, `super-simple-fastify-server`, currently at version 1.0.0, provides a lightweight and opinionated wrapper around the Fastify web framework. It is designed for rapidly spinning up temporary or local development servers with minimal boilerplate and configuration, making it ideal for testing, prototyping, or quickly standing up mock APIs. The package's primary goal is to simplify server creation by abstracting common Fastify setup, allowing developers to focus solely on defining routes. It features configurable host and port settings that can be controlled via constructor options or environment variables, prioritizing ease of use over extensive customization. While new and without an established release cadence, it offers a stable API for its current scope and ships with TypeScript type definitions for enhanced developer experience. A key differentiator is its minimal footprint, leveraging Fastify and `pino-pretty` as peer dependencies, giving users control over specific versions of these core components.

npm install super-simple-fastify-server
INSTALL
IMPORT
SIG · SUPER-SIMPLE-FASTI
S
super-simple-fastify-server
web-frameworkjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SimpleFastifyServer
import { SimpleFastifyServer } from 'super-simple-fastify-server';
import SimpleFastifyServer from 'super-simple-fastify-server';
This is a named export. Attempting to import it as a default export will result in a TypeError.
FastifyInstance
import { FastifyInstance } from 'super-simple-fastify-server';
import { FastifyInstance } from 'fastify';
The `FastifyInstance` type definition is re-exported from `super-simple-fastify-server` for convenience, although its origin is the `fastify` package itself.
buildObjectStreamResponse
import { buildObjectStreamResponse } from 'super-simple-fastify-server';
const { buildObjectStreamResponse } = require('super-simple-fastify-server');
A named export utility for constructing streamable JSON responses. The package is primarily designed for ESM usage.

This quickstart demonstrates how to initialize `SimpleFastifyServer`, define a basic GET route, and start the server on a specified host and port.

import { FastifyInstance, SimpleFastifyServer } from 'super-simple-fastify-server'; const server = new SimpleFastifyServer( async (app: FastifyInstance) => { app.get('/hello-world', async (request, _reply) => { return { message: `Hello, ${request.query.target}!` }; }); }, { host: '127.0.0.1', port: 3456 } ); (async () => { await server.start(); console.log(`Server listening at http://${server.config.host}:${server.config.port}`); // To stop the server later: // await server.stop(); })();
Debug
Known issues
gotchaThis library lists `fastify` and `pino-pretty` as peer dependencies. You must install them separately alongside `super-simple-fastify-server` for the server to function correctly.
fix
Ensure you install the peer dependencies: `npm install fastify pino-pretty` (or `--save-dev` if used as a dev dependency).
affects: >=1.0.0
gotchaConfiguration options (host, port) passed to the `SimpleFastifyServer` constructor can be overridden by environment variables (`SIMPLE_FASTIFY_SERVER_HOST`, `SIMPLE_FASTIFY_SERVER_PORT`) if not explicitly provided, which might lead to unexpected server addresses or ports.
fix
Always explicitly pass `host` and `port` options to the constructor if you require specific values, or ensure that relevant environment variables are set or unset as desired.
affects: >=1.0.0
gotchaThis package is explicitly designed for 'rapid dev/test' and does not implement production-grade security, performance optimizations, or robust error handling expected in public-facing applications.
fix
For production deployments, consider a fully configured Fastify application with appropriate plugins for security, logging, metrics, and error handling.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'fastify' from '<path_to_your_project>'
`fastify` peer dependency is not installed.
fix
Install Fastify: `npm install fastify`
Error: listen EADDRINUSE: address already in use :::3456
Another process is already using the configured port (default is 3456).
fix
Change the `port` option in the `SimpleFastifyServer` constructor or set the `SIMPLE_FASTIFY_SERVER_PORT` environment variable to an available port.
TypeError: (0, _super_simple_fastify_server__WEBPACK_IMPORTED_MODULE_0__.SimpleFastifyServer) is not a constructor
Attempting to import `SimpleFastifyServer` as a default export when it is a named export.
fix
Use a named import: `import { SimpleFastifyServer } from 'super-simple-fastify-server';`
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
fastifyrequiredCore web framework required for server functionality; defined as a peer dependency to allow users to select their desired version.
pino-prettyoptionalUtility for pretty-printing Fastify logs in development; defined as a peer dependency.
Agent activity
5 hits · last 30 days
node
4
Resources
super-simple-fastify-server — npm install super-simple-fastify-server · libregistry