Learn how to build an online test booking platform with v0. Follow our step-by-step guide for setup, design, and smooth implementation.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
This step explains how to create a fresh v0 project for your online test booking system. In v0 you start by creating a new project with the required files. The following files will be used in this example:
In your v0 project workspace, create these three files.
This step creates the form that users will interact with to book their online test. Open your index.html file and paste the following HTML code. This code defines input fields like full name, email address, test date, and a dropdown for the test type.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Online Test Booking</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h2>Book Your Online Test</h2>
<form id="bookingForm">
<div>
<label for="fullName">Full Name:</label>
<input type="text" id="fullName" name="fullName" required>
</div>
<div>
<label for="email">Email Address:</label>
<input type="email" id="email" name="email" required>
</div>
<div>
<label for="testDate">Test Date:</label>
<input type="date" id="testDate" name="testDate" required>
</div>
<div>
<label for="testType">Test Type:</label>
<select id="testType" name="testType" required>
<option value="" disabled selected>Select a test</option>
<option value="Math">Math</option>
<option value="Science">Science</option>
<option value="Language">Language</option>
</select>
</div>
<button type="submit">Book Now</button>
</form>
<script src="script.js"></script>
</body>
</html>
This code should be the complete content of your index.html file.
To improve the user experience, add some basic styling. Open your style.css file and paste the following CSS code. This code centers the form and adds simple styling to input fields and buttons.
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f2f2f2;
margin: 0;
}
form {
background: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
div {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input, select {
width: 100%;
padding: 8px;
box-sizing: border-box;
}
button {
width: 100%;
padding: 10px;
background-color: #4285f4;
color: #fff;
border: none;
border-radius: 3px;
cursor: pointer;
}
button:hover {
background-color: #357ae8;
}
This CSS creates a neat and responsive layout for your booking form.
This step integrates the JavaScript logic to handle form submissions. Open your script.js file and paste the following code. This script listens for form submissions, gathers booking data, and then simulates a save action (for example, sending the data to a server or storing in local storage).
document.addEventListener("DOMContentLoaded", function() {
var bookingForm = document.getElementById("bookingForm");
bookingForm.addEventListener("submit", function(event) {
event.preventDefault(); // Prevent the default form submission
// Retrieve values from form inputs
var fullName = document.getElementById("fullName").value;
var email = document.getElementById("email").value;
var testDate = document.getElementById("testDate").value;
var testType = document.getElementById("testType").value;
// Create an object to store the booking information
var bookingData = {
fullName: fullName,
email: email,
testDate: testDate,
testType: testType
};
// This is where you would normally send bookingData to your backend API.
// For demonstration, we will output the data in the console.
console.log("Booking Data Submitted:");
console.log(bookingData);
// Provide a simple confirmation for the user
alert("Thank you, " + fullName + ". Your booking for a " + testType + " test on " + testDate + " has been received.");
// Optionally, clear the form after submission
bookingForm.reset();
});
});
This JavaScript code should be the entire content of your script.js file. It captures the booking details and, in a real application, you would replace the console log with an API call to save the booking data.
Since v0 does not offer a terminal for installing dependencies, any external libraries must be included by adding their references directly in your code. If you need any special libraries (for example, a date-picker or an HTTP library), include them in the HTML file within the head section. An example is provided below for including a library from a CDN.
<!-- Place this inside the <head> tag of your index.html file if you want to include an external library -->
<script src=";
If no external libraries are needed, you can skip this step. The built-in browser APIs and vanilla JavaScript should be sufficient for this basic implementation.
After creating and saving the three files (index.html, style.css, and script.js), you are ready to test your application. Simply open the index.html file in your browser using v0’s preview feature.
This completes the detailed step-by-step guide on building an online test booking system with v0. No terminal commands were needed because all dependencies and libraries (if any) were included directly in your code files.
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.json());
// Sample data model for online test bookings
// Each test has an id, a name, and a structure for available slots
let tests = [
{
id: 1,
name: 'Entrance Exam',
availableSlots: [
{ slot: '2023-11-01T09:00:00Z', capacity: 5, bookings: [] },
{ slot: '2023-11-01T13:00:00Z', capacity: 5, bookings: [] }
]
},
{
id: 2,
name: 'Practice Test',
availableSlots: [
{ slot: '2023-11-02T10:00:00Z', capacity: 10, bookings: [] },
{ slot: '2023-11-02T15:00:00Z', capacity: 10, bookings: [] }
]
}
];
// Utility function to check if a slot is available for booking
function isSlotAvailable(slotObj, userId) {
return slotObj.bookings.length < slotObj.capacity && !slotObj.bookings.includes(userId);
}
// Endpoint to list all tests with slots
app.get('/api/tests', (req, res) => {
res.json(tests);
});
// Endpoint to book a slot for a specific test
app.post('/api/book', (req, res) => {
const { testId, slotTime, userId } = req.body;
if (!testId || !slotTime || !userId) {
return res.status(400).json({ error: 'Missing required parameters.' });
}
const test = tests.find(t => t.id === testId);
if (!test) {
return res.status(404).json({ error: 'Test not found.' });
}
const slotObj = test.availableSlots.find(slot => slot.slot === slotTime);
if (!slotObj) {
return res.status(404).json({ error: 'Slot not found.' });
}
if (!isSlotAvailable(slotObj, userId)) {
return res.status(409).json({ error: 'Slot is fully booked or user already booked this slot.' });
}
slotObj.bookings.push(userId);
res.json({ message: 'Booking successful', test });
});
// Start the server on port 3000 or environment port
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(Server is running on port ${PORT});
});
const express = require('express');
const axios = require('axios');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.json());
let bookings = [];
// Endpoint to create a booking and notify an external calendar service
app.post('/api/confirm-booking', async (req, res) => {
const { userId, testId, slotTime } = req.body;
if (!userId || !testId || !slotTime) {
return res.status(400).json({ error: 'Missing required parameters.' });
}
// Simulate storing booking in a local database
const bookingId = bookings.length + 1;
const booking = { bookingId, userId, testId, slotTime };
bookings.push(booking);
try {
// Call external API (e.g., calendar service) to schedule the booking event
const response = await axios.post('', {
userId: userId,
summary: Test Booking ${testId},
start: slotTime,
duration: 60 // Booking event duration in minutes
});
res.json({
message: 'Booking confirmed and external event created.',
booking,
externalEvent: response.data
});
} catch (error) {
res.status(500).json({ error: 'External API call failed.', details: error.message });
}
});
const PORT = process.env.PORT || 3001;
app.listen(PORT, () => {
console.log(Server is running on port ${PORT});
});
const express = require('express');
const nodemailer = require('nodemailer');
require('dotenv').config();
const app = express();
app.use(express.json());
let testData = [
{
testId: 101,
testName: 'Advanced Mathematics',
slots: [
{ time: '2023-12-01T10:00:00Z', capacity: 3, bookings: ['userA', 'userB'] },
{ time: '2023-12-01T14:00:00Z', capacity: 3, bookings: [] }
]
}
];
function sendCancellationEmail(recipient, testName, time) {
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: { user: process.env.EMAILUSER, pass: process.env.EMAILPASS }
});
const mailOptions = {
from: process.env.EMAIL\_USER,
to: recipient,
subject: Cancellation for ${testName},
text: Your booking for ${testName} at ${time} has been cancelled successfully.
};
transporter.sendMail(mailOptions, (err, info) => {
if (err) console.error('Email error:', err);
});
}
app.post('/api/cancel-booking', (req, res) => {
const { testId, time, userId, email } = req.body;
if (!testId || !time || !userId || !email) {
return res.status(400).json({ error: 'Missing required parameters.' });
}
const test = testData.find(t => t.testId === testId);
if (!test) return res.status(404).json({ error: 'Test not found.' });
const slot = test.slots.find(s => s.time === time);
if (!slot) return res.status(404).json({ error: 'Slot not found.' });
const userIndex = slot.bookings.indexOf(userId);
if (userIndex === -1) return res.status(404).json({ error: 'Booking not found for user.' });
slot.bookings.splice(userIndex, 1);
sendCancellationEmail(email, test.testName, time);
res.json({ message: 'Booking cancelled successfully.', test });
});
const PORT = process.env.PORT || 4000;
app.listen(PORT, () => {
console.log(Server is running on port ${PORT});
});

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
This guide explains best practices for building an online test booking platform using v0. The guide is written for non-technical users, using simple language and clear steps to help you understand every part of the process.
Below is a sample code snippet that demonstrates a simple backend using a Python framework. This example sets up a route that processes booking requests. Replace comments with plain text explanations inside triple quotes to avoid restricted symbols.
from flask import Flask, request, jsonify
app = Flask(name)
"""This endpoint receives booking requests from users and processes the booking details."""
@app.route("/bookTest", methods=["POST"])
def book\_test():
data = request.get\_json()
"""Extract the user's booking information from the submitted data."""
booking\_id = "TEST-" + data.get("user", "unknown")
"""Create a unique booking ID by combining a prefix with the user's name or a default value."""
return jsonify({"message": "Booking confirmed", "bookingId": booking\_id})
if name == "main":
app.run(host="0.0.0.0", port=5000)
Create a simple web page that allows users to enter their booking details. This page collects necessary information and sends it to your backend.
Online Test Booking
Book Your Test
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Block quote
Ordered list
Unordered list
Bold text
Emphasis
Superscript
Subscript
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Block quote
Ordered list
Unordered list
Bold text
Emphasis
Superscript
Subscript
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Block quote
Ordered list
Unordered list
Bold text
Emphasis
Superscript
Subscript
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Block quote
Ordered list
Unordered list
Bold text
Emphasis
Superscript
Subscript

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Block quote
Ordered list
Unordered list
Bold text
Emphasis
Superscript
Subscript
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.