JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q43944F
  • License ISC

A robust library for creating action routing, middleware, and input validation in Next.js app router projects.

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (next-action-router) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    For documentation head over to https://next-action-router.netlify.app

    A little background

    I've had experience building with Strapi and Express.js, and what I really loved about both projects is their routing and middleware systems.

    These patterns offer several benefits, including:

    • Enhanced code readability
    • Increased modularity
    • Cleaner API syntax
    • More robust implementations
    • Maximum code reusability

    With the introduction of server actions in Next.js, writing APIs has become much easier. However, the advanced routing and middleware patterns I valued in Strapi and Express.js are still not natively supported by Next.js.

    A few months ago, when I started building a full-stack e-commerce website, I quickly realized the need for these abstractions. Unfortunately, I couldn't find any simple and useful solutions. So, I created a bare minimum implementation of this library for my project. Drawing on the lessons and ideas from that draft implementation, I developed this library with more advanced, type-safe features.

    I've got more ideas but for now let's get started!

    Aim

    This library aims to simplify working with nextjs server actions. One can easily compose complex server actions using the provided abstractions.

    Features

    • 🔀 Action Routing
    • ⚙ïļ Input Validation
    • ðŸŠķ Light weight
    • 🗒ïļ Logging
    • ⛓ïļ Middleware Chaining
    • ðŸ”Ĩ Robust error handling
    • ⚡ Snappy DX
    • ðŸ‡đ Type Safety