Generate icon
JsonObjectGenerator icon
Set icon

Set a single mock user JSON in Redis

Generate a mock user with name, email, and skills, then store it in Redis as a JSON key-value pair using Kestra's declarative orchestration.

Categories
Data
id: redis-generate-mock-user-json
namespace: company.team
description: Set a single mock user JSON in Redis

tasks:
  - id: datagen
    type: io.kestra.plugin.datagen.core.Generate
    generator:
      type: io.kestra.plugin.datagen.generators.JsonObjectGenerator
      locale: [ "en", "US" ]
      value:
        name: "#{name.fullName}"
        email: "#{internet.emailAddress}"
        skills: "#{job.keySkills}"
  - id: set_redis
    type: io.kestra.plugin.redis.json.Set
    url: "{{ secret('REDIS_CLOUD') }}"
    key: "{{ outputs.datagen.value['name'] }}"
    value: |
      {
        "{{ outputs.datagen.value["email"] }}": "{{ outputs.datagen.value["skills"] }}"
      }

Need realistic test data in Redis without writing a seed script? This blueprint generates a synthetic user record (name, email, and skills) with the data generation plugin and writes it straight into Redis as a JSON key-value pair. It is a fast way to seed a cache, populate a key namespace for local testing, or demo Redis-backed lookups, and you can run it repeatedly to fill the store with many keys.

How it works

  1. The datagen task (io.kestra.plugin.datagen.core.Generate) uses a JsonObjectGenerator with the en, US locale to produce one mock object containing a full name (#{name.fullName}), an email address (#{internet.emailAddress}), and a list of key job skills (#{job.keySkills}).
  2. The set_redis task (io.kestra.plugin.redis.json.Set) connects to Redis using the connection string in {{ secret('REDIS_CLOUD') }}. It uses the generated name as the Redis key and writes a JSON value mapping the user's email to their skills, referencing the upstream outputs via {{ outputs.datagen.value[...] }}.

What you get

  • A fresh, realistic user record stored in Redis on every run.
  • A JSON value structure keyed by the user's name, mapping email to skills.
  • A repeatable building block for seeding caches or test fixtures.
  • A clean separation between data generation and the Redis write step.

Who it's for

  • Developers who need believable test data in Redis without hand-writing fixtures.
  • Platform and data engineers prototyping Redis-backed caches or lookups.
  • Anyone demoing Redis JSON storage or building local test environments.

Why orchestrate this with Kestra

Redis has no native scheduler or workflow engine, so seeding it on a cadence or as part of a larger pipeline usually means glue scripts and cron. With Kestra you declare the whole flow in YAML, chain the generation and write steps with clear output passing, and add event triggers, retries, and full execution lineage. You can fire this on a schedule, on a webhook, or as a subflow of a bigger data pipeline, and credentials stay in {{ secret() }} rather than living in code.

Prerequisites

  • A reachable Redis instance (cloud or self-hosted).
  • The Kestra Redis and data generation plugins available in your instance.

Secrets

  • REDIS_CLOUD: the Redis connection string (URL) used to authenticate and connect.

Quick start

  1. Add the REDIS_CLOUD secret with your Redis connection string.
  2. Copy this blueprint into your namespace.
  3. Execute the flow and inspect the datagen task output to see the generated record.
  4. Verify the new key exists in Redis (for example with GET on the generated name).

How to extend

  • Add more fields to the JsonObjectGenerator value (phone, address, company) for richer records.
  • Loop the flow with a ForEach to bulk-seed hundreds of keys in one run.
  • Switch the locale to generate data for a different region or language.
  • Add a Schedule trigger to refresh test data automatically, or chain a Redis Get task to validate the write.

Links

Orchestrate with Kestra
Orchestrate Redis with Kestra
Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.