TLDR Web Dev 2024-05-08

Token-based auth 101 🔐, don’t refactor too much 🤔, prevent flaky tests 🛠️

🧑‍💻
Articles & Tutorials

Token-based Authentication and JWTs (7 minute read)

Token-based authentication is when a user is authenticated by presenting a digitally signed token instead of entering a password. It's a common alternative to session-based authentication. JSON Web Tokens (JWTs) are a popular implementation of token-based authentication as they have a self-contained structure that includes user data and a signature for integrity verification. This article provides code implementations for both generic token-based authentication and JWTs.

React Query and React Context (6 minute read)

React Query and React Context can be used together to manage data dependencies and make component logic simpler. Combining both makes implicit dependencies (like knowing a query has been executed elsewhere) clear and visible in your code.
🧠
Opinions & Advice

How refactoring almost ruined my marriage (6 minute read)

Developers often feel the urge to rewrite code they perceive as messy, even if it's their own relatively recent work. This is because reading code is inherently harder than writing it. However, code that works and has been in production for a long time is often more stable and robust than developers realize.

How do you Address and Prevent Flaky Tests? (7 minute read)

Flaky tests are when tests sometimes pass and sometimes don't. Most of the time, they occur due to tests being poorly written and not hermetic. Sometimes, they can be due to resource constraints or data conflicts in the test environment. To prevent flaky tests, developers should catch them early by running tests often and reduce dependencies on external factors as much as possible.
🚀
Launches & Tools

Teable (GitHub Repo)

Teable is a no-code database built on Postgres. It uses a spreadsheet-like interface to help create complex enterprise-level database applications.

DrawDB (GitHub Repo)

DrawDB is a database entity-relationship editor in the browser. Developers can use it to build diagrams, export SQL scripts, and more.
🎁
Miscellaneous

How AI apps make money (9 minute read)

While AI applications offer new capabilities to users, the pricing is mostly the same as traditional software applications. Most AI apps use subscription models, often based on the number of users. Free versions or trials are common to drive initial adoption. A new pricing model that AI could help facilitate is success-based pricing, where the user gets charged only when the product delivers a successful outcome.

How to use JSON Path (10 minute read)

JSONPath is a language for querying and extracting data from JSON documents. It can be used for tasks like updating OpenAPI descriptions or writing validation rules. Its syntax is inspired by XPath, making it easy to navigate JSON structure and find specific data.
⚡️
Quick Links

Spice Up Your Text with Emphasis Marks Using CSS (2 minute read)

The ‘text-emphasis' property in CSS allows you to add stylistic marks like dots, circles, or even emojis to highlight text.

Baileys (GitHub Repo)

Baileys is a TypeScript/JavaScript WhatsApp Web API that uses a WebSocket directly to interact with WhatsApp on the web.

If someone's having to read your docs, it's not “simple” (2 minute read)

Telling your users something is easy while they're struggling to understand it can be frustrating and counterproductive for learning and adoption of your product.

CSS Text Box Trim Examples (GitHub Repo)

CSS Text Box Trim is a CSS property that allows you to remove the leading whitespace from a block of text.
Get our free, 5-minute newsletter read by 350,000 frontend, backend, and full stack developers
Join 300,000 readers for