Skip to content

System structure & Tech Stack

JG edited this page Sep 29, 2023 · 3 revisions

System structure

Structure

The system consists of the following:

  • Data Retrieval: GPS data is collected by multiple sources. On the one hand the system provides endpoints and management based functions for permanent physical trackers that can be mounted on the vehicles itself. During development two types of Oyster 3 GPS trackers were tested and evaluated: LoRaWAN & LTE. On the other hand GPS data can be collected from app instances. These data sets will be handled anonymously and will only be sent if the mobile device is in a specific range of a track. For development purposes these GPS data can also be simulated via the vehicle simulator.

  • Backend: The server is used to collect, store, compute and deliver data in the system. Retrieved data gets stored in the database, used for calculations and then served via the API. For that the database access is defined as a standalone service in Server/src/service/database.service.ts. Every other service in the same folder is used for calculation of data and every service can be accessed via the API which is defined in Server/src/routes/. For more information to these specific components, please refer to the wiki-pages for each topic.

  • Frontend: Data gets delivered to the end user via an administrative website for track owners and via an app for vehicle drivers. Both instances retrieve data to visualize tracks, vehicles and system based statistics. The app is hereby only concerned about the current position of the own and other nearby vehicles as well as track specific data to warn the user. The administrative website on the other hand retrieves all the data so that track owners can manage their tracks, vehicles, trackers and other track related data.


Tech stack

During development the following technologies were used

Hardware

  • Oyster 3 GPS Tracker were used and evaluated during development in two distinguished variants: LoRaWAN & LTE. They are battery-powered GPS trackers by Digital Matter.
  • Python 3.11 is an interpreted, object-oriented, high-level programming language with dynamic semantics and was used to implement the vehicle simulator.

Backend

  • TypeScript is a strongly typed programming language that builds on JavaScript and was used as the main programming language for this project.
  • Express.js is the core framework of the API in the backend. It is a stable, very popular framework. In its core it runs single-threaded JavaScript. RailTrail uses the TypeScript version of ExpressJS to obtain some type-safety.
  • JSON Web Tokens (JWT) are a simple way and the industry standard to authenticate users. They can also be used to safely store session-information. E.g. usernames can be stored within the JWTs and read out whenever needed (providing the knowledge of the access token secret).
  • Zod is our go to library for schema validation. It allows advanced types and can automatically infer TypeScript types.
  • Turf is a javascript library that includes many operations for geospatial analysis and working with GeoJSON. It allows projecting points onto lines and converting between different GeoJSON-types.
  • Prisma is an allround ORM with automated migrations and type-safety.

Frontend

Website

  • Next.js is a React Framework that includes Server Side Rendering (SSR), routing and some other features to create full-stack Web applications.

  • Tailwind CSS is a collection of many CSS utility classes that are only included in the production build of the web page if they are actually used. This allows for a coherent, flexible styling directly within the markup, without having to write custom CSS classes.

  • Leaflet is a lightweight JavaScript library for displaying interactive maps. It is very easy to integrate the default OpenStreetMap style, but other map styles and map providers can be included as well. This map can then be extended with overlays like icons, or a line drawing a GeoJSON path.

  • SWR is a client-side, caching fetching library for React. In this project it is mainly used to regularly update changing data, like vehicle positions, without reloading the whole page.

App

  • React Native is a JavaScript library for building user interfaces for Android and iOS projects.
  • Expo is a framework which expands react native with a few tools and services.