You can just port things to Cloudflare Workers

(sigh.dev)

30 points | by STRiDEX 6 hours ago

5 comments

  • kStadler01 2 hours ago
    I really like the offering that Cloudflare has with workers, but for me they just seem to be lacking some DX tooling/solutions. Debugging is hell, but for quick projects like this I'll definitely look into it again. These days Railway is my go-to for hosting "throw-away" projects.

    Always wondering how its going for folks that are using Cloudflare Workers as their main infra?

    • NamlchakKhandro 1 hour ago
      > Debugging is hell

      Most people won't care because the extent of their debugging skills is console.log, echo, print. repeat 5000 times.

      • hyperbovine 27 minutes ago
        printf() debugging is still considered a best practice in the eyes of many. I still remember being really surprised when I heard my famous (Turing award-winning) CS professor tell the class this for the first time.

        https://tedspence.com/the-art-of-printf-debugging-7d5274d6af...

      • locknitpicker 1 hour ago
        > Most people won't care because the extent of their debugging skills is console.log, echo, print. repeat 5000 times.

        I don't agree. The first thing any developer does when starting out a project is setting up their development environment, which includes being able to debug locally. Stdout is the absolute last option on the table, used when all else fails.

    • csomar 1 hour ago
      I'm building my entire back-end on CF Workers. The DX was really frustrating starting out, but I'm using Rust/WASM, which means most of my issues get caught at compile time. My suggestion: avoid all the CF offerings (DB, Pages, KV, etc.) and stick with just Workers. They're pretty stable and reliable (more so than Cloudflare itself, hehe), and once you figure out their rough edges, you'll be fine.
      • huijzer 1 hour ago
        What DB do you use? I tried the same for while but eventually gave up because it was incredibly restrictive and not much cheaper than a self managed VPS with some Docker containers. I mean the biggest thing that could happen to me is landing on the HN front page and a $5 per month VPS can manage that easily
        • jddj 1 hour ago
          You won't beat a good self-managed VPS with some docker containers unless you start adding criteria like SLAs and whatnot.

          Then you'll still not beat a good self-managed VPS but you'll have someone else to blame

          • DanielHB 33 minutes ago
            I am not much of a devops person but running your own DB in a VPS with docker containers don't you also need to handle all this manually too?

            1) Creating and restoring backups

            2) Unoptimized disk access for db usage (can't be done from docker?)

            3) Disk failure due to non-standard use-case

            4) Sharding is quite difficult to set up

            5) Monitoring is quite different from normal server monitoring

            But surely, for a small app that can run one big server for the DB is probably still much cheaper. I just wonder how hard it really is and how often you actually run into problems.

            • csomar 16 minutes ago
              My guess is some people have never worked with the constraints of time and reliability. They think setting up a database is just running a few commands from a tutorial, or they're very experienced and understand the pitfalls well; most people don't fall into the latter category.

              But to answer your question: running your own DB is hard if you don't want to lose or corrupt your data. AWS is reliable and relatively cheap, at least during the bootstrapping and scaling stages.

          • h33t-l4x0r 59 minutes ago
            CF workers are v8 isolates FYI
        • csomar 24 minutes ago
          AWS RDS. I have no intention of managing my own DB and the insanity that comes with that.
      • locknitpicker 1 hour ago
        > I'm building my entire back-end on CF Workers. The DX was really frustrating starting out, but I'm using Rust/WASM, which means most of my issues get caught at compile time.

        Cloudflare Workers support WASM, which is how they support any runtime beyond JavaScript. Cloudflare Worker's support for WASM is subpar, which is reflected even in things like the Terraform provider. Support for service bindings such as KV does not depend on WASM or anything like that: you specify your Wrangler config and you're done. I wonder what you are doing to end up making a series of suboptimal decisions.

        • csomar 11 minutes ago
          The bindings are still done at the JS level. But to answer your question, I'm building a git workflow engine (kind of a lightweight GitHub Actions alternative; see https://codeinput.com). In that context, you get lots of events and payloads from Git/GitHub that typically require very little resources to respond to or relay.

          The worker model made sense, so I developed the whole app around it. Now of course, knowing what I know today, I might have considered different options. But at the time, I read the description (and had some Cloudflare Workers experience) and thought this looked good.

    • locknitpicker 1 hour ago
      > I really like the offering that Cloudflare has with workers, but for me they just seem to be lacking some DX tooling/solutions.

      Cloudflare in general is a DX mess. Sometimes it's dashboard doesn't even work at all, and is peppered with error messages. Workers + Wrangler + it's tooling doesn't even manage to put together a usable or coherent change log, which makes it very hard to even track how and why their versioning scheme should be managed.

      Cloudflare is a poster child of why product managers matter. They should study AWS.

      • koakuma-chan 48 minutes ago
        Yeah one time I tried do to something and the button didn't do anything, only after I opened DevTools I saw the error message in the response body.
  • l5870uoo9y 1 hour ago
    Cloudflare Workers has really improved lately, e.g. "Observations" and "Metrics", and on top of that their product suite keeps growing all the time. If you use Astro[1] together with Cloudflare then you have a solution that is at least on par with NextJS and Vercel, but that only costs a fraction. My latest project[2] also uses Astro and Cloudflare and it is rendered on the "edge" (i.e. SSR) in about 100ms – you won't get better performance.

    [1]: https://astro.build

    [2]: https://www.viewdiff.ai

    • davedx 44 minutes ago
      Yeah it's great for toy/hobby projects with little complexity or features, but as often is the case with these kinds of platforms, running a substantial app on them is a different proposition
    • h33t-l4x0r 1 hour ago
      I tried to port a nextjs project to cf + astro recently and it was a nightmare of usability and build issues. I'm sure they will work it out eventually but I won't be trying it again any time soon.
      • l5870uoo9y 53 minutes ago
        While Cloudflare is long-established, the Workers platform is relatively new and did have the issues you described; however, over the past few months it has become stable. Compared to Vercel, it is more technical and advanced.
        • h33t-l4x0r 39 minutes ago
          I like Workers in general and I've had good experience with it. Here I'm talking about deploying Astro to Pages though, which is not nearly as polished as deploying Nextjs on Vercel.
  • tombert 1 hour ago
    I use Cloudflare Pages for my blog, and I really like it, but my static blog generator (Quartz) only supports Giscus, which requires signing in with a GitHub account.

    I was thinking I might be able to hobble together a vibe-coded straightforward thing with Rust-> WASM to make an embeddable comment system, using Cloudflare Workers.

    I gotta say that Workers are shockingly pleasant to use. I think I might end up using them for a bigger project.

    • koakuma-chan 50 minutes ago
      Is Cloudflare Pages still a thing? It looks like it's just Workers now.
  • pjmlp 1 hour ago
    No I cannot, because I usually don't use the programming languages it supports.
    • locknitpicker 1 hour ago
      > No I cannot, because I usually don't use the programming languages it supports.

      You didn't even bothered to open the link, as it covers how the blogger vibecoded a couple of projects that convert existing projects built with different languages+frameworks to run on Cloudflare Workers.

      • pjmlp 1 hour ago
        Yes, and that is exactlyt the problem, some of us do read the articles before posting.
    • fragmede 1 hour ago
      Given that they support WASM, which then means they support traditional compiled languages life C, C++, Golang, and Rust, what're you using, Malbodge?
      • pjmlp 1 hour ago
        Yeah, they are the only ones everyone uses, there is nothing else.

        And even those, have you ever tried anything beyond printf debugging? I bet not.

        • MallocVoidstar 12 minutes ago
          What language are you using that can't compile to WASM and isn't otherwise supported?
  • tucnak 2 hours ago
    Do they still blow up your billing during DDoS?