{"id":18256940,"url":"https://github.com/mediacomem/smapshot-api","last_synced_at":"2025-04-04T18:30:50.828Z","repository":{"id":36968127,"uuid":"362761879","full_name":"MediaComem/smapshot-api","owner":"MediaComem","description":"API behind the crowdsourcing platform smapshot","archived":false,"fork":false,"pushed_at":"2024-04-10T13:43:13.000Z","size":4356,"stargazers_count":3,"open_issues_count":4,"forks_count":4,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-04-10T15:33:11.336Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MediaComem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-04-29T09:27:30.000Z","updated_at":"2024-04-15T14:39:26.634Z","dependencies_parsed_at":"2023-02-10T22:31:27.710Z","dependency_job_id":"4b4a71ab-e82f-4a4d-ab95-6981a5889a36","html_url":"https://github.com/MediaComem/smapshot-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fsmapshot-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fsmapshot-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fsmapshot-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fsmapshot-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MediaComem","download_url":"https://codeload.github.com/MediaComem/smapshot-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247229135,"owners_count":20904991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T10:24:14.624Z","updated_at":"2025-04-04T18:30:49.796Z","avatar_url":"https://github.com/MediaComem.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# smapshot api\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Project description](#project-description)\n- [Initial setup](#initial-setup)\n- [Develop with Docker Compose (recommended)](#develop-with-docker-compose-recommended)\n    - [Requirements](#requirements)\n    - [Setup](#setup)\n    - [Run the application](#run-the-application)\n    - [Run the automated tests](#run-the-automated-tests)\n    - [Useful commands](#useful-commands)\n- [Develop locally](#develop-locally)\n    - [Setup](#setup-1)\n    - [Run the application](#run-the-application-1)\n    - [Run the automated tests](#run-the-automated-tests-1)\n- [Development guide](#development-guide)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Project description\n\nSmapshot is a crowdsourcing platform to geolocalize historical images in 3 dimension.\nProduction version is available at https://smapshot.heig-vd.ch\n\nThis project contains the code of the smapshot API available live at https://smapshot.heig-vd.ch/api/v1/\nThe online documentation is available at https://smapshot.heig-vd.ch/api/v1/docs/\n\n## Initial setup\n\n### Fetch (or ask for) a database dump\n\n* As root on the production server:\n  * `cp /data/backups/smapshot-backend/smapshot_database_daily/{datetime of the previous day}/smapshot_database_daily.tar /tmp/`\n* As username on your local machine, run the following steps:\n  * `scp {username}@{servername-or-ip}:/tmp/smapshot_database_daily.tar /home/{username}/Download/`\n  * `cd /home/{username}/Download/`\n  * `tar -xvf smapshot_database_daily.tar`\n  * `cd ./smapshot_database_daily/databases/`\n  * `gzip -d PostgreSQL.sql.gz`\n  * `rm /home/{username}/Download/smapshot_database_daily.tar`\n### Set your environment\n\n* Copy the `.env.sample` file to `.env` and adapt it to your local environment.\n  * Especially set up Facebook and Google OAuth credentials.\n  * Set up the `DUMP_FILE` variable to reference the previousely fetched PostgreSQL database dump, e.g. `/home/{username}/Downloads/smapshot_database_daily/databases/PostgreSQL.sql`.\n\n  \u003e If you are developing with Docker Compose, you do not need to configure the database connection, as the database is created and configured for you.\n* You can download sample images from [the Switch\n  drive](https://drive.switch.ch/index.php/apps/files/?dir=/Smapshot/Sample%20Data\u0026fileid=1891746707).\n  Unzip the contents of the `data.zip` file into the `public/data` directory in this repository.\n\n* A super admin demo account is created in the database during the intialization. It can be used to login in the API using the following information:\n  * first_name: Frank\n  * last_name: Dulin\n  * email: super_admin@smapshot.ch\n  * username: super_admin\n  * password: super_admin\n\n## Develop with Docker Compose (recommended)\n\n### Requirements\n\n* [Docker](https://www.docker.com/) 18.09+.\n* [Docker Compose](https://docs.docker.com/compose/) 1.24+.\n\n### Setup\n\nCreate and migrate the database:\n\n```bash\nnpm run compose:migrate\n```\n\n### Run the application\n\nCommand                   | Description\n:------------------------ | :------------------------------------------------------------------\n`npm run compose:app`     | Start the application and install dependencies the first time.\n\nVisit http://localhost:1337/docs/ once the application has started.\n\n### Run the automated tests\n\nCommand                         | Description\n:------------------------------ | :-------------------------------------------------------------------------\n`npm run compose:test`          | Run the test suite.\n`npm run compose:test:coverage` | Also generate a test coverage report (slower) in the `coverage` directory.\n`npm run compose:test:debug`    | Run the test suite with verbose logs to help debug issues.\n\n### Useful commands\n\nCommand                                  | Description\n:--------------------------------------- | :----------------------------------------------------------------------------------------------------------------\n`docker compose up --build app`          | Run the application in the foreground (this is what `npm run compose` does).\n`docker compose up --build --detach app` | Run the application in the background.\n`docker compose stop`                    | Stop all containers.\n`docker compose down`                    | Stop and remove all containers (but keep the data).\n`docker compose down --volumes`          | Stop and permanently delete all containers and data.\n`docker compose exec app \u003ccommand\u003e`      | Execute a command inside the running `app` container (e.g. `docker compose exec app npm install my-new-package`).\n`docker compose ps`                      | List running containers.\n\n\u003e Running the application with `docker compose up` will also automatically\n\u003e re-generate the API documentation and re-run the linter on code changes.\n\n## Develop locally\n\nYou will need:\n\n* A [PostgreSQL](https://www.postgresql.org) 13+ server with the\n  [PostGIS](https://postgis.net) extension.\n* [Node.js](https://nodejs.org) 18.x.\n* [Python](https://www.python.org) 3+ and the\n  [pip](https://pypi.org/project/pip/) package installer.\n\n### Setup\n\n* Install Node.js dependencies:\n  * Run `npm ci` on a fresh clone.\n  * Or, run `npm install` to install new dependencies.\n* Intall required Python tools:\n\n  ```bash\n  pip3 install opencv-python numpy scipy pymap3d\n  ```\n* Install the submodule\n  ```\n  git submodule update --init --recursive\n  ```\n* Create an empty database:\n\n  ```bash\n  psql\n  \u003e CREATE DATABASE smapshot;\n  ```\n\n* If you are using PostGIS 3+, you must also manually create the postgis and postgis_raster extensions before migrating the database:\n\n  ```\n  \\connect smapshot\n  CREATE EXTENSION postgis;\n  CREATE EXTENSION postgis_raster;\n  ```\n\n* Migrate the database (assuming you have the correct database configuration in\n  your `.env` file):\n\n  ```bash\n  npm run migrate\n  ```\n\n\n### Run the application\n\n* Run `npm start` to start the server once.\n* Or, run `npm run dev` to start it with live reload. It will also keep the API\n  documentation up to date and lint the code when it changes.\n\nThen visit http://localhost:1337.\n\n### Run the automated tests\n\nCreate a separate test database, called `smapshot-test` by default. You can\noverride the test database settings (e.g. `DB_NAME`, `DB_HOST`) in a `.env.test`\nfile similar to your `.env` file.\n\nCommand                 | Description\n:---------------------- | :-------------------------------------------------------------------------\n`npm test`              | Run the test suite.\n`npm run test:coverage` | Also generate a test coverage report (slower) in the `coverage` directory.\n`npm run test:debug`    | Run the test suite with verbose logs to help debug issues.\n`npm run test:watch`    | Automatically run the tests when code changes.\n\n## Development guide\n\nRead [the development guide](./DEVELOPMENT.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediacomem%2Fsmapshot-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmediacomem%2Fsmapshot-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediacomem%2Fsmapshot-api/lists"}