Skip to content

Rouret/lyn

Repository files navigation

Lyn

Lyn is a lightweight Backend TypeScript framework with Bun.

What and Why Lyn?

Lyn is:

  • Fast
  • Type-safe
  • Secure with built-in authentication
  • Runs everywhere

Lyn isn't here to replace existing frameworks. It was born from the need for a simple way to build things faster, with the best quality and developer experience.

Most frameworks serve as a foundation for your products. However, I often need something simpler with authentication and security built-in by default.

That's why Lyn focuses on being the easiest tool for POCs, solopreneurs, and agencies.

Lyn leverages Bun and the best JavaScript libraries for the job.

Code example

new Lyn()
  .get("/text", () => {
    return "Hello World";
  })
  .get("/json", () => {
    return {
      message: "Hello World",
    };
  })
  .get(
    "/:name",
    ({ params }) => {
      return {
        message: "Hello " + params.name,
      };
    },
    {
      params: z.object({
        name: z.string(),
      }),
    }
  )
  .post("/", ({ set }) => {
    set.status = 201;
    return {
      message: "Hello World",
    };
  })
  .post(
    "/users",
    ({ body, set }) => {
      set.status = 201;
      return {
        message: "Hello " + body.name,
      };
    },
    {
      body: z.object({
        name: z.string(),
      }),
    }
  )
  .listen(3000);

Roadmap:

  • Register Routes
  • Request lifecycle
  • Body validation
  • Params validation
  • Search params validation
  • Optimize the request lifecycle with ghost objects
  • Add a logger
  • Do a Security Checklist

Contact

X @RouretLucas

License

MIT

About

Lyn is a lightweight HTTP server framework for Bun

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published