<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/valkey-valkey-modules-101-az0beln0y" -->

---
title: Valkey · Valkey Modules 101 | daily.dev
description: A hands-on walkthrough of building Valkey modules to extend the in-memory data store with new commands and data types without touching its core code. Covers...
canonical: https://daily.dev/posts/valkey-valkey-modules-101-az0beln0y
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Valkey · Valkey Modules 101 | daily.dev
og:description: A hands-on walkthrough of building Valkey modules to extend the in-memory data store with new commands and data types without touching its core code. Covers...
og:url: https://daily.dev/posts/valkey-valkey-modules-101-az0beln0y
og:image: https://api.daily.dev/og/posts/Az0beLn0y.png
og:image:alt: Valkey · Valkey Modules 101
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Valkey · Valkey Modules 101

**[Valkey](https://daily.dev/sources/valkey-blog)** · 4 min read · 0 upvotes · 0 comments

## Summary

A hands-on walkthrough of building Valkey modules to extend the in-memory data store with new commands and data types without touching its core code. Covers writing a minimal 'Hello World' module in C, then the same module in Rust using the Valkey Module Rust SDK, compiling each as a shared library, loading them via valkey.conf or at runtime with MODULE LOAD/UNLOAD, and verifying custom commands via valkey-cli.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://valkey.io/blog/modules-101>

## Questions this post answers

### How do I create a basic Valkey module in C that adds a custom command?

Define a command function that returns a reply, then call ValkeyModule_Init and ValkeyModule_CreateCommand inside the required ValkeyModule_OnLoad function. For example, a hello function returning a simple string is registered as module1.hello via ValkeyModule_CreateCommand(ctx,"module1.hello", hello,"",0,0,0), then compiled into a shared library with make inside src/modules.

_Developers extending Valkey with custom commands can track module tutorials like this on daily.dev._

### How do I build a Valkey module in Rust instead of C?

Create a library crate with cargo new --lib, add the valkey-module crate as a dependency, and set crate-type to cdylib in Cargo.toml so cargo builds a shared library. Use the valkey_module! macro to define the module name, version, data types, and commands, implementing each command as a Rust function returning a ValkeyResult.

_Teams choosing between C and Rust for Valkey extensions can follow comparisons like this on daily.dev._

### How do I load and unload a Valkey module without restarting the server?

Set enable-module-command yes in valkey.conf, restart valkey-server once, then use MODULE LOAD <path> and MODULE UNLOAD <name> from valkey-cli to add or remove modules at runtime. This lets you recompile module code and reload it without a full server restart, and MODULE LIST shows currently loaded modules with their name, version, and path.

_Developers iterating on Valkey module code can keep up with runtime workflows like this via daily.dev._

## Similar posts on daily.dev

- [Valkey just had a 17x year. Its lead maintainer still doesn’t want Redis to die.](https://daily.dev/posts/valkey-just-had-a-17x-year-its-lead-maintainer-still-doesn-t-want-redis-to-die--hymzgle9p) · The New Stack · 2 upvotes · 0 comments
- [Valkey · Simulating Real Workloads with valkey-benchmark](https://daily.dev/posts/valkey-simulating-real-workloads-with-valkey-benchmark-tg1fvu5bu) · Valkey · 0 upvotes · 0 comments
- [The Golden Spike, and Resurrecting the Vale\(n\) Programming Language](https://daily.dev/posts/the-golden-spike-and-resurrecting-the-vale-n-programming-language-8wwzc4fu9) · Lobsters · 3 upvotes · 0 comments
- [\[Video Podcast\] Improving Valkey with Madelyn Olson](https://daily.dev/posts/video-podcast-improving-valkey-with-madelyn-olson-bjpwcn9zl) · InfoQ · 0 upvotes · 0 comments

---

Tags: [#backend](https://daily.dev/tags/backend), [#rust](https://daily.dev/tags/rust), [#c](https://daily.dev/tags/c), [#redis](https://daily.dev/tags/redis), [#valkey](https://daily.dev/tags/valkey)

[View this post on daily.dev](https://daily.dev/posts/valkey-valkey-modules-101-az0beln0y)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Valkey · Valkey Modules 101","url":"https://daily.dev/posts/valkey-valkey-modules-101-az0beln0y","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/valkey-valkey-modules-101-az0beln0y"},"datePublished":"2026-08-23T12:19:36.415Z","dateModified":"2026-08-23T12:38:27.493Z","description":"A hands-on walkthrough of building Valkey modules to extend the in-memory data store with new commands and data types without touching its core code. Covers...","image":"https://media.daily.dev/image/upload/s--P4t4XyoV--/f_auto/v1722860399/public/Placeholder%2001","thumbnailUrl":"https://media.daily.dev/image/upload/s--P4t4XyoV--/f_auto/v1722860399/public/Placeholder%2001","isAccessibleForFree":true,"articleSection":"Valkey","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Valkey","logo":"https://media.daily.dev/image/upload/s--XXPzEmD8--/f_auto,q_auto/v1787487496/logos/valkey-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/valkey-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/valkey-valkey-modules-101-az0beln0y","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"backend,rust,c,redis,valkey","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Valkey","item":"https://daily.dev/sources/valkey-blog"},{"@type":"ListItem","position":3,"name":"Valkey · Valkey Modules 101"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/valkey-valkey-modules-101-az0beln0y#faq","mainEntity":[{"@type":"Question","name":"How do I create a basic Valkey module in C that adds a custom command?","acceptedAnswer":{"@type":"Answer","text":"Define a command function that returns a reply, then call ValkeyModule_Init and ValkeyModule_CreateCommand inside the required ValkeyModule_OnLoad function. For example, a hello function returning a simple string is registered as module1.hello via ValkeyModule_CreateCommand(ctx,\"module1.hello\", hello,\"\",0,0,0), then compiled into a shared library with make inside src/modules. Developers extending Valkey with custom commands can track module tutorials like this on daily.dev."}},{"@type":"Question","name":"How do I build a Valkey module in Rust instead of C?","acceptedAnswer":{"@type":"Answer","text":"Create a library crate with cargo new --lib, add the valkey-module crate as a dependency, and set crate-type to cdylib in Cargo.toml so cargo builds a shared library. Use the valkey_module! macro to define the module name, version, data types, and commands, implementing each command as a Rust function returning a ValkeyResult. Teams choosing between C and Rust for Valkey extensions can follow comparisons like this on daily.dev."}},{"@type":"Question","name":"How do I load and unload a Valkey module without restarting the server?","acceptedAnswer":{"@type":"Answer","text":"Set enable-module-command yes in valkey.conf, restart valkey-server once, then use MODULE LOAD <path> and MODULE UNLOAD <name> from valkey-cli to add or remove modules at runtime. This lets you recompile module code and reload it without a full server restart, and MODULE LIST shows currently loaded modules with their name, version, and path. Developers iterating on Valkey module code can keep up with runtime workflows like this via daily.dev."}}]}
```

