SShortSingh.
Back to feed

How to use presigned URLs for direct browser-to-bucket file uploads in Node.js

0
·1 views

Developers building SaaS applications can improve upload efficiency by having a Node.js API generate short-lived presigned URLs, allowing browsers to send files directly to private object storage buckets without routing data through the server. This approach frees server processes from handling slow, large file transfers, which can otherwise tie up resources for several minutes per upload under concurrent load. A recommended two-bucket pattern routes browser uploads into a quarantine bucket first, where a worker validates files before copying them to durable storage, with lifecycle rules expiring unvalidated objects. The API should confirm an object's presence in storage before writing any database record, preventing orphaned entries for files that never fully arrived. For global SaaS products, running separate buckets in US and EU regions and routing uploads based on tenant records helps address data residency requirements.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Modern API Gateways Now Handle Security, AI, and Observability Far Beyond Routing

API gateways have evolved well beyond their original role as simple reverse proxies with basic authentication and rate limiting, a function that was sufficient around 2012 but is now considered inadequate. Today's gateways sit at the intersection of security, integration, observability, and AI, offering capabilities such as full OAuth 2.0/OIDC lifecycle management and fine-grained authorization at the route level. Early platforms like Apigee and Kong established solid fundamentals but suffered from static configurations, monolithic architectures, and an inability to handle protocols like gRPC or GraphQL natively. Modern implementations move authorization logic out of individual services and into a centrally managed gateway layer, allowing security policy updates to be applied once rather than across dozens of service repositories. Organizations that continue treating the API gateway as a basic routing tool risk missing significant operational and security capabilities now considered standard in enterprise architecture.

0
ProgrammingDEV Community ·

How RAG Technology Is Reducing AI Hallucinations by Grounding Responses in Real Data

Retrieval Augmented Generation (RAG) is a technique designed to make AI language models more accurate by supplementing their responses with information retrieved from specific, up-to-date documents or databases. Traditional large language models are trained on vast text datasets and then frozen in time, generating answers by predicting plausible word patterns rather than recalling verified facts. This approach often leads to 'hallucinations,' where AI systems produce confident but entirely fabricated information, as seen in cases where chatbots invented fictional legal precedents or non-existent refund policies. RAG addresses this by adding a retrieval step before response generation, where the system searches a relevant knowledge base and feeds the most pertinent text chunks to the AI as real-time context. The result is that AI responses become grounded in actual source material rather than statistical pattern-matching, significantly reducing the risk of confidently wrong answers.

0
ProgrammingDEV Community ·

Vector Embeddings Explained: How AI Converts Data Into Spatial Coordinates

Vector embeddings are numerical representations of data — such as words, songs, or images — that capture relationships by positioning each item as a coordinate in a high-dimensional mathematical space. Items that share similar contexts are placed closer together, while unrelated ones sit farther apart. AI systems build these spatial maps by processing vast amounts of examples and observing which items consistently appear in similar contexts. Spotify uses this technique to analyze songs by tempo, mood, and playlist groupings, then recommends tracks that are nearest neighbors to a song a user plays. Tools like Google Search also rely on the same principle, having learned language patterns from billions of web pages without ever being explicitly taught grammar rules.

0
ProgrammingDEV Community ·

How HashMaps Use Hashing to Find Data Instantly Without Searching Everything

A HashMap is a data structure that stores information against unique keys and retrieves it without scanning every stored entry. The mechanism behind this speed is hashing, a process that converts a key into a specific storage location using a consistent calculation. Just as a locker number directs a student straight to their locker, a hash function directs the system straight to where a value is stored. Because the same key always produces the same location, retrieval is predictable and efficient even across millions of stored objects. Real-world HashMaps use more complex formulas, but the core idea remains the same: a key goes in, a location comes out.

How to use presigned URLs for direct browser-to-bucket file uploads in Node.js · ShortSingh