DEV Community

Cover image for Why WebGPU Feels Like the Future of the Web (Live Demo 🚀)
Sylwia Laskowska
Sylwia Laskowska

Posted on

Why WebGPU Feels Like the Future of the Web (Live Demo 🚀)

WebGPU is the hot topic right now. A brand-new web API that will most likely replace WebGL sooner rather than later (I won't miss you, bro 👋).

It’s already supported by all major browsers, and honestly… how could I not try it?

So I did what any curious frontend-centric software dev would do: I built a small interactive demo and learned a lot more than I initially expected.


First things first: why GPUs?

For many of you this might sound obvious, but let’s do a quick intro for anyone new to this area.

CPUs are great at doing a few complex things one after another.
GPUs are great at doing simple things, massively in parallel.

That’s why GPUs shine in:

  • graphics and image processing
  • simulations
  • matrix-heavy workloads
  • and yes — things like LLMs

Whether you’re rendering pixels, blurring textures, or multiplying huge matrices, GPUs are simply built for this kind of work. WebGPU finally gives us proper access to that power directly in the browser.


So… how is this different from WebGL?

WebGL is based on OpenGL, which is… well… old. Very old in GPU years.

With WebGL:

  • there were no real compute shaders
  • everything had to be expressed as a “rendering problem”
  • lots of hacks, tricks, and workarounds
  • a lot of hidden global state

If you ever implemented GPGPU in WebGL, you probably remember encoding data in textures and pretending triangles were something else entirely 🙃

WebGPU fixes this properly:

  • explicit compute passes
  • explicit pipelines and bind groups
  • no magical global state
  • APIs that map directly to modern GPU architectures (Metal, Vulkan, DirectX 12)

In short: WebGPU is how GPUs actually work today.


Is WebGPU production-ready?

The honest answer: it depends.

If you can:

  • require modern browsers
  • target up-to-date Chrome, Edge, Firefox, Safari

→ then yes, WebGPU is absolutely usable today.

If, however:

  • you have a very broad audience
  • someone out there is still using an ancient Safari
  • or (please no) IE 11

→ then you either invest in a WebGL fallback, or you skip WebGPU for now.

For experiments, demos, internal tools, and forward-looking products?
It’s already a very solid choice.


WGSL – those “weird” new shader files

WebGPU introduces WGSL (WebGPU Shading Language).

At first glance, it looks strange — but if you’ve ever seen shaders for:

  • Metal
  • Vulkan
  • or modern DirectX

…it actually feels quite familiar.

WGSL is:

  • strongly typed
  • explicit
  • designed to avoid a whole class of GPU bugs

In this project I keep shaders in separate .wgsl files, but you can also inline them as strings in TypeScript if you want. VS Code already has syntax highlighting for WGSL in both cases, which helps a lot.


Now, about my demo

I won’t lie — this demo was harder to write than many of my other experiments.

Maybe it’s because WebGPU is still relatively fresh.
Or maybe it’s because I’ve never been particularly passionate about computer graphics… and this demo is very graphics-heavy.

But in the end? I’m really happy with the result.

Visually, it looks like glowing ink or smoke that appears when you move your cursor across the canvas.
Technically, it’s a GPU-driven simulation where:

  • pointer input injects color into a floating-point texture
  • compute shaders blur and transport that data over time
  • values slowly fade out, creating trails
  • a render pass displays the result

Is it physically accurate? Absolutely not 😄
Does it look cool? Oh yes.

Live parameters like trail length, brush size, swirl strength, and color can all be tweaked via a control panel — no shader recompilation needed.


React… for a WebGPU demo?

Most WebGPU demos you’ll find are written in plain HTML + JS. I could’ve done that too.

But I decided to use React + TypeScript as a thin wrapper:

  • clean UI
  • easy state management for sliders
  • zero manual DOM wiring

It worked great — with one important caveat.

To make this demo usable, I had to disable React Strict Mode.

Why? Because Strict Mode intentionally runs effects twice in development to detect side effects. That’s normally fantastic… but not when you’re creating GPU devices, pipelines, textures, and buffers. Double initialization can break things very quickly.

Low-level GPU code is one of those rare cases where Strict Mode gets in the way.


A TypeScript gotcha

One more small thing:
TypeScript doesn’t ship WebGPU types fully enabled out of the box yet.

You need to explicitly enable WebGPU typings in your TS config, otherwise none of the GPU types will exist. It’s a one-time setup, but worth mentioning if you’re trying this for the first time.


Links


Final thoughts

WebGPU feels like a real step forward for the web.
Not just “slightly better graphics”, but an entirely new class of things we can realistically build in the browser.

This demo is just a visual experiment — but it already shows how powerful, expressive, and fun GPU-driven web apps can be.

If you’ve been curious about WebGPU… this is your sign to try it 🚀

Top comments (58)

Collapse
 
codingpanel profile image
Coding Panel

This demo is 🔥, Sylwia! WebGPU + React makes it so approachable, and the glowing trails effect is mesmerizing. Your explanation of WGSL and compute shaders really demystifies what feels like a “next-gen web” API—definitely excited to try this in my own projects! 🚀

Collapse
 
sylwia-lask profile image
Sylwia Laskowska

Thank you so much! 😄🔥
Good luck with your project — and please do share what you build, I’d love to see it! 🚀

Collapse
 
brense profile image
Rense Bakker

It works on mobile! Really well actually, I just stared at the swirlies for 10 minutes while waiting for my croque monsieur 😅 I'm kinda sad I can't think of any project right now where I could utilize webgpu... I like that you put in the extra effort to figure out how to work with it in React + typescript 👍

Collapse
 
sylwia-lask profile image
Sylwia Laskowska

I actually had to look up what a croque monsieur is - and now I made myself hungry 😄

Really glad it works well on your phone! Though yeah, unfortunately WebGPU still isn’t supported everywhere yet 🙂

Collapse
 
pascal_cescato_692b7a8a20 profile image
Pascal CESCATO

Fantastic! I’d been waiting for this article, and it was absolutely worth it. I finally understand the value of WebGPU (even if, for my personal use cases, it’s still fairly limited). I played with the demo — it’s brilliant. Tweaking the settings and seeing everything update live is genuinely enjoyable.

Collapse
 
sylwia-lask profile image
Sylwia Laskowska

Thank you so much, Pascal! I’m really glad the article and the demo helped clarify the value of WebGPU 😊
And yes — I totally agree. In day-to-day dev work the use cases can feel pretty limited… until they suddenly aren’t. I’ve had more than a few moments where a “simple” feature turned into something that really needed serious performance, and then having tools like this starts to matter a lot 😄

Collapse
 
pascal_cescato_692b7a8a20 profile image
Pascal CESCATO

Absolutely — same here. And to be honest, given the kind of projects I’m working on, I don’t expect to need WebGPU anytime soon. But I was curious to see what it felt like in practice: the possibilities, the rendering, the kind of problems it can unlock down the road.

And your demo was perfect for that — it gave me a clear sense of where this tech could matter later, even if today my use cases stay pretty modest. Still, it’s great to see what’s coming. 😊

Thread Thread
 
sylwia-lask profile image
Sylwia Laskowska

That was exactly my goal with the demo: not to push WebGPU as something everyone needs now, but to give a tangible feel for what it unlocks when the time comes. Even if today the use cases are modest, it’s exciting to see what’s ahead. 🚀

Collapse
 
benjamin_nguyen_8ca6ff360 profile image
Benjamin Nguyen

Great article Sylwia as usual

Collapse
 
sylwia-lask profile image
Sylwia Laskowska

Thanks, Ben 😊 Always nice to see you here!

Collapse
 
benjamin_nguyen_8ca6ff360 profile image
Benjamin Nguyen

You are welcome! Yes, indeed:)

