r/webdev • • 18h ago

Just a reminder to every web dev, optimize your images!

Post image
443 Upvotes

So last night I was working on optimizing some code for a clients website. The site has been getting hammered by AI bots recently so I thought I’d go through all my code and make sure it was all as optimized as possible.

While analyzing the log file I noticed that someone was actively trying a SQL injection attack, so I thought I’d have some fun, I redirected all their requests to this image, which I didn’t compress in my rush to have some fun.

37,000 requests later and almost 10Gb of data transferred they finally stopped.

Yeah I realize it was probably an automated attack and they never actually saw the image, but part of me wishes it was some script kiddie and the image popped up on their screen 😜

So remember people, optimize your images!!


r/webdev • • 20h ago

Discussion Our CTO asked for more hand-written code a year after sending everything through the agents

204 Upvotes

I had a ticket last week, an order export skipping rows with no error. Went looking for where we parse the payload and there are seven functions that turn a string into JSON, safeParse, parseJsonSafe, a jsonOrNull in utils and some others in the services. I asked a teammate about one of them, he thought that was my side. One of the seven is probably mine from before last year, when they told us to put everything through the agents and anything by hand needed a why field on the PR, which I filled in for a bit and then stopped writing by hand.

I asked glm-5.3 to list the JSON parse functions and what calls them, do not touch anything. It came back with a table, all seven as the same thing and a lot of call sites. The checkout one looks like it does something different on bad input, I have not worked out what depends on it. Nobody has claimed the others either. I have a branch that merges the rest but I have not touched it since Tuesday. We had a couple of outages in October, in code none of us knew that well, and at the all hands a few weeks ago the CTO said something like he would like a bit more of the code written by people again.

How are you guys keeping AI agents from duplicating half your utils folder, or is anyone else's team quietly walking back the "AI-first" mandate once the maintenance debt started piling up?


r/webdev • • 10h ago

Discussion Users asking to remove their commits under GDPR

73 Upvotes

Seeing a spike of people asking to remove their commits from open-source GitHub repositories that I am the owner of because those commits carry their personal email or other identifiers.

How are you handling these?


r/webdev • • 2h ago

Showoff Saturday [Showoff Saturday] VinUI: an open-source component library where 8 visual styles share the same markup

Post image
3 Upvotes

I've been working on VinUI, an MIT-licensed component library for plain HTML, React, Vue and Svelte.

The main idea is that each of the eight styles (Precision, Tactile, Clay, Tonal, Editorial, Terminal, Paper, Bento) is only a set of CSS variables, so markup and props never change between looks. Instead of a runtime package, a CLI copies plain source files into your project:

npx /ui init
npx /ui add <component>
npx u/vinish/ui diff   # see upstream changes since you copied
  • 63 components, 13 page blocks and 16 plain-SVG charts
  • WCAG 2.2 AA checked in every style, light and dark
  • Works next to Tailwind or your own CSS

Repo: https://github.com/devvinish/vin-ui
Docs and live style switcher: https://vinish.dev/ui

Feedback welcome, especially on the theming approach and the copy-in model.


r/webdev • • 7h ago

Showoff Saturday [Showoff Saturday] I built a real-time multiplayer board game on Cloudflare Workers + Durable Objects

3 Upvotes

Landgrab is a free Monopoly-like game for 2–8 players or play with bots: https://landgrab.top

Stack:

- Game engine is pure TypeScript with a seeded RNG, shared by server, client and bots

- One Durable Object per room over WebSockets, with SQLite for accounts, stats and game logs

- React + Vite frontend, deployed as Worker static assets

- A simulator plays thousands of bot games to catch rule bugs and check board balance

Happy to answer questions about the architecture.


r/webdev • • 1h ago

Can someone explain why flag emojis don't display on most sites using Microsoft Edge on Windows 11. But when I paste the same flag emoji into Google, they are able to display it. Are they using some polyfill or what? I do not have this issue on Firefox, only on Edge.

Post image
2 Upvotes

For example the 🇸🇪 emoji is not being displayed for me here on Reddit. It only shows "SE" (the ISO country code for Sweden). It's supposed to display the Swedish flag.

If I paste this into Google.com and just search for it, I can see Google.com display it just fine, as seen on the screenshot.

I'm using the latest stable build of Microsoft Edge, on Windows 11.

I'd like to know how Google is able to display it, but other sites like Reddit does not. Because right now users of my site on Edge can't see any flag emojis. This only happens to me on Microsoft Edge.


r/webdev • • 7h ago

Showoff Saturday All 2,000+ wordles at the same time

Thumbnail
everydle.jakeo.dev
2 Upvotes

For when dordle, quordle, octordle, sedecordle, duotrigordle, and sexagintaquattordle aren't enough.

GitHub: https://github.com/jakeo-dev/everydle [human made]


r/webdev • • 1h ago

Showoff Saturday I developed this website to be as interactive and animation-heavy as possible using GSAP and Three.js, and to see what we could do with RTL design. Feedback is welcome!

Post image
0 Upvotes

This is a landing page I've been working on for two months. The desktop version features the full experience, with plenty of animations and interactive elements.

The animations are also adapted to better suit different devices, simplifying some of them on lower-powered devices like phones and tablets to keep performance as smooth as possible, and they were also made to feel more natural to each device. For example, on mobile devices and tablets, tilting and moving your device triggers an animation that makes the 3D model move along with it.

