1 | <div align="center">
|
2 | <h1>
|
3 | <img src="https://raw.githubusercontent.com/jota-one/drosse/master/docs/_media/drosse-logo.svg"/>
|
4 | <br>
|
5 | Drosse
|
6 | </h1>
|
7 | <p><strong>Stateful & programmable mock server</strong></p>
|
8 |
|
9 | [![NPM Version](https://flat.badgen.net/npm/v/@jota-one/drosse)](https://www.npmjs.com/package/@jota-one/drosse)
|
10 | [![NPM Downloads](https://flat.badgen.net/npm/dt/@jota-one/drosse)](https://www.npmjs.com/package/@jota-one/drosse)
|
11 | [![Package Size](https://flat.badgen.net/packagephobia/install/@jota-one/drosse)](https://packagephobia.now.sh/result?p=@jota-one/drosse)
|
12 | [![Buy Me A Coffee][bmc-shield-src]][bmc-href]
|
13 |
|
14 |
|
15 |
|
16 | [bmc-src]: https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png
|
17 | [bmc-href]: https://www.buymeacoffee.com/drosse
|
18 | [bmc-shield-src]: https://img.shields.io/static/v1?message=Buy%20me%20a%20coffee&logo=buy-me-a-coffee&style=flat-square&label=Sponsor&logoColor=white&color=ff813f
|
19 |
|
20 | </div>
|
21 |
|
22 | **Drosse is a stateful and programmable mock server written in javascript.**
|
23 |
|
24 | Based on [h3](https://github.com/unjs/h3), Drosse uses [loki](https://github.com/techfort/LokiJS)
|
25 | to store your mock data in memory so you can modify them in your
|
26 | `POST`, `PUT`, `PATCH` and `DELETE` requests.
|
27 |
|
28 | It comes out of the box with all the features you need to completely simulate a backend API,
|
29 | making it the best companion for any frontend developer 🤓
|
30 |
|
31 | ## Features
|
32 |
|
33 | ![](./docs/_media/paperclip.svg) **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.
|
34 |
|
35 | ![](./docs/_media/configuration.svg) **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.
|
36 |
|
37 | ![](./docs/_media/cascading.svg) **Cascading configs**: routes are defined as a JSON tree of sub-paths - plugins (throttle, proxy, ...) are inherited by child routes.
|
38 |
|
39 | ![](./docs/_media/static-mocks.svg) **Static mocks**: write mocks directly in the `routes.json` file (inline mode) or in JSON files (static mode).
|
40 |
|
41 | ![](./docs/_media/dynamic-mocks.svg) **Dynamic mocks**: build dynamic responses in javascript and access to the persisted data api, the request object and the NodeJS environment.
|
42 |
|
43 | ![](./docs/_media/assets.svg) **Assets handling**: serve multimedia files with patterns and wild cards for easy fallback.
|
44 |
|
45 | ![](./docs/_media/url-param.svg) **Dynamic URL params**: match any route/endpoint pattern with dynamic parameters => `/api/users/:id`.
|
46 |
|
47 | ![](./docs/_media/database.svg) **Data persistence**: work with stateful and interactive mocks thanks to the in-memory JSON database accessible via an easy-to-use API.
|
48 |
|
49 | ![](./docs/_media/throttle.svg) **Throttling**: delay response time of your routes, even the proxied ones.
|
50 |
|
51 | ![](./docs/_media/proxy.svg) **Proxying**: super-flexible proxy mechanism with inheritance and overwriting of sub-routes (with different proxy or local route).
|
52 |
|
53 | ![](./docs/_media/middleware.svg) **Middlewares**: extend Drosse with custom express middlewares to fulfill your use cases.
|
54 |
|
55 | ![](./docs/_media/template.svg) **Templates**: use response templates to avoid repeating yourself.
|
56 |
|
57 | ![](./docs/_media/scrape.svg) **Scraping**: scrape proxied endpoints and save the content to Drosse's database or static files.
|
58 |
|
59 | ![](./docs/_media/cli.svg) **Extensible REPL CLI**: build custom commands and execute them at runtime => simulate interaction with 3rp-party services.
|
60 |
|
61 | ## Examples
|
62 |
|
63 | Find example code in the [examples](./examples) folder.
|
64 |
|
65 | ## Contact & Support
|
66 |
|
67 | - Create a [GitHub issue](https://github.com/jota-one/drosse/issues) for bug reports, feature requests, or questions
|
68 | - Add a ⭐️ [star on GitHub](https://github.com/jota-one/drosse) or ☕️ [buy us a coffee](https://www.buymeacoffee.com/drosse) to support the project!
|
69 |
|
70 | ## Development
|
71 |
|
72 | - Clone this repository
|
73 | - Install yarn globally using `npm install -g yarn`
|
74 | - Install dependencies using `yarn`
|
75 | - Build using `yarn build` or `yarn build:stub` for live rebuild
|
76 | - Run drosse with `yarn serve examples/<example-folder-name>`
|
77 |
|
78 | ## Credits & License
|
79 |
|
80 | **Drosse** is crafted by [Jota](https://jota.one) and licensed under the [MIT license](https://github.com/jota-one/drosse/blob/master/LICENSE).
|