🚫 This project is no longer maintained
The Location Tracker Server is a Node.js application to be used in conjunction with the Location Tracker app.
The Location Tracker Server connects to IBM Cloudant and provides RESTful APIs for creating/managing users and creating/querying locations using Cloudant Geo.
The Location Tracker app supports offline-first, Cloudant Sync, and is implemented on a database-per-user architecture. When a user registers, a specific database is created for that user and is used to track only that user's locations. In addition, the server configures continuous replication for each user-specific database into a consolidated database where all locations can be queried. See the architecture diagram below for more information:
When you install the Location Tracker Server three databases will be created in your Cloudant instance:
- lt_locations_all - This database is used to keep track of all locations. When a user registers, a specific database will be created to track locations for that user. Each user-specific database will be configured to continuously replicate into the lt_locations_all database.
- lt_places - This database contains a list of places that the Location Tracker app will query.
- lt_users - This database is used to manage users. Each user will have a username, password and information regarding the location database for that specific user.
The lt_locations_all
and lt_places
database will each be created with a geo index allowing you to make geo queries and take advantage of the integrated map visuals in the Cloudant Dashboard. The lt_places
database will be populated with 50 sample places that follow the path of the "Freeway Drive" debug location setting in the iOS simulator:
Follow the instructions below to get the Location Tracker Server up and running locally or on IBM Cloud. Once you are finished follow the instructions to download and run the Location Tracker app.
The fastest way to deploy this application to IBM Cloud is to click the Deploy to IBM Cloud button below.
Don't have an IBM Cloud account? If you haven't already, you'll be prompted to sign up for a IBM Cloud account when you click the button. Sign up, verify your email address, then return here and click the the Deploy to IBM Cloud button again. Your new credentials let you deploy to the platform and also to code online with IBM Cloud and Git. If you have questions about working in IBM Cloud, find answers in the IBM Cloud Docs.
Clone this project and change into the project directory:
$ git clone https://github.com/ibm-cds-labs/location-tracker-server-nodejs.git
$ cd location-tracker-server-nodejs
The Node.js service requires a Cloudant instance. If you haven't already done so provision a new Cloudant instance in IBM Cloud. Create a .env file in the root folder of the project. One environment variable, VCAP_SERVICES
, is needed in order to configure your local development environment. The value of the VCAP_SERVICES
is a string representation of a JSON object and must include a Cloudant definition called cloudant-location-tracker-db
. Here is an example .env
file:
VCAP_SERVICES={"cloudantNoSQLDB": [{"name": "cloudant-location-tracker-db","label": "cloudantNoSQLDB","plan": "Lite","credentials": {"username": "your-username","password": "your-password","host": "your-host","port": 443,"url": "https://your-username:your-password@your-host"}}]}