getcronit / pylon

A code-first approach to GraphQL API development
https://pylon.cronit.io
Apache License 2.0
54 stars 1 forks source link

Provide support for various runtimes beyond Bun, including Cloudflare Workers #6

Open dave-calleja opened 1 month ago

dave-calleja commented 1 month ago

The requirement for using Bun is a limitation as it can't be run on cloudflare workers or the like. Are there any plans to support any other runtimes? I am really eager to use this in my project however introducing Bun will add needless complexity to our architecture.

Thanks

schettn commented 1 month ago

Hello.

This is a really good concern. I agree that support for various runtimes is crucial.

I will start working on supporting this Runtimes. I will make this a high priority. Please be please be patient.

In the meantime you could use bun to get started with developing, and switch to your required runtime later.

dave-calleja commented 1 month ago

Sounds great thanks :)

schettn commented 1 week ago

Hi @dave-calleja, @yicru and @briandiephuis!

Pylon 2.0 will be released in the the following days.

I have updated some core components of Pylon to support the Hono Runtimes.

In the beginning Bun and NodeJS will be officially supported. In theory it should also work with all the other runtimes, but there could be complications due to some still unknown side effects (for example the limited feature set of Cloudflare workers).

Right after I will start working on the Cloudflare workers support.

Once it's released I will provide a migration guide for you!

Quick preview:

  1. Bun:
    
    import {app} from '@getcronit/pylon'

export const graphql = { Query: { hello: () => { return 'Hello, world!' } }, Mutation: {} }

export default app


2. Node
```ts
import {app} from '@getcronit/pylon'
import {serve} from '@hono/node-server'

export const graphql = {
  Query: {
    hello: () => {
      return 'Hello, world!'
    }
  },
  Mutation: {}
}

serve(app, info => {
  console.log(`Server running at ${info.port}`)
})
yicru commented 1 week ago

@schettn Great work! I'm really looking forward to the Cloudflare workers support.

schettn commented 1 week ago

@yicru Works! Guess there will be three official supported runtimes. Bun, Node, and Cloudflare Worker

image

yicru commented 1 week ago

@schettn Great! Super excited for the release!

dave-calleja commented 1 week ago

Thanks for the awesome work @schettn

schettn commented 1 week ago

Hi @dave-calleja @yicru.

Would you be so kind to test the beta?

Quick setup with Cloudflare Workers:

https://github.com/user-attachments/assets/9d4ce577-18e1-4088-abd2-716972d1fbdb

Note: The beta docs in WIP, some videos are still missing.

dave-calleja commented 1 week ago

Looks great so far @schettn ! Will get digging deeper some time next week but once again thanks for the great work!

schettn commented 6 days ago

@dave-calleja @yicru @jaemig

I just updated the docs links above. I forgot the Vercel share parameter.

Requesting access is no longer required.

Sorry I missed that!

dave-calleja commented 4 days ago

@schettn works like a charm! This is truly a game changer when it comes to working with graphql. Are there any known performance issues or restrictions with not using bun? So far I have not noticed any.

Please let me know if there is anything I should specifically test to get it out of beta :)

schettn commented 3 days ago

@dave-calleja Happy that you like it!

There are no real performance issues when comparing it to other frameworks like express (Node.JS), but you can of course benefit when using Bun.

You should be better off by using NodeJS most of the time tbh, especially when you do not care about the performance that much.

This is because some edge cases do not work with Bun yet. Take a look at Bun's priorities.

image

But given the fact that you want to use it with Cloudflare Workers anyway, it doesn't really matter.

schettn commented 3 days ago

Please let me know if there is anything I should specifically test to get it out of beta :)

There are two important things:

All in all I have already tested Pylon V2 excessively and also migrated some of my core services from V1 to V2. So I am comfortable releasing it soon.

schettn commented 3 days ago

@dave-calleja Would you mind sharing you Pylon project with me (if you can)? I would love to see how users build there applications, so I can make Pylon better. Sadly most users are closed-source.