How to Organize Workout Routines by Muscle Group Using the Exercises Dataset

You can organize workout routines by muscle group by filtering the category or muscle_group fields in data/exercises.json from the Exercises Dataset repository.

The Exercises Dataset repository by hasaneyldrm provides a structured collection of 1,324 fitness exercises with rich metadata including muscle groups, equipment requirements, and multilingual instructions. By leveraging the standardized fields in the dataset, you can programmatically group exercises to build targeted workout routines for specific body parts. This guide demonstrates how to query and filter the dataset using Python, JavaScript, TypeScript, and SQL to create muscle-specific training plans.

Understanding the Dataset Schema and Key Fields

The core data resides in data/exercises.json, a single JSON array containing all exercise records. Each entry follows the formal schema defined in data/exercises.schema.json, which guarantees the presence of specific fields useful for muscle-group organization.

The three primary fields for grouping workouts are:

  • category – The primary body part targeted (e.g., chest, upper arms, back).
  • muscle_group – The primary synergist muscle group (e.g., hip flexors).
  • secondary_muscles – An array of additional muscles involved in the movement.

Every record in the dataset includes these fields, making it reliable for automated routine generation. The repository also includes an interactive browser in index.html for manual exploration and a developer guide in setup.html for importing the data into databases.

Grouping Exercises by Muscle Group in Python

To organize workout routines programmatically, load data/exercises.json and group entries using the category field. The following snippet uses defaultdict to cluster exercises by their primary muscle target:

import json
from collections import defaultdict

# Load the JSON data

with open("data/exercises.json", "r", encoding="utf-8") as f:
    exercises = json.load(f)

# Group exercises by their primary muscle category

by_muscle = defaultdict(list)
for ex in exercises:
    by_muscle[ex["category"]].append(ex)

# Example: print the number of exercises per muscle group

for muscle, items in by_muscle.items():
    print(f"{muscle.title():15}: {len(items)} exercises")

This approach produces a distribution such as 292 exercises for Upper Arms, 227 for Upper Legs, and 203 for Back.

To build a specific routine, filter by both muscle group and equipment. For example, to create a barbell-only chest workout:


# Select only chest exercises that require a barbell

chest_barbell = [
    ex for ex in by_muscle["chest"]
    if ex["equipment"].lower() == "barbell"
]

# Show the first three exercise names

print([ex["name"] for ex in chest_barbell[:3]])

Building Muscle-Specific Routines in JavaScript and TypeScript

For Node.js applications, you can group exercises using Array.prototype.reduce on the muscle_group field:

const exercises = require("./data/exercises.json");

// Group by muscle_group
const groups = exercises.reduce((acc, ex) => {
  const key = ex.muscle_group || "unspecified";
  acc[key] = acc[key] || [];
  acc[key].push(ex);
  return acc;
}, {});

// Log counts per group
Object.entries(groups).forEach(([muscle, list]) => {
  console.log(`${muscle.padEnd(20)}: ${list.length}`);
});

For type-safe applications, define an interface matching the schema in data/exercises.schema.json and filter accordingly:

import exercises from "./data/exercises.json";

interface Exercise {
  id: string;
  name: string;
  category: string;
  muscle_group: string;
  equipment: string;
  instructions: Record<string, string>;
}

// Build a routine that targets "Upper Legs" with body-weight work
const upperLegBodyweight = (exercises as Exercise[])
  .filter(e => e.category === "upper legs" && e.equipment === "body weight")
  .map(e => e.name);

console.log("Upper-Leg Bodyweight Routine:", upperLegBodyweight);

Querying Muscle Groups with SQL

If you import the dataset into a SQL database using the scripts generated by setup.html, you can organize routines with standard SQL queries. For PostgreSQL, the following query counts exercises per muscle category:

SELECT category, COUNT(*) AS exercise_count
FROM exercises
GROUP BY category
ORDER BY exercise_count DESC;

This allows you to quickly identify which muscle groups have the most exercise variety when planning weekly split routines.

Summary

  • The Exercises Dataset stores 1,324 exercises in data/exercises.json with guaranteed fields for category, muscle_group, and equipment.
  • Use the category field for broad muscle-part splits (e.g., chest, back) and muscle_group for specific synergist targeting.
  • Filter by the equipment field to create gym-specific or body-weight-only routines.
  • The dataset supports Python, JavaScript, TypeScript, and SQL workflows, with schema validation available in data/exercises.schema.json.
  • Reference setup.html for database import scripts and index.html for an interactive browser to preview muscle groups.

Frequently Asked Questions

What is the difference between the category and muscle_group fields?

The category field represents the broad body part targeted by an exercise, such as upper arms or back, while muscle_group specifies the primary synergist muscle, such as hip flexors or biceps. Use category for general workout splits and muscle_group for more granular biomechanical targeting.

How do I filter exercises by equipment when organizing by muscle group?

After grouping exercises by category or muscle_group, filter the resulting array or query by the equipment field. This field contains values like barbell, dumbbell, or body weight, allowing you to generate routines that match available gym equipment.

Can I use the dataset to generate multilingual workout instructions?

Yes, each exercise record contains an instructions object that maps language codes to step-by-step directions. When organizing routines by muscle group, you can extract the appropriate language key from this object to display instructions in your preferred language.

Where can I find the interactive browser for exploring muscle groups?

The repository includes a client-side browser in index.html that loads data/exercises.json and supports live search and filtering by muscle group. Open this file in any modern web browser to explore the dataset without writing code.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →