My implementation of Solita Dev Academy Finland 2023 pre-assignment. App has PostgreSQL database, TypeScript server and React frontend. App displays data about bike stations and journeys done with Helsinki city bikes.
(I used Windows 10 and 11 operating systems)
- Clone this git repository
- Install Docker Desktop v.4.16.3 (probably other versions work too) and keep it open
- Open command prompt and pull docker image for postgresql with command
docker pull postgres
(Postgre version 15.1-1.pgdg110+1) - Create and run postgres container and user with command
docker run --name postgresql -e POSTGRES_USER=myusername -e POSTGRES_PASSWORD=mypassword -p 5432:5432 -d postgres
- Start the container if not already
- Run command
npm install
in directoriescity-bike-app/backend
andcity-bike-app/frontend
- Set environment variables to .env files in
city-bike-app/backend
directory and make surecity-bike-app/frontend/src/services/services.js
file has same port in the api url (4000 by default).
(I will leave .env file to the repository because this app is only run locally right now so it is easier to initialize the app. Unless you changed the PostgreSQL container's credentials or other settings, the current .env values should be good. If the app is run online, database credentials should be changed and .env keep hidden.)
- Download the journey data and station data from its original sources.
For the exercise download three datasets of journey data. The data is owned by City Bike Finland.
- https://dev.hsl.fi/citybikes/od-trips-2021/2021-05.csv
- https://dev.hsl.fi/citybikes/od-trips-2021/2021-06.csv
- https://dev.hsl.fi/citybikes/od-trips-2021/2021-07.csv
Also, there is a dataset that has information about Helsinki Region Transport’s (HSL) city bicycle stations.
- Place journeys .csv files to directory
city-bike-app/backend/data/journeys
and station data to directorycity-bike-app/backend/data/stations
- In
city-bike-app/backend
directory run the commandnpm run initdb
to create the database tables and send the data from .csv files to database. Journeys data will be also filtered. Make sure that the container is running. Initializing the database will take few minutes (about 2 mins on my laptop).
- Start backend with command
npm run dev
in directorycity-bike-app/backend
- Start frontend with comman
npm start
in directorycity-bike-app/frontend
- Go to http://localhost:3000/ to test the app.
All the recommended features plus pagination for journey and station view. No tests have been done.
TypeScript for backend, PostgreSQL for database and React for frontend.