cli-path
My first attempt at building a CLI tool
Project maintained by iosifv
Hosted on GitHub Pages — Theme by mattgraham
đź“ź cli-path
A simple CLI tool to search paths on google maps. The intent is to use this on your most often taken paths to quickly get the grasp of the time needed for your travel - like going home from the office every day.
Online links for this project
- website - Github Pages
- github - Github repository
- npm - NPM Package for the cli app
- OpenAPI schema - View API specs with Swagger UI
- todo: serverless function dashboard
Installation
or
These will add the global executable clip
Usage
Authentication
To use our built in api, select the “Authentication” option from the interactive menu.
Searching raw text
Then you can search for a direction informaiton using free text
Save new locations
Searching from saved locations
Config
Update application config parameters
Programming Concepts / Technologies used
The real reason I built this is for training purposes. Since every tutorial out there is trying to teach you how to increase one certain skill vertically, with this project I’m trying to expand vertically by touching as many technologies possible for this humble subject of making a Google Maps API call 🙂
Architecture
The very zoomed out explanation is: a cli-app will call Google Maps API to view directions information within the terminal. In order to not have the user generate and add his own Google Maps tokens a new API is built which stands in between the cli-app and Google API. This way the user can choose to use our instantly available Clip API or Google Maps API with his own credentials.
List of implemented things
- CLI App written in Javascript
- API implemented with Serverless Framework written in Typescript
- Authentification provided by Auth0
- Implemented Device Authorization Flow - This way, the user just needs to open a link from a browser rather than cumbersome authentication in the CLI
- Implemented OAuth with Google, Github, Linkedin and Facebook as providers
- Insomnia and Postman for api testing - synced repository, so you only need to point to this repo and you get all the endpoints
- Github Actions
- A static page is created and deployed for this page you’re reading through Github Pages & Actions
- VHS for demo-ing the CLI app.
- Could be used for integration testing (if the gif looks ok in the final product then all is good)
- 👷 🚧 OpenAPI specification
List of todo’s
- Add dynamoDB connection
- save number of calls for each user
- Limit calls globally and per user
- Serverless Prune Plugin
- Terraform
- Create npm package through Github Actions
- Create system for versioning
Problems encountered that are worth mentioning
Just to be clear, these are worth mentioning to my future self so that I don’t do these mistakes again
- reading package.json with the purpose of showing the app’s version
- The actual issue is finding the package.json file when executing the binary from various folders in the user’s machine
- Deploying the authentication sls function which works fine locally
- Invalid model specified: Validation Result: warnings : [], errors : [Invalid model schema specified]
- The problem for this was leaving within the schema definition
required: [],
instead of deleting the required field completely
- Forgot to add scope(s) to the request token call
- This way, later in the execution, when calling auth0_api/userinfo an empty object is returned
Links that helped me build this