npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nigeria-geo-sdk

v1.1.0

Published

High-performance React Native SDK for comprehensive Nigerian geographic data including states, LGAs, wards, and postal codes. Optimized for fast response times with direct database access.

Readme

Nigeria Geo SDK for React Native

npm version License: MIT TypeScript

A high-performance React Native SDK for accessing comprehensive Nigerian geographic data including states, LGAs, wards, and postal codes. Optimized for fast response times with direct database access.

✨ Features

  • 🇳🇬 Complete Nigerian Geographic Data: All 37 states, 774 LGAs, 8,840+ wards, and postal codes
  • High Performance: Optimized API with < 500ms response times
  • 📱 Cross Platform: Works with React Native, Expo, and bare React Native projects
  • 🎯 Zero Configuration: Works out of the box with sensible defaults
  • 🔍 Powerful Search: Full-text search across all geographic entities
  • 📍 Location Services: Geographic data with postal codes
  • 🎨 TypeScript Support: Full TypeScript definitions included
  • 💾 Smart Caching: Built-in caching for better performance
  • 🔒 Type Safe: Complete TypeScript support with strong typing

📦 Installation

npm install nigeria-geo-sdk

With Yarn

yarn add nigeria-geo-sdk

With Expo

expo install nigeria-geo-sdk

🚀 Quick Start

Basic Usage (Zero Configuration)

import nigeriaGeoSDK from 'nigeria-geo-sdk';

// Get all Nigerian states
const states = await nigeriaGeoSDK.getStates();
console.log('States:', states);

// Get LGAs in a state
const lgas = await nigeriaGeoSDK.getLgasByState(states[0].id);
console.log('LGAs:', lgas);

// Get wards in an LGA
const wards = await nigeriaGeoSDK.getWardsByLga(lgas[0].id);
console.log('Wards:', wards);

// Search for locations
const results = await nigeriaGeoSDK.search('Lagos');
console.log('Search results:', results);

Complete React Native Example

import React, { useState, useEffect } from 'react';
import { View, Text, ScrollView } from 'react-native';
import nigeriaGeoSDK, { State, Lga, Ward } from 'nigeria-geo-sdk';

export default function App() {
  const [states, setStates] = useState<State[]>([]);
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    const loadStates = async () => {
      try {
        const data = await nigeriaGeoSDK.getStates();
        setStates(data);
      } catch (error) {
        console.error('Error loading states:', error);
      } finally {
        setLoading(false);
      }
    };

    loadStates();
  }, []);

  if (loading) {
    return <Text>Loading...</Text>;
  }

  return (
    <ScrollView>
      <Text style={{ fontSize: 18, fontWeight: 'bold' }}>
        Nigerian States ({states.length})
      </Text>
      {states.map((state) => (
        <Text key={state.id}>{state.name} ({state.code})</Text>
      ))}
    </ScrollView>
  );
}

📚 API Reference

Methods

getStates(): Promise<State[]>

Retrieves all Nigerian states.

const states = await nigeriaGeoSDK.getStates();

getLgasByState(stateId: string): Promise<Lga[]>

Retrieves all LGAs for a specific state.

const lgas = await nigeriaGeoSDK.getLgasByState('state-id');

getWardsByLga(lgaId: string): Promise<Ward[]>

Retrieves all wards for a specific LGA.

const wards = await nigeriaGeoSDK.getWardsByLga('lga-id');

search(query: string): Promise<SearchResult>

Searches across all geographic data.

const results = await nigeriaGeoSDK.search('Lagos');
// Returns: { states: [], lgas: [], wards: [], postal_codes: [] }

getPostalCodes(params?: PostalCodeParams): Promise<PostalCode[]>

Retrieves postal codes with optional filtering.

const postalCodes = await nigeriaGeoSDK.getPostalCodes({
  state: 'Lagos',
  limit: 10
});

Types

interface State {
  id: string;
  name: string;
  code: string;
  created_at: string;
  updated_at: string;
}

interface Lga {
  id: string;
  state_id: string;
  name: string;
  code: string;
  created_at: string;
  updated_at: string;
}

interface Ward {
  id: string;
  lga_id: string;
  name: string;
  code: string;
  created_at: string;
  updated_at: string;
}

interface PostalCode {
  id: string;
  code: string;
  area: string;
  state: string;
  lga?: string;
  created_at: string;
  updated_at: string;
}

interface SearchResult {
  states: State[];
  lgas: Lga[];
  wards: Ward[];
  postal_codes: PostalCode[];
}

⚙️ Configuration

The SDK works with zero configuration but can be customized:

import { ConfigLoader } from 'nigeria-geo-sdk';

// Load custom configuration
const config = await ConfigLoader.loadConfig('production');

// Custom configuration
const customConfig = {
  baseUrl: 'https://your-api-endpoint.com',
  timeout: 10000,
  enableCaching: true,
  enableLogging: false
};

🎨 UI Components Example

Create reusable dropdown components:

import React, { useState, useEffect } from 'react';
import { Picker } from '@react-native-picker/picker';
import nigeriaGeoSDK, { State, Lga, Ward } from 'nigeria-geo-sdk';

function StateDropdown({ onStateChange }) {
  const [states, setStates] = useState<State[]>([]);

  useEffect(() => {
    nigeriaGeoSDK.getStates().then(setStates);
  }, []);

  return (
    <Picker onValueChange={onStateChange}>
      <Picker.Item label="Select a state..." value="" />
      {states.map((state) => (
        <Picker.Item key={state.id} label={state.name} value={state.id} />
      ))}
    </Picker>
  );
}

🚀 Performance

  • Response Times: < 500ms for all API calls
  • Data Coverage: 100% of Nigerian geographic entities
  • Caching: Built-in intelligent caching system
  • Bundle Size: Minimal impact on your app size
  • Offline Support: Cached data available offline

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Support

⭐ If this SDK helped you, please give it a star on GitHub!

GitHub Sponsors

📊 Data Sources

This SDK provides access to official Nigerian geographic data including:

  • Federal Capital Territory and 36 States
  • 774 Local Government Areas (LGAs)
  • 8,840+ Electoral Wards
  • Comprehensive postal codes database

Made with ❤️ in Nigeria 🇳🇬