next-flexible-routes

0.2.3 • Public • Published

Next Flexible Routes Build Status Coverage Status npm version

Next Flexible Routes is a library to takle the pain of routing in a next.js app.

We have been using alternative libraries internally at CreditSCRIPT for a while and we have fund them very easy to start with but very hard to scale.

The reason is routing maps tend to change over time and it gets progressively hard to refactor without a strictly typed environment.

We decided to takle the pain and build a library for our own usage and we ended up deciding to open-source it thinking the community could benefit from it.

Features

  • Strongly typed link generation
  • Strongly typed parameters and query extraction
  • Minimal API to define routes
  • Maximum Flexibility on deployment
  • Custom (pluggable) codec to encode parameters (Date/UUID/etc)
  • Hash anchor management

Usage

Examples can be found in the with-next-flexible-routes package

Showcase

Showcase

Documentation

Please refer to api-docs and middleware-docs

Installation

yarn add next-flexible-routes

you will need additional peer dependencies to be installed:

"express": "^4.16.4",
"fp-ts": "^1.15.0",
"fp-ts-contrib": "^0.0.2",
"io-ts": "^1.8.4",
"lodash": "^4.17.11",
"next": "^8.0.3",
"path-to-regexp": "^3.0.0",
"query-string": "^6.4.2",
"react": "^16.8.5",
"react-dom": "^16.8.5"

quickly:

yarn add express fp-ts fp-ts-contrib io-ts lodash next path-to-regexp query-string react react-dom

Contributing

Pull requests are welcome. Please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Thanks

Huge thanks goes to the authors of fp-ts, io-ts, fp-ts-contrib, next.js, and any used library

/next-flexible-routes/

    Package Sidebar

    Install

    npm i next-flexible-routes

    Weekly Downloads

    0

    Version

    0.2.3

    License

    MIT

    Unpacked Size

    58.4 kB

    Total Files

    47

    Last publish

    Collaborators

    • michael.arnaldi