[go: up one dir, main page]

0% found this document useful (0 votes)
50 views10 pages

Full Stack Interview Assignment

The document outlines an assignment to design and implement a Bus Booking System using React for the frontend and Node/Bun/Deno for the backend. It includes submission guidelines, evaluation criteria, and detailed requirements for both frontend and backend functionalities, such as bus search, seat selection, and booking confirmation. Additionally, it specifies the necessary endpoints for the backend and provides sample requests and responses for clarity.

Uploaded by

hamildheen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views10 pages

Full Stack Interview Assignment

The document outlines an assignment to design and implement a Bus Booking System using React for the frontend and Node/Bun/Deno for the backend. It includes submission guidelines, evaluation criteria, and detailed requirements for both frontend and backend functionalities, such as bus search, seat selection, and booking confirmation. Additionally, it specifies the necessary endpoints for the backend and provides sample requests and responses for clarity.

Uploaded by

hamildheen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Full Stack Interview Assignment

Bus Booking System


Objective:
Design and implement a simple Bus Booking System that allows users to search for buses
between locations, view available seats, and book tickets.

The frontend should be built with React, and the backend with Node/Bun/Deno.

Assignment Submission Guidelines:


1. Submission Deadline: Please submit your assignment within 10 days of receipt.
2. Contact for Doubts/Requests: If you have any questions or need assistance, please reach
out to us at careers@appweave.tech.
3. Repository Setup:
Create a private GitHub repository for your project. (Important)
Add the user appweave-labs (GitHub: github.com/appweave-labs) to your repository.
4. Hosting:
Host your frontend on a platforms like https://app.netlify.com/ , https://vercel.com/ or any
similar service.
Host your frontend on a platforms like https://render.com/ , https://www.koyeb.com/ or
any similar service.
Host your DB on a platforms like https://www.mongodb.com/cloud/atlas, https://tembo.io/
or any similar service.
5. Submission Email:
Once your submission is ready, share the links to your GitHub repository (Add user to
repo) and live website by sending an email to careers@appweave.tech.
Use the following subject line for your email: [Your Name]: Full Stack Developer
Intern Assignment . Make sure to replace [Your Name] with your actual name to help
us identify your submission.

By following these guidelines, you can ensure that your submission process is smooth and
organized. Good luck with your assignment!

Evaluation Criteria:
1. Code Quality: Clean, well-structured, and easy-to-read code.
2. TypeScript Usage: Proper use of types and interfaces for type safety.
3. Functionality: Meeting all the core requirements and handling edge cases.
4. UI/UX: Simple and intuitive user experience.
5. Bonus Points:
1. Seat Reservation Timer:
Implement a 2-minute timer that locks selected seats for that period, after which the
seats become available again if not booked.
2. Responsive Design:
Ensure the UI is responsive and works well on both desktop and mobile devices.
3. Error Handling:
Handle edge cases like invalid inputs, full buses, and seat unavailability.

Requirements:

Frontend

Home Page:

A form where users can input:


Departure city
Arrival city
Date of travel
A Search button that triggers a search request.

Sample:

Bus List Page:


Filter Section (Left Sidebar):
Seat Type:
Users can filter by seat types:
"Normal"
"Semi-Sleeper"
"Sleeper"
AC/NON-AC:
Users can choose between:
"AC"
"NON-AC"
Departure Slots:
Users can filter buses by departure time slots:
Morning: 6 AM - 12 PM
Afternoon: 12 PM - 4 PM
Evening: 4 PM - 8 PM
Night: 8 PM - 6 AM
Display a list of buses with:
Bus name
Departure time
Arrival time
Available seats
Price
AC/Non AC
Bus Type (Normal/Semi-Sleeper/Sleeper)
A “Book Now” button next to each bus entry.
Pagination/Infinite Loading (Optional)
Seat Selection Page:
A UI where users can select available seats.
Display the total price based on selected seats.

Booking Confirmation Page:

A form to fill in passenger details (name, age, gender).


A button to “Confirm Booking.”
Bus Details
Booking Summary

Backend

The backend will have several endpoints to handle bus search, seat availability, and bookings.
Here are the suggested endpoints along with sample demo data.|

Important Note:
You do not need to implement endpoints for authentication, nor for creating, updating, or deleting
buses, routes, or bus layouts, as these can be manually populated in the database. Additionally,
any endpoints related to user management, booking history retrieval, or admin panel functionalities
are also considered out of scope for this assignment.

Endpoints:

