Ved (@ved_b_) header
Ved (@ved_b_) profile picture

Learning and documenting-Systems, Software & tools

Greator Noida
Joined March 2023
Photo by Ved (@ved_b_)Photo by Ved (@ved_b_)Photo by Ved (@ved_b_)Photo by Ved (@ved_b_)Photo by Ved (@ved_b_)Photo by Ved (@ved_b_)Photo by Ved (@ved_b_)Photo by Ved (@ved_b_)Photo by Ved (@ved_b_)Photo by Ved (@ved_b_)
So this repo of mine has 35K+ visitors and that's cool. repo: github.com/viveknaskar/every…
8
2
27
622
Authentication & Authorization is beautiful. Every concept has a story. You just don't know it yet. You build an API. Anyone can call it. Anyone can read the data. Anyone can delete the records. There is no "who". There is just "anyone". So you add a password. Now the user proves who they are before they get in. That is Authentication. The oldest problem in computing, solved with a string you type and hope nobody guesses. Your server checks the password on login and lets the user in. But HTTP has no memory. Every request arrives like a stranger. The server forgets them immediately. So you create a Session. The server remembers the user server-side and hands them a Session ID. They send it back with every request. The server looks it up and recognises them. One stable ID. One server-side store. It works until you have ten servers and no idea which one holds the session. So you put Session state in Redis. Every server reads from the same store. The user can hit any server. The session survives. Now you have mobile apps, microservices, third-party integrations. They cannot use cookies. They need something they can carry themselves. So you use a JWT. A self-contained token with the user's identity baked in. No database lookup. The server verifies the signature and trusts the claims. It scales. It is stateless. It feels elegant. Then a user gets compromised. You want to invalidate their token. But the token is valid for 24 hours and there is no registry to check. You cannot un-issue a JWT. It is just out there, valid, until it expires. So you make tokens short-lived. 15 minutes. You add a Refresh Token, long-lived and stored securely, used only to get a new access token. Now revocation is possible. The refresh token hits your server. Your server can reject it. The 15-minute window is acceptable risk. Your app needs to access the user's Google Calendar. You ask them for their Google password. They give it to you. You store it. Now you hold credentials you were never supposed to have. So you use OAuth 2.0. Google asks the user directly. The user says yes. Google gives your app a scoped token. Your app never sees the password. The user can revoke access without changing their password. Delegation, not impersonation. The right model. You add OAuth. Users log in with Google. But now you need to know who they are, not just that they have access. The access token lets you call Google APIs. It does not tell you the user's name. So you add OpenID Connect. An identity layer on top of OAuth. Google sends an ID Token, a signed JWT with the user's name, email, and a unique ID. Authentication and Authorization in one handshake. Users are in. Now the question changes. Not "who are you" but "what can you do". You give every user full access. It is simpler. One user deletes the production database. Accidentally. They had no reason to have that permission. You had no reason to give it. So you add Roles. Admin. Editor. Viewer. Each role has specific permissions. Each user gets a role. The Editor cannot delete. The Viewer cannot edit. It works until you have 40 roles and nobody can explain what each one does. So you write Policies. Not roles assigned to users but rules evaluated at request time. This user, this resource, this action, this time of day. OPA evaluates it. You get a decision. Access or deny. Expressible. Auditable. Composable. A user logs in with just a password. An attacker gets the password from a breach database. Your database was not the one that leaked. Your users reuse passwords. The attacker is in. So you add MFA. A second factor the attacker does not have. A TOTP code from an authenticator app. A hardware key. A biometric. The password alone is no longer enough. The attacker has the password. They still cannot get in. A user gets a phishing email. A fake login page, pixel-perfect. They type their password and their TOTP code. The attacker relays both in real time. MFA did not save them. The fake site looked real. The user could not tell the difference. So you use Passkeys. No password to steal. No code to intercept. The user's device holds a private key bound to your site's exact origin. A fake site is a different origin. The key does not work there. Phishing becomes structurally impossible. Not harder. Impossible. Your services talk to each other inside the cluster. Service A calls Service B. But B has no way to know the request actually came from A and not from something that found a way inside the network. You trusted the network. The network is not enough. So you use mTLS. Both sides present certificates. Both sides verify each other. A service cannot lie about its identity. A compromised pod cannot impersonate a trusted service. Zero Trust. Not because it sounds good in a pitch deck. Because the alternative is assuming your internal network is safe. It is not. Authentication answers: who are you. Authorization answers: what can you do. Most teams get Authentication right and treat Authorization as an afterthought. That is where breaches live. Not at the login page. In what you let authenticated users do after they are inside. The pattern across all of it is the same. Every concept exists because the previous one had a gap. Sessions because HTTP is stateless. JWT because sessions do not scale. OAuth because passwords should not be shared. Passkeys because passwords should not exist. Each one is a better answer to the same question. "Who are you. And what are you allowed to do here."
Backend developers: What's the difference between: - Authentication - Authorization Can you explain both in one sentence?
7
11
3
87
7,476
Spent the weekend on why NVIDIA paid $13B for Hugging Face. Not lock-in -- The default path. Link in reply.
1
4
202
Built a fast, multi-threaded file encryption tool in C++ Nexcrypt encrypts files and entire directories using modern cryptography, while processing multiple files in parallel. 🚀 203 MB/s 📁 6.27 GB encrypted in 31 seconds 💻 Linux + Windows binaries available Still improving it in my free time, but it's ready to use. Try it and let me know how fast it runs on your machine. Feedback is welcome. PS. Wanted to build this mainly to learn and get hands-on with multi-threading, file I/O, memory management and cryptography. Github 🔗👇
1
1
13
1,146
The biggest lie in C++ is std::move It doesn’t move a single byte of memory Here’s how I finally understood copy, references and move semantics using real-world analogies. Hope it helps you too
1
228
Ever wondered how you can "Ctrl + click" a function in your editor and it instantly jumps to the exact line where it was defined? Even if that function lives deep inside some random, obscure open-source library you downloaded months ago?
1
1
187
Historically, code intelligence was a nightmare. If you wanted features like autocomplete or error checking, developers had to rewrite the exact same code analysis tools over and over again for every different editor on the market. It was an absolute mess to maintain. Then came the Language Server Protocol (LSP). Now, language creators write one universal "Language Server" (like rust-analyzer or gopls), and editor creators write one client. When you open a project in editors like @code ,or @zeddotdev, etc they spin up this service locally on the machine. It indexes your entire codebase including node_modules, venv, or hidden dependencies and builds a massive map of how everything connects. So when you hover for docs, look at error squiggles, or Ctrl + Click into a library, your editor is just querying that local background brain.
1
156
WTF is behind ox alpha ???? this thing just rolls up on openrouter with 1m context, multimodal, coding god, and oh yeah it can serve 100 trillion tokens a day !!! like… how do you even HAVE that much compute lying around???
153
A boolean only needs 1 bit. So why do languages/compilers often use 1 byte to store it? Where do those other 7 bits go?
2
1
194
The reason starts with how memory is addressed... Memory is byte-addressable. Basically, the CPU doesn't normally get an address for an individual bit. It gets an address for a byte. So even though "true"/"false" only needs 1 bit, a normal variable gets at least a byte of storage. But here's where it gets interesting... You can pack booleans into individual bits. The reason we don't do that for every "bool" is that accessing an individual bit is more work. The CPU has to get the byte containing that bit and then extract it using masking, shifting, etc. And modern CPUs are insanely fast. So we're often willing to spend those extra 7 bits to keep access simple and fast. But then I found out something cool in C++: "std::vector<bool>" actually does bit-packing. So: bool arr[100]; typically takes 100 bytes. While: std::vector<bool> v(100); can store those 100 values in roughly 13 bytes. That's a pretty crazy difference once you're storing millions of flags. So those 7 bits aren't necessarily "wasted." You're trading memory for simpler access.
1
165
The future of computing may be determined less by how many operations a processor can perform and more by how efficiently the system can move information to those operations.
3
93
Was working on a custom encryption/decryption tool for myself and dug into the C++17 <filesystem> library to handle the file inputs. And honestly, it made the whole workflow so clean. I needed a way for the tool to scan a folder, grab all the target files, encrypt them, and swap their extensions to something like .nex With <filesystem>, it was just a few lines of code. fs::recursive_directory_iterator handled digging through subfolders, and .replace_extension() took care of the renaming instantly. But it made me stop and wonder... how did devs actually pull this off before C++17? I looked into it. Before it became a standard feature, C++ had zero native way to talk to your hard drive's folders. If you wanted your encryption tool to run on both Windows and Linux, you had to write the file-hunting logic twice. You either had to mess with raw Windows APIs (FindFirstFile) and POSIX code (opendir), or bloat your project by installing massive external libraries like Boost. Basic things we take for granted now like using a simple / operator to join paths without worrying if the OS uses a backslash or a forward slash used to require tedious string manipulation. It’s nice when the language lets you actually focus on building your tool and writing the logic.
132
Battlefield 6 Wake Island trailer + Aari Aari was NOT supposed to go this hard 💀🔥
1
3
260
We moved computation to the cloud so we wouldn't have to manage servers then hired people to manage our cloud infrastructure
94
Say you have 4 projects. All four use: typescript react eslint zod With npm, each project gets its own node_modules tree. With pnpm, each project still gets its own dependencies but the actual package contents can be shared through pnpm's store. That distinction is huge. But that doesn't mean install express once and every project automatically has express You still run: pnpm add express in every project that needs it The difference is that pnpm doesn't need to keep four independent physical copies of identical package contents around. This results in -> Less disk. Less downloading. Less copying.
1
1
71
Honestly, speed is nice but the real win is how pnpm handles dependencies. It's stricter by design. If your app uses something like blabla, you actually have to declare it, instead of accidentally relying on it being there because another package pulled it in. That might sound annoying, but it prevents the classic “works on my machine” phantom dependency problem that shows up in bigger JS projects when someone changes the dependency tree.
1
2
50
I haven't worked with monorepos myself yet, so that part isn't from personal experience. But the way pnpm handles shared storage, dependency isolation, and workspaces is pretty interesting. I've found the other differences pretty compelling too. If you've used both npm and pnpm, what has your experience been?
37
I used to think pnpm was just “npm, but faster.” It isn't. The interesting part is what pnpm does with the stuff you install and why that starts mattering once your projects get bigger. A practical comparison 🧵
1
2
141