Skip to content

Latest commit

 

History

History
98 lines (71 loc) · 3.8 KB

File metadata and controls

98 lines (71 loc) · 3.8 KB

openSenseMap

This repository contains the code of the new openSenseMap frontend running at https://beta.opensensemap.org.

Originally, the openSenseMap was built as part of the bachelor thesis of @mpfeil at the ifgi (Institute for Geoinformatics, University of Münster). Between 2016 and 2022 development was partly funded by the German Ministry of Education and Research (BMBF) in the projects senseBox and senseBox Pro. This version has been developed by @mpfeil and @freds-dev.

Screenshot OSeM

Project setup

If you do need to set the project up locally yourself, feel free to follow these instructions:

System Requirements

Developing inside a DevContainer

Variables

You can configure the API endpoint and/or map tiles using the following environmental variables:

ENV Default value
OSEM_API_URL https://api.testing.opensensemap.org
DATABASE_URL <YOUR_POSTGRES_URL>
MAPBOX_ACCESS_TOKEN <YOUR_MAPBOX_ACCESS_TOKEN>

You can create a copy of .env.example, rename it to .env and set the values.

Setup Steps

  1. Clone the repo: git clone https://github.com/openSenseMap/frontend
  2. Copy .env.example into .env
  3. Run npm install to install dependencies
  4. Run npm run docker to start the docker container running your local postgres DB
  5. Run npm run build
  6. Run npm run dev to start the local server

Using a DevContainer

Simply open the project in Visual Studio Code. It should prompt and ask you if you would like to open the project in a DevContainer.

If you are not prompted hit Ctrl + Shift + P (Shift+Command+P on Mac) and select >DevContainers: Open Workspace in Container....

The DevContainer will now build (which will take a bit the first time your are doing this) and the window will reload. For convenience npm install and npm run build are executed for you on start.

Debugging

For users of Visual Studio Code there is a launch.json containing two options to debug the application:

  1. Debug
    • Starts the development task (npm run dev) and attaches to process
  2. Attach
    • Use when you have started the development task elsewhere already
    • Attaches to an existing task
    • You will be prompted with running tasks. Depending on your setup you may need to try a few until you find the correct one. Hint: Look out for the arguments of the tasks and choose the one that contains tsx watch

Debugging the application will allow you to set breakpoints and step through the code. Additionally, you may set logpoints to eliminate the need for console.log in your code for debugging purposes.

Contributing

We welcome all kind of constructive contributions to this project. Please have a look at CONTRIBUTING if you want to do so.

License

MIT - Matthias Pfeil 2015 - now