A month ago I bought a card called "Avantages Jeunes" (Junior Advantages), made by my region for people below 30 years old.
It can be used in many shops, restaurants, activities... to get promotions. I discovered that there was a web application to look for advantages.
So I decided to use their API to make me a cleaner mobile application, with more functionalities !
The app concept
All you need is your card: just add your card using your credentials.
In the interface you can view suggested advantages, liked ones, your card, your profile and also open a map that show every advantage around you !
There is also a search function.
The reflexion time
Most of the data I needed can be simply got by calling the web application private API.
So I opened HTTPie (a requester), my browser's developer tools on network tab and started trying to reproduce requests.
The map functionality was a bit more complicated... No endpoint can return advantages based on a geo-position.
But I found an endpoint that return a complete list of all advantages, with their address !
I coded a python script that retrieve all the advantages and found their coordinates based on their address (using Gecoding API) and store them in a MongoDb database.
Using MongDb Geospatial 2dsphere index, I have could request database for all the documents which their coordinates field is in a circle of precise center and radius ! MongoDB is so powerful !
The app structure
I used IonicFramework to develop a web based frontend that can be compiled to mobile using a bridge.
The frontend part directly calls the orginal private API except to get advantages around phone's position: it calls a Fastapi server that return advantages in a radius of 1, 5, 10 or 50 kilometers around the position, by using the MongoDb database.
Result
You can found this project at camarm-dev/bfc-avantagesjeunes-mobile
Top comments (0)