npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jetpath

v1.5.29

Published

JetPath - A fast, seamless and minimalist framework for Node, Deno and Bun.js. Embrace the speed and elegance of the next-gen server-side experience.

Downloads

586

Readme

Contributors npm Version Forks Stargazers

--

Latest version info

In this version, we added/tested these features on all runtimes.

  1. auto-generated api documentation UI (JethPath UI).
  2. streaming via ctx.pipe(stream||filename).
  3. file uploads check this example
  4. support for websockets check this example.
  5. Jet Plugins.

In this version (not this latest), multi-runtime support is no-longer based on compartiblity but pure engine api(s).

We Added Examples in the examples folder!

  • running Node index.js starts a Node instance for your app.
  • running Deno run index.ts starts a Deno instance for your app.
  • running Bun index.ts starts a Bun instance for your app.
  • looking into serverless, possible with plugins

this version we fixed issues with the inbuilt cors hook.

  • more speed, same size, more power.

Rationale

JetPath is the Granular web framework aimed for speed and ease of use.

benchmark repo

  • JetPath now runs on the runtime you are using, bun or node or deno.
  • Function names as routing patterns (newest innovation you haven't seen before).
  • Pre, Post and Error request hooks.
  • Inbuilt Cors handlers hook.
  • Fast and small and easy as peasy.
  • A strong backup community moved with passion for making the web better.
  • Inbuilt API auto doc functionality.

JetPath is designed as a light, simple and but powerful, using the an intuitive route as function name system. you can be able to design and manage your api(s) with the smallest granularity possible.

This benefits are very lovely and delighting, but trust me you have never written javascript app in this manner before and you should definitely check this out.

--

How JetPath works

JetPath works by search through the source forder and join up any defined handlers and hooks that follows it's format in files named [anything].jet.js.

Requirements to use JetPath.

JetPath support all web Javascript runtimes:

  • Nodejs.
  • Denojs.
  • Bunjs.
  • and deno deploy (testing)
  • Edge support for runtimes like cloudflare workers supported via plugins.

Installation

Install JetPath Right away on your project using npm or Javascript other package managers.

npm i jetpath --save

An hello App setup

// in your src/index.jet.js
import { Context, JetFunc, JetPath } from "./dist/index.js";

const app = new JetPath({ APIdisplay: "HTTP" });

//? listening for requests
app.listen();

// this goes to = get /
export const GET_: JetFunc = async function (ctx) {
  ctx.send("hello world!");
};

// this goes to = post /
export const POST_: JetFunc = async function (ctx) {
  ctx.send("a simple post path!");
};

// ? not implemented?
const payment: any = {};

// this goes to = /api/v1/payment
export const POST_api_v1_payment: JetFunc<{
  name: string;
  amount: number;
  currency: "BTC" | "ETH" | "XRP" | "LTC";
  address: string;
}> = async function (ctx) {
  // ? http body to json
  await ctx.json();

  // ? http validate the body, or end the request with the error
  const data = ctx.validate();

  // ? process the request
  await payment.process({
    amount: data.amount,
    address: data.address,
    currency: data.currency,
  });

  // ? send response
  ctx.send({ message: "sucess" });
};

POST_api_v1_payment.body = {
  name: { type: "string" },
  amount: { type: "number", defaultValue: 50 },
  currency: { RegExp: /(BTC|ETH|XRP|LTC)/, defaultValue: "BTC" },
  address: {
    err: "Please provide a valid address",
    validator(address) {
      // logic to validate address
      return true;
    },
  },
};

// this goes to = /api/v1/payment/:paymentId
export const GET_api_v1_payment_status$paymentId: JetFunc<
  {},
  { paymentId: string }
> = async function (ctx) {
  // ? retrieve
  const status = await payment.getStatusById(ctx.params.paymentId);
  if (status === "SUCCESS") {
    // ? send response
    ctx.send({ message: "sucess" });
  } else {
    const id = setInterval(async () => {
      const status = await payment.getStatusById(ctx.params.paymentId);
      if (status === "SUCCESS") {
        // ? clean up
        clearInterval(id);
        // ? send response
        ctx.send({ message: "sucess" });
      }
    }, 1000);
    //? ctx.eject() - allows any async operation to keep running while the function done exicutiong, always call it last
    ctx.eject();
  }
};

Where's JetPath future gonna be like?

We have exhausted our Roadmap, let's me what your suggestions are!

we are currently working an integrated admin interface, let us know what you think about that!!!

Apache 2.0 Lincenced

Open sourced And Free.

Uiedbook is an open source community, the vision is to make the web better, improving and innovating infrastructures for a better web experience.

You can join on telegram. Ask your questions and contribute XD.

Contribution and License Agreement

If you contribute code to this project, you are implicitly allowing your code to be distributed under the MIT license. You are also implicitly verifying that all code is your original work.

Support

Your contribution(s) is a good force for change anytime you do it, you can ensure JetPath's continues growth and improvement by contributing a re-occuring or fixed donations to:

https://www.buymeacoffee.com/fridaycandour

Or Click.