Travel Scheduling and Calendar
A travel planner with a custom booking calendar that highlights selections without shifting the layout, plus a contact form that saves enquiries to MySQL.

I built this with HTML, CSS, and vanilla JavaScript on the frontend (no frameworks), plus a Node.js + Express backend and a MySQL database. Users can search destinations, send a contact form that's saved to MySQL, and book time slots on a custom-built calendar.
CSS ::before for the calendar highlights
On the calendar, each date and month needs a rounded highlight for hover, active, and selected states. Instead of adding extra HTML elements, I used a ::before pseudo-element on each <li>. It's positioned behind the text with z-index: -1 and centered with transform.
.days li {
position: relative;
z-index: 1;
}
.days li::before {
position: absolute;
content: "";
height: 30px;
width: 25px;
top: 50%;
left: 50%;
z-index: -1;
border-radius: 25px;
transform: translate(-50%, -50%);
}Each state then only changes the pseudo-element, so the layout never shifts:
.days li:hover::before {
box-shadow: 2px 2px 4px 0px rgb(211, 210, 210);
}
.days li.clicked {
color: white;
}
.days li.clicked::before {
background-color: #111111;
}The text color changes on the li itself, and the dark circle behind it comes from ::before. The month selector uses the same technique.
Contact Form
The form is plain HTML with required fields and a type="email" input for built-in validation:
<form id="contact-form">
<label for="name">Name</label>
<input id="name" type="text" placeholder="John Doe" required />
<label for="email">Email</label>
<input id="email" type="email" placeholder="johndoe@gmail.com" required />
<label for="message">Message</label>
<textarea id="message" required></textarea>
</form>On submit, JavaScript prevents the page reload, picks the API URL based on whether it's running locally or in production, and sends the data as JSON. It then shows a success or error message:
document.getElementById('contact-form').addEventListener('submit', async function(e) {
e.preventDefault();
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const message = document.getElementById('message').value;
const apiURL =
(window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1"
? "http://localhost:5000/contactus"
: "https://travelrecommendation-tl40.onrender.com/contactus"
);
const res = await fetch(apiURL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name, email, message })
});
if (res.ok) {
responseMsg.textContent = "Message sent successfully!";
document.getElementById('contact-form').reset();
}
});On the backend, an Express route validates the fields again, then saves the message to MySQL. It uses a parameterized query (? placeholders) to prevent SQL injection:
app.post('/contactus', async (req, res) => {
const { name, email, message } = req.body;
if (!name || !email || !message) {
return res.status(400).json({ message: "All fields are required." });
}
const sql = "INSERT INTO contactus (name, email, message) VALUES (?, ?, ?)";
const [result] = await db.query(sql, [name.trim(), email.trim(), message.trim()]);
return res.status(201).json({ id: result.insertId, message: "Form submitted successfully!" });
});CORS is limited to an allowlist of my own frontend domains.
What I learned
- Building UI states with CSS pseudo-elements instead of extra markup
- Sending form data with
fetchand handling success and error responses - Validating on both the client and the server
- Connecting a vanilla JS frontend to an Express + MySQL backend and deploying the two separately