Web Application whose goal is to allow to retrieve the list of available trips from a given bus stop & book the interesting ones.
You need Node.JS installed to be able to setup the project.
- Download or clone the repository
- Install dependencies with
npm install
command - Create
.env
file & fill its content using.env.sample
to set the right environment variables - Project is ready
Project is available online, click here to go there
Project bootstrapped with Create React App using the Redux and Redux Toolkit template.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
- UI: React with Typescript support
- State container: Redux
- Components library: Bootstrap & React-Bootstrap
- Tests: React Testing Library
- XHR Requests handler: axios
- Locales handler & Internationalization: i18next & react-i18next
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
Note: this is a one-way operation. Once you eject
, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject
at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject
will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use eject
. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
I tried to be as efficient as possible, but since I couldn't free much time to perform this test I had to do some compromises. So in order to finish it quickly I didn't implement all tests, avoiding the ones for UI components.
I let .env
to the project istead of adding it to .gitignore
& use .env.sample
.
I used Redux instead of contexts & hook to handle the app state as it's a part of your stack & did the same for Bootstrap.
Mandatory features are:
- Fetch the list of all bus stops
- Fetch the list of available trips depending on the departure bus stop
- Book a bus stop
I added some features in order to have a more efficient application:
- Requested trips are cached
- Limits API calls when an request has already been done
- Increases application speed when an already fetched list is requested again
- You can reset the cache & request the API for the last updates
- You can sort the received trips list
- 2 ways: sort by departure time or sort by bus stop name
- You can fetch the list of all available trips, not depending on a bus stop
- All trips are cached
- There is a list of your booked trips
- A trip can be booked only once
- You can cancel a book for a trip
- As there was not an endpoint to do this:
- I assumed the url was the same as book with the trip id, with
delete
HTTP method instead ofput
- I emulated API behaviour using
setTimeout
& didn' implement tests for this API method
- I assumed the url was the same as book with the trip id, with
- As there was not an endpoint to do this:
- I used an internationalization module to be able to add languages supports to the web app