// writing
Notes and write-ups
everything tagged nodejs

LaundryAlert - never forget your laundry again
Forgetful habits regarding completed laundry cycles led to the development of a custom monitoring system that triggers push notifications on mobile devices. By combining a light-sensitive sensor on a washing machine with a control board, a solution was created to detect status changes and alert users remotely. This project combines basic electronics with custom software to solve a frequent household annoyance.

Javascript objects are tricky
Unexpected behavior occurs when using standard objects as collections for dynamic input. Prototype properties can conflict with data keys, leading to type errors during data processing. Using specialized data structures provides a more reliable and performant approach for handling arbitrary keys.

Server-sent events or how ChatGPT typing animation works
Real-time communication enables modern web applications to push data to users instantly instead of waiting for traditional request-response cycles. This article explores how Server-Sent Events facilitate streaming content directly from a server, powering features like the typing effect seen in chat interfaces. It provides a practical overview of implementing these streams to improve user experience in web applications.

Database locks, lost updates and idempotency
Distributed systems frequently face challenges with concurrency and duplicate requests that can lead to data loss or incorrect application states. This post explores practical strategies for maintaining data integrity, including leveraging HTTP headers for optimistic concurrency control and idempotency. It also examines how database-level transactions and row-level locking mechanisms can prevent race conditions in complex workflows.

Assuming IAM role and role chaining in AWS
Managing temporary security credentials across AWS accounts allows applications to securely access resources. Using the Security Token Service to assume roles requires a clear understanding of trust policies and session duration limits. A specific limitation occurs during role chaining, where the session length is constrained compared to assumptions made by IAM users.

Running HTTPS on localhost
Development environments often require HTTPS to properly test features that rely on secure connections. This guide covers generating self-signed certificates and configuring local web servers to enable encrypted traffic on a development machine. It also looks at how to map custom domain names to local resources to simplify the testing process.

How We Migrated All User Files to AWS S3
Migrating a large volume of user files between cloud providers requires careful planning to maintain service stability and data integrity. This process explores the transition from initial sequential scripts to a highly parallelized architecture capable of handling millions of records efficiently. The final approach demonstrates how optimizing infrastructure and leveraging worker-based processing can significantly improve performance and resource utilization.