1. GET /api/buses
Description: Returns a paginated list of buses based on the filters (seat type, AC/NON-AC, and
departure slots) and query parameters for pagination.
Parameters:
- Required Filters:
- departureCity (string): The city from which the bus departs.
- arrivalCity (string): The city to which the bus is traveling.
- date (string): The travel date (format: YYYY-MM-DD ).
- Optional Filters:
- seatType (string): Filter buses by seat type ("normal", "semi-sleeper", "sleeper").
- normal
- semi-sleeper
- sleeper
- isAC (boolean): Filter buses by AC or NON-AC ( true for AC, false for NON-AC).
- true
- false
- departureSlot (string): Filter buses by the departure time slots:
- morning (6 AM - 12 PM)
- afternoon (12 PM - 4 PM)
- evening (4 PM - 8 PM)
- Night (8 PM - 6 AM)
- Pagination Parameters:
- page (number, optional, default = 1): The current page of results.
- pageSize (number, optional, default = 10): The number of buses to return per page.

Sample Request:

GET /api/buses?departureCity=Bangalore&arrivalCity=Chennai&date=2024-09-
25&seatType=sleeper&isAC=true&departureSlot=Morning&page=1&pageSize=10

Sample Response:

{
"page": 1,
"pageSize": 10,
"totalPages": 5,
"totalBuses": 50,
"buses": [
{
"id": "b2587d1c-29f8-4b0f-a01c-1e2f9f5b7a61",
"name": "KSRTC Airavat",
"stops": [
{
"stopName": "Bangalore",
"departureTime": "09:00 AM"
},
{
"stopName": "Hosur",
"arrivalTime": "10:00 AM",
"departureTime": "10:15 AM"
},
{
"stopName": "Vellore",
"arrivalTime": "01:00 PM",
"departureTime": "01:15 PM"
},
{
"stopName": "Chennai",
"arrivalTime": "03:00 PM"
}
],
"availableSeats": 10,
"price": 1000,
"seatTypes": [
"normal"
],
"isAC": true
},
{
"id": "c12f7da0-99c7-4b19-9eb0-dbe5e5c5bf9d",
"name": "SRS Travels",
"stops": [
{
"stopName": "Bangalore",
"departureTime": "12:00 PM"
},
{
"stopName": "Krishnagiri",
"arrivalTime": "01:30 PM",
"departureTime": "01:45 PM"
},
{
"stopName": "Vellore",
"arrivalTime": "04:00 PM",
"departureTime": "04:15 PM"
},
{
"stopName": "Chennai",
"arrivalTime": "06:00 PM"
}
],
"availableSeats": 5,
"price": 600,
"seatTypes": [
"normal"
],
"isAC": false
}
]
}

2. GET /api/buses/:busId
Description: Returns the seat layout and availability for a specific bus.
Path Parameters:

busId (string): The unique identifier for the bus.

Seat Layout Schema:

Each seat includes:


seatNumber (number): Unique seat number.
isAvailable (boolean): Availability status.
row (number): Row position of the seat.
column (number): Column position of the seat.
seatType (string): "normal", "semi-sleeper", or "sleeper".
sleeperLevel (string, optional): "upper" or "lower" (only applicable for sleeper seats).

Sample Response:

{
"id": "b2587d1c-29f8-4b0f-a01c-1e2f9f5b7a61",
"name": "KSRTC Airavat",
"availableSeats": 10,
"price": 1000,
"seatTypes": [
"normal"
],
"isAC": true,
"stops": [
{
"stopName": "Bangalore",
"departureTime": "09:00 AM"
},
{
"stopName": "Hosur",
"arrivalTime": "10:00 AM",
"departureTime": "10:15 AM"
},
{
"stopName": "Vellore",
"arrivalTime": "01:00 PM",
"departureTime": "01:15 PM"
},
{
"stopName": "Chennai",
"arrivalTime": "03:00 PM"
}
],
"seats": [
{
"seatNumber": 1,
"isAvailable": true,
"row": 1,
"column": 1,
"seatType": "normal"
},
{
"seatNumber": 2,
"isAvailable": false,
"row": 1,
"column": 2,
"seatType": "normal"
},
{
"seatNumber": 3,
"isAvailable": true,
"row": 2,
"column": 1,
"seatType": "normal",
},
{
"seatNumber": 4,
"isAvailable": true,
"row": 2,
"column": 2,
"seatType": "normal",
},
{
"seatNumber": 5,
"isAvailable": true,
"row": 3,
"column": 1,
"seatType": "normal"
},
{
"seatNumber": 6,
"isAvailable": false,
"row": 3,
"column": 2,
"seatType": "normal"
}
]
}

3. POST /api/bookings

Description: Books the selected seats for a user.

Body Parameters:

busId (string): ID of the bus.


seats (array of numbers): Selected seat numbers.
passengerDetails (array of objects): List of passengers and their details.
[
{
"name": "Rahul",
"age": 25,
"gender": "male"
},
{
"name": "Sneha",
"age": 23,
"gender": "female"
}
]

Sample Response:

{
"message": "Booking successful",
"id": "b2587d1c-29f8-4b0f-a01c-1e2f9f5b7a61",
"seatsBooked": [13, 14],
"totalPrice": 2000
}

You might also like