IP Geo-Location: Local Database vs. Remote API—Finding the Middle Ground With Atlas

8 May 2024

Imagine you're tasked with implementing a geo-fencing feature for your service. At first glance, dropping in an IP GeoLocation API might seem straightforward, but often, project constraints or requirements complicate the simplest solutions. Let's explore our options.

Local GeoIP Database Implementation

This method involves embedding a geolocation database directly within your application. It offers fast response times as it resides in-memory and operates independently of external services. However, this approach can be resource-intensive and harder to manage. Let’s see it in more detail.


  • Speed: IP lookups in milliseconds or less.
  • Reliability: No reliance on third-party services reduces failure chances.
  • Scalability: No extra costs as usage grows.


  • Resource Intensive: Each app instance consumes significant memory.
  • More Dependencies: Requires packages for decoding and looking up GeoIP data.
  • Challenging Updates: Updates require manual intervention or another self-hosted service.

Using External GeoIP APIs (Often Paid)

Opting for a third-party API to handle geolocation queries reduces your application's resource load and ensures access to the most current data, but it comes with its own challenges:


  • Minimal Resource Use: Outsourcing GeoIP data and logic doesn't burden your app's resources.
  • Ease of Implementation: Usually involves consuming a standard HTTP/GraphQL or gRPC API endpoint.
  • Fewer Dependencies: Often only requires an HTTP client.
  • Updates without hassle: Third-party will handle updates


  • Slower Responses: Calls to third-party services can introduce significant latency.
  • Increased Unreliability: Greater likelihood of failures due to network issues or third-party downtimes.
  • Scaling Costs: Costs can escalate as usage increases.

Introducing Atlas: Combining the Best of Both Worlds

Faced with these challenges, I developed Atlas—a robust solution designed to synergize the benefits of both approaches. Atlas acts as a self-hosting HTTP service that automatically manages and serves the latest MaxMind geolocation databases, providing:

  • Low Latency: Similar to local databases, Atlas offers rapid response times. (often in a few milliseconds)

  • Reliability and Ease of Updates: It autonomously handles database updates, removing the typical maintenance burdens.

  • Cost Efficiency: No additional costs with scale in terms of third-party fees.

  • Dead-Simple API: A very simple API that lets you implement quicker and focus on what matters.

  • Open and Free: Atlas is Open Source and freely available under Apache-2.0 License.

By hosting Atlas closer to your application but operating like a remote API, it offers a middle ground that maximizes efficiency without the drawbacks of either method we have discussed.

Why Rust? Safe, Performant, and Resource-Efficient

Atlas is written in Rust, a language chosen for its unparalleled safety, performance, and resource efficiency. Rust's ownership model ensures memory safety without the need for a garbage collector, which is particularly advantageous during database updates—these operations consume minimal memory, avoiding the typical overhead associated with garbage-collected languages.

This design choice not only boosts Atlas's performance but also enhances its reliability, making it an ideal solution for managing GeoIP data efficiently and safely.

How to Deploy and Use Atlas?

Atlas Docker images are automatically built and pushed to Docker Hub via GitHub Actions, making it easy for anyone to use. For detailed instructions on using these Docker images or building Atlas from source and configuration parameters, please refer to the Atlas README.md.

Atlas features a straightforward API, documented with OpenAPI 3.0 Specs. You can access the API documentation from the public internet here: https://atlas-rs.fly.dev/swagger-ui/.

Here’s an example of how you can use curl to query the demo instance of Atlas (hosted publicly thanks to Fly.io and the GeoLite2 MaxMind database license) to retrieve country information for an IP address

> curl https://atlas-rs.fly.dev/geoip/lookup/country/ | jq
  "results": {
    "": {
      "country": {
        "iso_code": "US",
        // additional fields...
      // additional results...
  "database_build_epoch": 1715091859

Please note that this demo instance is intended only for demonstration and documentation purposes.

Join the Atlas Community and Contribute

As a newly introduced open-source project, Atlas is in the early stages of building its community. I am excited about the potential for Atlas to evolve and thrive with contributions from developers like you. Whether you're interested in refining functionality, adding new features, or simply improving documentation, your contributions are welcome and greatly valued.

How You Can Contribute

  1. Try Atlas: The best way to start is by using Atlas in your projects. Experiment with it, identify any issues, and suggest improvements based on your real-world usage.

  2. Report Issues: If you encounter any bugs or issues while using Atlas, please report them on the GitHub issues page. This feedback is crucial for continual improvement.

  3. Suggest Features: Have ideas for new features or enhancements? Open a discussion on the GitHub repository or contribute directly by submitting a pull request.

  4. Improve Documentation: As Atlas evolves, so too does the need for clear and comprehensive documentation. Whether it's enhancing the current content or writing tutorials and guides, your knowledge-sharing is invaluable.

  5. Spread the Word: If you find Atlas useful, consider sharing it within your networks. Blog about your experiences, talk about Atlas at meetups, or share it on social media.

Commitment to Open Source

I am relatively new to Rust but bring many years of experience from other technology stacks. This project presents a great opportunity for more experienced Rust developers to contribute, ensuring that Atlas adheres to Rust's best practices and conventions since I know that it is not as good as it can be right now.

I am committed to maintaining Atlas as a community-driven project and believe in open, collaborative development. I am eager to see how the community will shape Atlas's path forward and encourage you to join me in this journey, helping to build a tool that serves the needs of developers globally.

In the end, I would like to give a special thanks to oschwald for creating the rust maxminddb crate which made Atlas possible.

Future Directions

As we continue to develop and improve Atlas, my vision is to create a robust, user-friendly minimal service. As of today, Atlas only supports MaxMind databases, but it would be beneficial to have an extensible implementation so more and more formats can be supported.

Another aspect I would like to pay attention to is adding more endpoint types such as gRPC so that users can choose the best endpoint based on their requirements and needs.

Thank you for taking the time to learn about Atlas. I am excited to see where we can take this project with your support and collaboration!