Create a service that shows the user hotels near a specific location on a map.
The task is designed to assess your interest and experience. We want to see your code, your approach, and your talent.
To get the places, we recommend using the HERE Places API although you can use a different places service if you wish (e.g. Google or Foursquare).
The architecture will be split between a back-end and a web front-end, for instance providing a JSON in/out RESTful API. Feel free to use any other technologies provided that respects the client/service architecture.
Choose one of the following technical tasks that best suits your role:
- Back-end: write, document and test your API as if it will be used by other services. Include a minimal front-end (e.g. a static view) and an API docs.
- Front-end: focus on making the interface as polished as possible (e.g. hotel cards, map, list view). Include a minimal back-end, or use the
Here API
service directly. - Full-stack: include both front-end and back-end tasks.
We assume that you will use the web framework that will best meet the challenge requirements (JS or Python are a plus).
Here are some technologies we are more familiar with:
- JavaScript
- Python
- C#
- PostgreSQL
Choosing the right endpoints design is part of the task evaluation.
The front-end should ideally be a single page app. Please do not use any UI frameworks (e.g. Boostrap or Material Design) You may take this opportunity to demonstrate your CSS or HTML knowledge.
We are more familiar with:
- React or Angular
- TypeScript
When you’re done, host it somewhere (e.g. on Amazon EC2, Heroku..) and send us the git repo link giving also clear instructions about making it work locally.
In your app we'll be looking for:
- Completeness of solution - does the app work as per the requirements?
- Quality of code - is your code clean & well written?
- User interface - does the page look ok, does it look broken?
- Tests - What should be tested?
If you can't complete your app, give us a description of what you were planning / how you would approach it.
We're interested in your feedback, so do let us know what you thought of the task. Good luck and feel free to ask if there are any questions: devs@limehome.de
I am full-stack engineer, but have much more experience with backend and Django.
When I read the task I think that small API-proxy service is enough. And as for me asynchronous web-servers can handle such tasks with more performance, compared to Django or Flask.
That's why I implemented simple apiproxy
script that just uses HERE Maps API.
However I wanted to show more of my skills working with django
, django-rest-framework
and PostGIS
. And so I created 2nd version of backend - apistored
. It uses the same HERE API, but stores hotels in local DB.
Demo is available on the Heroku - https://ibestuzhev-lh-challenge.herokuapp.com/
This repo uses Pipenv
to manage requirements and virtual environment. You should install pipenv before installing python packages.
I used python 3.6.3
, so any later version will work. 3.5
will not work as f
-strings are used in project.
Also note that there is single Pipfile
to handle both aiohttp
and django
versions of backend.
I modified response from Here API to match response from Django's version
- Install dependencies with
pipenv install --dev
- Create
.env
file at root of the repo - Add 2 variables for Here API -
LH_MAPS_APP_ID
andLH_MAPS_APP_CODE
. Check Here guide on how to get credentials - Run
pipenv run apiproxy
This server also serves static files built by react app. So to see it fully running you need to check hotelmap
section below and run npm run build
.
For django
based version you need a little more of preparations.
This version uses GeoDjango to use filtering based on coordinates and distanc. You need to install geospatial libraries first.
You can consult Django's doc about Installing Geo Django and Installing geo libraries.
At minimum you need to set GDAL_DATA
env variable to correct path. And also gdal/bin
should be in your PATH
variable.
Also you need Redis to run celery and PostGIS to run DB. If you use docker you can run both with docker-compose up -d
After this you can do
pipenv install --dev
- Add the same
.env
file as forapiproxy
- Activate virtual env with
pipenv shell
cd apistored
python manage.py migrate
python manage.py runserver 8080
If you need celery, you can activate another pipenv shell
in 2nd terminal window, navigate to cd apistored
and run celery worker -A apistored
. Note on Windows you should also add --pool=solo
.
Current code calls the task syncronously, but there are settings for this behaviour in hotels/views.py
Things I would do if I want to prepare this for production:
runserver
is not production ready, so I will useuwsgi
- Nginx as reverse proxy, it should serve static from react
- Setup logging
- Integrate Sentry.io or Elastic App Monitor or ELK stack.
Frontend application build on react. You should have node installed.
I worked on node
11 and npm
6.
This code is built on top of react-script
.
You should run npm install
and after it you can use
npm start
to run dev server on localhost:3000
with hot-reload.
Please note that this server proxies api calls to localhost:8080
. So you should run apiproxy
or apistored
side-by-side with this server
npm run build
to build files under build
folder, ready for production.
Some things I'd implement for bigger project:
- Use SCSS
- Use Redux or Context if project get's bigger (deeper nesting of components)
- Add some loader when you search for new location
- I would search and replace
here-maps-react
with similap application. This one introduced several bugs with marker update. Sometimes Markers get out of sync, and some markers are removed from DOM but stays on map. There is a terrible fix with randomkey
, but even it sometimes fail - Move
package.json
to top level. Now there are two files, one is actual react script and second is for Heroku. And this does not allow Heroku to cache dependencies.