Below is a copy-paste-ready mini-project that you can finish in 10–15 minutes.
I will walk you through every single step and explain why each line exists.
────────────────────────
STEP 0 – What we are building
────────────────────────
A tiny web page that lives entirely in your browser (no server).
It lets you:
- Pick a date.
- Add exercises (name, sets, reps).
- Save the whole session.
- See every past session under “History”.
All data is stored in localStorage – it survives page reloads but stays on this computer only.
────────────────────────
STEP 1 – Create the folder & files
────────────────────────
- Make a folder on your desktop called
calisthenics-tracker.
- Inside create three empty files:
calisthenics-tracker/
├─ index.html
├─ style.css
└─ script.js
────────────────────────
STEP 2 – index.html (structure)
────────────────────────
Copy the code below into index.html.
I added comments so you can see what each tag does.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Calisthenics Tracker</title>
<!-- Link to our CSS file -->
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>Calisthenics Workout Tracker</h1>
<!-- === LOGGING SECTION === -->
<section id="log-section">
<label>Date:
<input type="date" id="date" />
</label>
<h3>Add Exercise</h3>
<input id="name" placeholder="Exercise name" />
<input id="sets" placeholder="Sets" type="number" min="1" />
<input id="reps" placeholder="Reps (e.g. 8,7,6)" />
<button id="add-btn">Add</button>
<ul id="current-list"></ul>
<button id="save-btn">Save Workout</button>
<p id="msg"></p>
</section>
<!-- === HISTORY SECTION === -->
<section id="history-section">
<h2>History</h2>
<ul id="history-list"></ul>
</section>
<!-- Link to our JavaScript file -->
<script src="script.js"></script>
</body>
</html>
────────────────────────
STEP 3 – style.css (quick styling)
────────────────────────
Paste into style.css. Nothing fancy—just enough to look tidy.
body {
font-family: Arial, sans-serif;
margin: 30px;
background: #f5f5f5;
}
h1, h2 {
text-align: center;
}
section {
max-width: 500px;
margin: 20px auto;
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0,0,0,.1);
}
input, button {
padding: 8px;
margin: 4px;
font-size: 1rem;
}
button {
cursor: pointer;
}
ul {
list-style: none;
padding: 0;
}
li {
padding: 6px 0;
border-bottom: 1px solid #eee;
}
────────────────────────
STEP 4 – script.js (all the logic)
────────────────────────
Paste into script.js. I kept the code short and added inline comments explaining every block.
/* ========== 1. Grab DOM nodes ========== */
const dateInput = document.getElementById('date');
const nameInput = document.getElementById('name');
const setsInput = document.getElementById('sets');
const repsInput = document.getElementById('reps');
const addBtn = document.getElementById('add-btn');
const currentList = document.getElementById('current-list');
const saveBtn = document.getElementById('save-btn');
const msg = document.getElementById('msg');
const historyList = document.getElementById('history-list');
/* ========== 2. Tiny helpers ========== */
// Read workouts from localStorage (or empty array if nothing there)
function loadWorkouts() {
return JSON.parse(localStorage.getItem('workouts') || '[]');
}
// Save array back to localStorage
function saveWorkouts(arr) {
localStorage.setItem('workouts', JSON.stringify(arr));
}
/* ========== 3. State for this session ========== */
let currentExercises = []; // holds {name, sets, reps}
/* ========== 4. Render current session ========== */
function renderCurrent() {
currentList.innerHTML = '';
currentExercises.forEach((ex, i) => {
const li = document.createElement('li');
li.textContent = `${ex.name} – ${ex.sets} sets, ${ex.reps} reps`;
const del = document.createElement('button');
del.textContent = '×';
del.onclick = () => {
currentExercises.splice(i, 1);
renderCurrent();
};
li.appendChild(del);
currentList.appendChild(li);
});
}
/* ========== 5. Render history ========== */
function renderHistory() {
const workouts = loadWorkouts();
historyList.innerHTML = '';
if (workouts.length === 0) {
historyList.innerHTML = '<li>No workouts yet.</li>';
return;
}
workouts.forEach(w => {
const li = document.createElement('li');
li.innerHTML = `<strong>${w.date}</strong>`;
const ul = document.createElement('ul');
w.exercises.forEach(ex => {
const sub = document.createElement('li');
sub.textContent = `${ex.name} – ${ex.sets} sets, ${ex.reps} reps`;
ul.appendChild(sub);
});
li.appendChild(ul);
historyList.appendChild(li);
});
}
/* ========== 6. Event – add exercise ========== */
addBtn.onclick = () => {
const name = nameInput.value.trim();
const sets = parseInt(setsInput.value, 10);
const reps = repsInput.value.trim();
if (!name || isNaN(sets) || !reps) {
alert('Fill all fields correctly.');
return;
}
currentExercises.push({ name, sets, reps });
renderCurrent();
nameInput.value = repsInput.value = setsInput.value = '';
nameInput.focus();
};
/* ========== 7. Event – save workout ========== */
saveBtn.onclick = () => {
const date = dateInput.value;
if (!date || currentExercises.length === 0) {
alert('Pick a date and add at least one exercise.');
return;
}
const workouts = loadWorkouts();
workouts.unshift({ date, exercises: [...currentExercises] }); // newest first
saveWorkouts(workouts);
// Reset UI
currentExercises = [];
renderCurrent();
renderHistory();
msg.textContent = 'Workout saved!';
setTimeout(() => (msg.textContent = ''), 2000);
};
/* ========== 8. Init ========== */
// Set today as default date
dateInput.valueAsDate = new Date();
renderHistory(); // show anything already stored
────────────────────────
STEP 5 – Open it
────────────────────────
- Double-click
index.html.
- Your browser opens the page.
- Try adding a few exercises and hit Save Workout.
- Refresh the page – your history is still there.
────────────────────────
How it works (quick recap)
────────────────────────
- HTML gives the page structure (inputs, buttons, lists).
- CSS makes it look nicer.
- JavaScript
– Keeps the current session in the currentExercises array.
– Uses localStorage (a simple key-value store inside your browser) to persist workouts.
– Reads (loadWorkouts) and writes (saveWorkouts) JSON strings.
– Re-renders the lists whenever data changes.
That’s it—your private, offline calisthenics tracker is ready!