Collapse
 
benjamin_nguyen_8ca6ff360 profile image
Benjamin Nguyen

I am here or LinkedIn:)

Collapse
 
marina_eremina profile image
Marina Eremina

Thanks for the article, it’s exciting to see how this API could push web graphics forward. From my own experience, the challenge is that in real projects we often can’t fully use these advanced features. For example, even when working with WebGL maps, we still usually have to provide a Canvas fallback because not all users support it. Hopefully WebGPU adoption speeds up over time :)

Collapse
 
sylwia-lask profile image
Sylwia Laskowska

Thanks for the comment! Yes, that’s exactly how it looks in larger, commercial projects. Fallbacks are often unavoidable, and I think this will remain the case for a while. WebGPU without a fallback will probably make sense first in environments where you can enforce modern browsers.
That said, WebGPU feels much more flexible than WebGL, so I’m cautiously optimistic that adoption - and real-world usability - will improve over time 🙂

Collapse
 
sloan profile image
Sloan the DEV Moderator

We loved your post so we shared it on social.

Keep up the great work!

Collapse
 
doogal profile image
Doogal Simpson

I really appreciate the distinction you made between WebGL’s 'hacks' and WebGPU’s explicit design. We’re essentially trading the comfort of high-level abstractions for the predictability of modern GPU architectures like Vulkan or Metal. It’s a significant shift in the mental model for web devs, but moving away from that 'magical global state' is a necessary step for building truly resilient, high-performance browser tools

Collapse
 
sylwia-lask profile image
Sylwia Laskowska

Thank you — that’s a great way to put it.
That shift in mental model is probably the hardest part, but also the most valuable one. Losing the “magical” global state can feel uncomfortable at first, yet it gives you predictability and control that simply weren’t possible with WebGL. For long-lived, performance-critical tools in the browser, that trade-off really starts to make sense.

Collapse
 
tythos profile image
Brian Kirkpatrick

I think the killer feature will be when secondary (non-JS) languages get more streamlined access to the WebGPU runtime--WASM in particular. I could see a batched command buffer approach helping with some sort of minimal shim but I'd rather do away with the need altogether!

Collapse
 
tythos profile image
Brian Kirkpatrick

Oh... and this was the killer anti-feature that made me finally drop Firefox (will miss you!). Can't believe how long this API was in experimental/beta.

Collapse
 
sylwia-lask profile image
Sylwia Laskowska

Yesss, totally agree 😄 Thanks for the comment - I’m 100% on the same page.

If WASM ever gets cleaner access to WebGPU or somehow to the DOM/browser APIs, we’re basically set. And yeah… the Firefox wait really hurt 🥲

Collapse
 
alptekin profile image
alptekin I.

Hi Sylwia,
This is awesome, thanks for your post. I just could go thru the live demo but will check the code asap.

Collapse
 
sylwia-lask profile image
Sylwia Laskowska

Hi! I’m really glad you liked it - thanks a lot 😊
Hope you’ll enjoy digging into the code as well!

Collapse
 
adamthedeveloper profile image
Adam - The Developer

I'm having too much fun with the demo

Collapse
 
sylwia-lask profile image
Sylwia Laskowska

Haha, then the demo is doing exactly what it’s supposed to do 😄

Some comments may only be visible to logged-in visitors. Sign in to view all comments.