Note: This project is a work in progress
Live demo available at https://open-api-search.herokuapp.com/
This project is a Ruby on Rails demo of interacting with a public Cryptocurreny News API and displaying trending coin news to the end user. The following features have been implemented:
-
Create a page where a public user can do a keyword search and view results
-
A sidebar that shows past searches anyone has done, with a count of how many times it has been run
-
Search history only shows unique searches
-
Search history is sortable by date/count/search term
-
Performing a search displays past information about that search (list of all the previous times that term was searched)
-
Clicking on a past search should run it again
This service has dependencies on the following services:
- Ruby
2.4.4
- MongoDB
- Redis
- Sidekiq
Follow the Docker Getting Started guide to get docker
and docker-compose
. This project contains helper scripts to build and test services.
- Run the test suite:
$ script/test
To start the application using docker compose locally:
- Start the services:
$ docker-compose up --build
- Access via browser:
$ open http://localhost:3000
To start the application from project folder:
- Start Redis:
$ redis-server
- Start Sidekiq:
$ bundle exec sidekiq
- Start App:
$ rails s
- Access via browser:
$ open http://localhost:3000
MongoDB was used in order to store third-party API responses in the collections.
docker-compose run app rake db:mongoid:create_indexes
(Docker)db:mongoid:create_indexes
(Local)
Variable | Description | Default |
---|---|---|
MONGODB_URI |
MongoDB URI | mongodb://localhost:27017/crypto_news_development |
REDIS_CACHE_URL |
Redis Cache URL (NOT USED CURRENTLY) | redis://localhost:6379/0 |
REDIS_WORKER_URL |
Redis Worker URL (NOT USED CURRENTLY) | redis://localhost:6379/1 |
DB_MAX_CONNECTIONS |
Mongo Max Connections | 16 |
DB_MIN_CONNECTIONS |
Mongo Min Connections | 5 |
DB_WAIT_QUEUE_TIMEOUT |
DB Queue Timeout | 5 |
DB_CONNECT_TIMEOUT |
DB Connection Timeout | 10 |
DB_SOCKET_TIMEOUT |
DB Socket Timeout | 5 |
CRYPTO_CONTROL_API_KEY |
Crypto Control Api Key | - |
- DB Indexes on Search#keywords for faster queries and to not query the whole DB for each request
- Cache external results so the API is not being hit every request
- Autocomplete for Search feature to prevent invalid search terms from occurring
- Test frequency of new articles to determine if scheduled jobs for popular search terms are beneficial
- Search may not need the results saved. Storage can be reduced greatly if not needed
- Specs: Due to time constraints, I decided to forgo testing the UI portion. Requests have been tested, but more detailed testing should be added.
- Design.. I used this opportunity to test out the Materialize front-end component library and didn't get a chance to do a deep dive of the design components.