Blog
20 postsBuilding Type-Safe REST APIs with Axum in Rust
Axum is a web framework for Rust that makes building APIs a pleasure. It’s built on top of Tokio and Tower, giving you excellent performance and composability. In this post, we’ll build a simple but complete REST API for managing a todo list.
React Hooks Deep Dive: Beyond useState and useEffect
Most React developers know useState and useEffect. But React offers several other hooks that can make your code cleaner, faster, and more maintainable. Let’s explore the hooks you might be missing.
React + Axum: Building a Type-Safe Full-Stack Application
What if your frontend and backend could share the same type definitions? No more mismatched API responses. No more runtime surprises. In this post, we’ll build a full-stack application with React and Axum that achieves exactly that.
Understanding Rust Lifetimes: A Beginner's Guide
Lifetimes are one of Rust’s most talked-about features, and they often intimidate newcomers. But once you understand why they exist, they become much less scary. Let’s demystify them.
Beginner's Guide to anyhow and thiserror in Rust
Rust error handling can feel intimidating at first, especially when you want nice error messages without writing a lot of boilerplate. Two crates make this much easier:
Determining if a File is a PDF in Rust
In my work generating BI (Business Intelligence) reports as PDFs with Apache FOP (the Java XSL-FO to PDF engine), I often need to verify that an output file is actually a PDF before further processing. A reliable way to do this is to inspect the file’s “magic bytes” – the fixed signature at the start of the file. Magic bytes (also called file signatures or magic numbers) are small sequences of bytes placed at the beginning of a file to identify its format. Because these signatures are defined by the file format itself and deliberately chosen to be unique, checking them is a fast and reliable way to recognize a PDF (or any file type) regardless of its extension.
An Introduction to the Core Concepts of Kubernetes
Kubernetes is an open-source container orchestration platform that has become the de facto standard for managing containerized applications at scale. Originally developed by Google and now maintained by the Cloud Native Computing Foundation (CNCF), Kubernetes (often abbreviated as “k8s”) provides a robust framework for deploying, scaling, and managing containerized applications across clusters of machines.
Converting Excel Column Names to Numbers in Rust
When working with Excel files programmatically, converting column names (like “A”, “B”, “C”, …, “Z”, “AA”, “AB”, etc.) to their corresponding numeric values (0, 1, 2, …, 25, 26, 27, etc.) is a common task. Rust, with its performance, safety, and expressiveness, is an excellent choice for implementing such functionality.
Utility to save a ton of time in web development
In modern web development, especially when working with utility-first frameworks like Tailwind CSS, managing dynamic class names efficiently is crucial. The cn function, which combines the functionalities of clsx and twMerge, offers a streamlined approach to handle this task.
Database Indexes Explained: Single-Column vs. Multicolumn Indexes
If your database queries feel slow, indexes might be the solution. But with different types of indexes available, how do you choose the right one? In this guide, we’ll break down single-column indexes and multicolumn indexes, show practical examples, and explain when to use each for faster query results.
Easy Steps to Export Schema Without Data from SQLite Database
In the realm of database management, SQLite stands out as a lightweight and efficient solution, especially for small to medium-sized applications. However, when it comes to sharing or migrating the structure of your database, it’s essential to export the schema without including any data. This ensures efficiency and security while maintaining the integrity of your database structure. In this guide, we’ll explore the simple steps to export the schema from an SQLite database without the accompanying data.
Converting JavaScript Date to String in JSON.stringify
As software developers, we frequently need to work with data manipulation, including converting data types from one format to another. One common operation you may often encounter is converting JavaScript Date objects to a String format using the JSON.stringify function. However, you might have noticed that sometimes the conversion doesn’t always produce the results as you expect. In this post, we’ll look into this issue in detail.
Setting Timezone in Alpine-based Docker Image
When creating a Docker image using the Alpine Linux distribution, you may need to set the timezone to match your specific requirements. This is important for accurate timestamps in logs, scheduled tasks, and other time-sensitive operations. In this post, we’ll look at how to set the timezone in an Alpine-based Docker image using the Dockerfile.
Simplifying Docker Compose with .env Files
Docker Compose is a powerful tool for defining and running multi-container Docker applications. It allows developers to specify their application’s services, networks, and volumes in a single docker-compose.yaml file, making it easy to manage complex setups. However, as your project grows, managing environment variables for different services can become cumbersome. This is where the .env file comes to the rescue, providing a cleaner and more organized way to handle configuration.
Understanding JWT: Why the Payload is Decodable and How It Remains Secure
JSON Web Tokens (JWT) have become a widely used mechanism for securely transmitting information between parties, especially in the world of web applications. They’re commonly used for authentication, authorization, and information exchange in stateless environments.
How to Add Google-site-verification to CloudFlare
Google-site-verification is a method of verifying your website with Google. It’s used to prove that you own the domain and have the right to manage it. This verification is essential for accessing various Google services such as Google Search Console and improving your site’s visibility in Google search results.
A Clean Git History: `git pull --rebase` to Prevent Merge Commits
Learn how to use git pull with rebase flag to prevent unnecessary merge commits and keep your Git history neat and linear.
How to Build SQLite3 .lib File on Windows 10
While SQLite provides pre-built binary files for various platforms, there might be situations where you need to build a custom .lib file on Windows 10. In this tutorial, we’ll guide you through the process of building the SQLite3 .lib file step by step.
Setting Up a Custom 404 Page on Nginx
A 404 page is a standard response code in HTTP telling the user, in effect, that they’ve clicked on a broken link. Setting up a custom 404 page on Nginx is a simple and straightforward process.