Skip to content

Stateful & programmable
mock server

Introduction

NPM Version NPM Downloads Package Size Buy Me A Coffee

Drosse is a stateful and programmable mock server written in javascript.

Based on h3, Drosse uses loki to store your mock data in memory so you can modify them in your POST, PUT, PATCH and DELETE requests.

It comes out of the box with all the features you need to completely simulate a backend API, making it the best companion for any frontend developer 🤓

Features

  • Tight to your project
    Your mocks and your mock-server are part of your project. You can run as many drosse instances as you want simultaneously.

  • Easy configuration
    Configuring drosse is as simple as writing its port number in a .drosserc.js file and writing route definitions in a routes.json file.

  • Cascading configs
    Routes are defined as a JSON tree of sub-paths - plugins (throttle, proxy, ...) are inherited by child routes.

  • Static mocks
    Write mocks directly in the routes.json file (inline mode) or in JSON files (static mode).

  • Dynamic mocks
    Build dynamic responses in javascript and access to the persisted data api, request and response objects and the NodeJS environment.

  • Assets handling
    Serve multimedia files with patterns and wild cards for easy fallback.

  • Dynamic URL params
    Match any route/endpoint pattern with dynamic parameters (e.g. /api/users/:id).

  • Data persistence
    Work with stateful and interactive mocks thanks to the in-memory JSON database accessible via an easy-to-use API.

  • Throttling
    Delay response time of your routes, even the proxied ones.

  • Proxying
    Super-flexible proxy mechanism with inheritance and overwriting of sub-routes (with different proxy or local route).

  • Middlewares
    Extend Drosse with custom express middlewares to fulfill your use cases (user session, websocket, jwt, ...).

  • Templates
    Uuse response templates to avoid repeating yourself.

  • Scraping
    Scrape proxied endpoints and save the content to Drosse's database or static files.

  • Extensible REPL CLI
    Build custom commands and execute them at runtime => simulate interaction with 3rp-party services.

Examples

Find example code in the examples folder.

Contact & Support

Buy Me A Coffee

Credits & License

Drosse is crafted by Jota and licensed under the MIT license.