Keeping an Ethernet cable tester stateless in the browser
When I built the first version of the ethernet cable tester, the main feature was simple: you enter the color order for pins 1 through 8, and it tells you whether the cable is straight-through T568A, T568B, crossover, or
When I built the first version of the ethernet cable tester, the main feature was simple: you enter the color order for pins 1 through 8, and it tells you whether the cable is straight-through T568A, T568B, crossover, or miswired. I expected the hard part to be the wiring table. It wasn't. The hard part was resisting the urge to add helpful state.
My first pass saved the last pinout in localStorage so you wouldn't have to re-enter it if you refreshed. That felt friendly until I pictured the actual use case: someone in a shared server closet or a small office, using a borrowed laptop, checking a batch of cables. The pinout isn't sensitive in the abstract, but it's still the thing they're working on, and a random tool shouldn't quietly keep it around. I removed the persistence and made the tester stateless. Reload the page and the fields are empty. No account, no saved history, no recent-tests list.
The privacy side was mostly deletion, which is a nice kind of work. The performance side was a small constraint I set: every pin change should recalculate locally, without a network round trip. The comparison logic is a few arrays and a switch, so it runs in the same frame as the input event. I also avoided sending any keystrokes or partial pinouts to analytics. The only thing the page needs from the network is the initial HTML, CSS, and JS.
One gotcha I hit while testing the tool myself: I kept entering the pins in the order I was holding the connector, not the order printed on the RJ45 jack. The numbering matters. On a real connector, pin 1 is usually on the left when the clip is facing away from you, but people flip it. I added a short inline diagram and a note about the clip orientation, because a wrong pin order looks exactly like a bad cable. The other common mistake is treating pins 4/5 and 7/8 as one pair; they aren't. If you're wiring T568B, the blue pair sits on 4/5 and the brown pair on 7/8, and swapping them will show up as a fault.
After a few days of use, the stateless version felt better. I could open the page on a phone in a rack room, check a cable, and close the tab without leaving anything behind. If you want to try the version I ended up with, it's here: ethernet cable tester. It's free and doesn't ask for a signup.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.