DEV Community

Manlio Chite`
Manlio Chite`

Posted on

Your dummy data are really dummy. Let's fix it!

How many times have we built an application, only to hit the critical question, how do I structure my data?

Whether you’re a 9-to-5 dev or a late-night vibecoder, understanding your data structure is crucial for you and, most importantly, for your users. Data is what gets displayed, searched, filtered, and used to make your application feel alive and useful.

When designing it, we end up asking ourselves things like which pieces of data do I actually need? How should my database be structured? Do I really have to keep using those Latin placeholder words?

The answer to your question is Damī.

“Damī” (ダミー) comes from the Japanese word for “dummy”. It’s your personalised testing data generator that helps you structure your data as if it were in production, without exposing any sensitive information.

So get ready. Leave the Latin filler text to the philosophers and let’s think like engineers.

The University of Damī Exercise

To better understand how to structure data, and how to use Damī effectively, we’ll walk through a small exercise.

In this scenario, we’re impersonating the chancellor of the University of Damī. Our job: interrogate the database to check who the good and naughty students are.

Step 1 – Clone the Repository

First, clone the repository from the GitHub URL and open the folder with your favourite IDE.

Then, open your terminal and install the dependencies using:

npm install

Terminal install

Step 2 – Run the Dev Server

Run the dev server

npm run dev

You’ll see an error saying it couldn’t import data from data.js - this is expected, because we don’t have that file yet. If you’re eager to see the final result, there’s a data-example.js file at the root of the project. You can rename it to data.js to preview the end result.

Run server terminal

Step 3 – Generate Dummy Data with Damī

Now, head over to Damī to generate the dummy data.

Generate dummy data
From the navbar, or the hero section, click on the “Try Now!” button. You’ll be taken to the Damī JSON Editor – this is where the magic happens.

Dami JSON console

Step 4 – Understand the Problem Domain

As discussed, we first need to understand the problem domain so we know what kind of schema to generate. Some good guiding questions:

Who are the users of our application? In this case: the university chancellor.

What information does the chancellor need to see the students’ records and evaluate who’s “good” and who’s “naughty”? Or even simpler, what defines a student in this context?

That’s why the optional section to describe the purpose exists in Damī. You want to tailor your dummy data so it reflects the information you actually want to display.

Here’s an example schema description for a student record:

{
  Id: string: "University ID starting with dam- followed by a number",
  name: string: "Full name of the student",
  major: string: "Student major",
  startTerm: string: "Start term and year (e.g. Autumn 2024)",
  focus: string: "Subject of study, e.g. Neuro-symbolic learning for cultural preservation",
  nationality: string: "Student nationality",
  status: string: "e.g. 'Honours', 'On Probation', 'Good Standing'",
  gpa: number: "Decimal GPA value",
  creditsCompleted: number: "Number of credits completed",
  expectedGraduation: string: "Expected graduation term and year",
  email: string: "Student email",
  phone: number: "Student phone number",
  advisor: string: "Name of the student’s advisor",
  housing: string: "Student housing / fraternity / residence",
  bio: string: "Short student bio",
  Interests: array: "Student interests",
  Clubs: array: "Student clubs and societies",
  scholarships: array: "Scholarships the student receives (not all students have one)",
  Projects: object: "Various projects the student has worked on" [
    {
      title: string: "Project title",
      year: number: "Year of publication or completion",
      description: string: "Short description of the project",
      impact: string: "What impact the project had"
    }
  ]"
}
Enter fullscreen mode Exit fullscreen mode

Once you’re happy with the schema, click the Submit button.

Step 5 – Pick Your Favourite Variant

Below the editor, Damī will generate three variants of the data. Choose the one you like most and click the clipboard icon to copy it.

Pick Generated JSON data

Step 6 – Create data.js in Your App

Back in your project, create a new file at the root level called data.js - paste the data you just generated from Damī into this file and save it.

Create data.js file

Step 7 – Visit the University of Damī

Now, go to your browser and navigate to the University of Damī app. If you’re running it locally, the URL is: http://localhost:3000. Et voilà! You now have a working application with realistic data that you can show to your friends, coworkers, investors… or even your dog. 🐶

Dami university works!

Wrap-Up

If you learned something new today or enjoyed this exercise, please consider supporting us on GitHub with a star. It really helps us continue developing and improving Damī.

Mata ne! (またね)

Top comments (0)