Would love to hear your feedback!

Here's the link!


r/webdev • • 21h ago

Trying to follow along this tutorial but the link doesn't work

Post image
0 Upvotes

Apparently this website shown in the video isn't hosting these project files anymore. The link glitch.com/~tensorflow-js-boilerplate redirects to their blog post about problems with unsustainable project hosting. Is there a way I can still follow the tutorial?

Or maybe there's just a really stupid answer that I dont know about because I never worked with a ML model before haha


r/webdev • • 4h ago

Showoff Saturday I built a nav bar that shrinks to icons as you scroll, with a live playground to try it

Post image
0 Upvotes

I first noticed this on District: scroll down and the bottom nav quietly shrinks to its icons, scroll back up and the labels return. Nothing hides, so the tabs are always one tap away. I wanted it in React Native, so I built it as a package.

The site has a phone running the real component (React Native Web in an iframe) with controls next to it. Change the layout, active tab colour, glass, placement or action button, then scroll the phone and see how it behaves.

react-native-shrinking-tab-bar

A few things I ran into building the playground:

• The phone is the real app, not a video. It's an Expo web export of a small demo, and the settings panel talks to it with postMessage.

• Reanimated's animated lists didn't forward onScroll on the web, so the hook returns a plain listener there and the demo uses a normal FlatList.

• A mouse doesn't scroll like a finger, so I added drag to scroll with a bit of momentum and a round "fingertip" cursor.

• Only transforms animate. The bar's layout box stays 346 × 66 in both states. The rounded bar is drawn in three pieces so scaleX doesn't squash its ends.

• The icon colour on the active tab is picked from contrast (WCAG luminance), so any colour you choose stays readable.

Demo: https://ninadsutrave.github.io/react-native-shrinking-tab-bar/
Code: https://github.com/ninadsutrave/react-native-shrinking-tab-bar

Feedback on the site or the component is welcome, and a ⭐ helps if you like it.


r/webdev • • 13h ago

Showoff Saturday I built MirageUI – a wireframe-to-code tool that uses geometric heuristics instead of LLMs for layout detection

Post image
0 Upvotes

I've been working on MirageUI with my team, and I wanted to share the project and some of the engineering behind it.

Live: https://mirageui.vercel.app/
Source: https://github.com/Veer1778/Mirage

The idea was to explore an alternative to prompt-based website generation.

Instead of describing a webpage to an AI, you draw a rough wireframe using rectangles, and the editor interprets the layout and generates frontend code.

How it works

The interesting part is the layout interpretation engine.

I deliberately avoided using an LLM for component recognition. Instead, Mirage uses geometric heuristics to infer what the user is trying to build.

It considers four main signals:

  1. Position: A full-width rectangle at the top is likely a navbar; the same rectangle at the bottom is likely a footer.
  2. Aspect ratio: Tall and narrow shapes can indicate rails, while wider shapes suggest horizontal sections.
  3. Spatial relationships: Multiple similarly sized rectangles sharing a row can indicate a card grid.
  4. Width and alignment: Elements snap to a 12-column grid before being interpreted.

One implementation decision I'm particularly happy with is storing sketches as integer grid coordinates rather than raw pixel positions.

Each box is represented using its column, row, width and height. This makes snapping, collision detection and layout calculations much more predictable.

Boxes that overlap vertically are grouped into horizontal bands, which are then translated into CSS grid layouts.

The editor also prevents overlapping boxes. When a drag is blocked, movement is retried along individual axes so elements can slide around obstacles.

Component detection

Mirage currently supports 19 component types, with nine detected automatically.

When the classifier isn't confident, it flags the element instead of silently guessing. Users can manually override classifications, and manually overridden elements aren't reclassified.

Code generation

The same sketch can be exported into three targets:

  • HTML: Semantic markup with a token-driven stylesheet.
  • React: Component-based output with props.
  • Tailwind: Utility classes with mobile-first breakpoints.

Sketches can also be saved and reloaded through a JSON format.

I kept styling separate from structure using design tokens. This means switching themes doesn't require changing the underlying markup.

Tech stack and architecture

One thing worth mentioning is that the entire application is built using:

  • Vanilla JavaScript
  • HTML
  • CSS
  • Vercel for deployment

There are no external dependencies, no build step and no backend. Everything runs in the browser as static files.

The repository is structured around separate editor, engine, theme and landing-page files.

What I learned

A few things I found interesting while building this:

  • Geometry alone can communicate a surprising amount of layout intent.
  • Using a consistent coordinate system simplifies several seemingly unrelated problems.
  • Automatic classification needs a manual override mechanism. You can't expect heuristics to understand every possible layout.
  • Generating valid code is one thing; generating code that developers would actually want to maintain is another.

This is still an evolving project, and I'd particularly appreciate feedback from people who have worked on frontend tooling, visual editors or code generation.

A few things I'd love opinions on:

  1. Would you approach component recognition differently?
  2. Are there better ways to handle ambiguous spatial relationships?
  3. What would make the generated React output more useful in a real development workflow?

Demo: https://mirageui.vercel.app/
GitHub: https://github.com/Veer1778/Mirage

It's MIT licensed and free to use. Would love to hear your thoughts!