Welcome to the Geolocation App! This application allows users to fetch and manage geolocation data using a robust API.
- User registration and authentication
- API key management
- Geolocation fetching based on user input
- Swagger documentation for the API
- Multiple providers support. New providers can easily added. Current implementations is for ipstack
- Ruby on Rails
- PostgreSQL
- RSpec for testing
- Docker for containerization
- Swagger for API documentation
To run this application, you'll need:
- Ruby (version 3.2.0)
- Rails (version 7.0.8)
- PostgreSQL (version 14)
- Docker
git clone https://github.com/Haseeb717/geolocation_api
cd geolocation_app
Copy the example environment variables file and edit it with your Stripe credentials:
cp .env_example .env
Edit .env with your Stripe keys:
IPSTACK_API_KEY: Your IPSTACK api key. You can get it from api-keys on IPSTACK website
DATABASE_USERNAME: Your Postgresql username
DATABASE_PASSWORD: Your Postgresql password
DATABASE_NAME: Database name you wanna add
DATABASE_HOST: Localhost or Db host ip
bundle install
rails db:create
rails db:migrate
Run the rails server on console with port 3000:
rails s -p 3000
docker-compose build
docker-compose up
docker-compose run web rails db:create
docker-compose run web rails db:migrate
Access the application: Open your browser and go to http://localhost:3000.
The API documentation is available via Swagger. You can access it at http://localhost:3000/api-docs after starting the application. This documentation includes all the available endpoints and their usage.
Execute the test suite:
bundle exec rspec