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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ausdata/ui

v0.1.2

Published

Official React component library for searching Australian businesses using the Ausdata API. This package provides a ready-to-use `BusinessSearch` component that allows users to search for Australian businesses by name or ABN (Australian Business Number).

Readme

@ausdata/ui

Official React component library for searching Australian businesses using the Ausdata API. This package provides a ready-to-use BusinessSearch component that allows users to search for Australian businesses by name or ABN (Australian Business Number).

Note: @ausdata/ui is designed to work together with @ausdata/sdk. The UI components use the SDK internally to communicate with the Ausdata API.

npm version license


Features

  • 🔍 Business Search: Search Australian businesses by name or 11-digit ABN
  • 📊 Multiple Display Modes: Table and card layout variants
  • 🎨 Customizable Themes: Multiple visual themes (minimal, brand, light, dark, eye care)
  • 📄 Pagination: Built-in pagination with configurable page sizes (10, 25, 50 results per page)
  • 📱 Responsive Design: Works across different screen sizes
  • Accessible: Built with accessibility in mind (ARIA labels, semantic HTML)
  • TypeScript: Fully typed with TypeScript for better developer experience

Installation

@ausdata/ui requires @ausdata/sdk as a peer dependency. Install both packages together:

npm install @ausdata/ui @ausdata/sdk

Usage

Basic Example

import { BusinessSearch } from '@ausdata/ui';

function App() {
  const API_KEY = import.meta.env.VITE_AUSDATA_API_KEY ?? '';
  
  return (
    <div>
      <BusinessSearch apiKey={API_KEY} />
    </div>
  );
}

With Custom Configuration

import { BusinessSearch } from '@ausdata/ui';

function App() {
  const API_KEY = import.meta.env.VITE_AUSDATA_API_KEY ?? '';
  
  return (
    <BusinessSearch
      apiKey={API_KEY}
      variant="table"      // 'table' | 'card'
      tone="minimal"       // 'minimal' | 'brand' | 'light' | 'dark' | 'eye'
      dense={false}        // Compact mode
    />
  );
}

Component Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | apiKey | string | required | Your Ausdata API key | | baseUrl | string | '/api' | API base URL. Use full URL (e.g., 'https://api.ausdata.app/api/v1') for direct API calls, or /api if using a proxy | | variant | 'table' \| 'card' | 'table' | Layout style: table or card view | | tone | 'minimal' \| 'brand' \| 'light' \| 'dark' \| 'eye' | 'minimal' | Visual theme style | | dense | boolean | false | Compact mode with reduced spacing and font sizes |

Search Results

The component displays the following business information:

  • Name: Business name
  • ABN: 11-digit Australian Business Number
  • Status: Active, Cancelled, or Inactive
  • Type: Business entity type
  • Location: State and postcode
  • Industry: Business industry classification
  • ABN Status: ABN registration status
  • GST: GST registration status
  • Score: Match score (0-100) for search relevance

API Configuration

The component uses the @ausdata/sdk package internally to communicate with the Ausdata API. Both packages work together seamlessly—the UI component handles the presentation layer while the SDK manages all API interactions.

Base URL Configuration

The component automatically detects the environment and uses the appropriate base URL:

  • Next.js: Automatically uses /api (requires API route setup, see below)
  • Vite: Automatically uses /api (requires proxy configuration in vite.config.ts)
  • Other frameworks: Defaults to /api, but you can specify a full URL if needed
// Automatic (recommended) - component detects environment
<BusinessSearch apiKey={API_KEY} />

// Manual override if needed
<BusinessSearch 
  apiKey={API_KEY} 
  baseUrl="https://api.ausdata.app/api/v1" 
/>

Next.js Setup

For Next.js projects, create an API route at src/app/api/[...path]/route.ts:

import { NextRequest, NextResponse } from 'next/server';

export async function GET(
  request: NextRequest,
  { params }: { params: Promise<{ path: string[] }> }
) {
  return handleRequest(request, params, 'GET');
}

export async function POST(
  request: NextRequest,
  { params }: { params: Promise<{ path: string[] }> }
) {
  return handleRequest(request, params, 'POST');
}

async function handleRequest(
  request: NextRequest,
  params: Promise<{ path: string[] }>,
  method: string
) {
  const { path } = await params;
  const apiKey = process.env.AUSDATA_API_KEY || process.env.NEXT_PUBLIC_AUSDATA_API_KEY;
  const baseUrl = process.env.AUSDATA_BASE_URL || 'https://api.ausdata.app/api/v1';

  if (!apiKey) {
    return NextResponse.json(
      { success: false, error: { code: 'AUTH_001', message: 'API key is required' } },
      { status: 401 }
    );
  }

  const cleanPath = path.filter(p => p !== 'api').join('/');
  const apiPath = `/${cleanPath}`;
  const searchParams = request.nextUrl.searchParams.toString();
  const url = `${baseUrl}${apiPath}${searchParams ? `?${searchParams}` : ''}`;

  let body: string | undefined;
  if (method === 'POST') {
    try {
      body = await request.text();
    } catch {}
  }

  const response = await fetch(url, {
    method,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${apiKey}`,
      'X-API-Key': apiKey,
    },
    body: body || undefined,
  });

  const contentType = response.headers.get('content-type');
  if (contentType?.includes('application/json')) {
    const data = await response.json();
    return NextResponse.json(data, { status: response.status });
  } else {
    const text = await response.text();
    return NextResponse.json(
      { success: false, error: { code: `HTTP_${response.status}`, message: text || response.statusText } },
      { status: response.status }
    );
  }
}

Vite Setup

For Vite projects, add proxy configuration to vite.config.ts:

export default defineConfig({
  server: {
    proxy: {
      '/api': {
        target: 'https://api.ausdata.app',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '/api/v1'),
      },
    },
  },
});

Environment Variables

Set your API key via environment variable:

# For Vite projects
VITE_AUSDATA_API_KEY=your_api_key_here

# For Next.js projects
NEXT_PUBLIC_AUSDATA_API_KEY=your_api_key_here
NEXT_PUBLIC_AUSDATA_BASE_URL=https://api.ausdata.app/api/v1

Development

# Install dependencies
npm install

# Run development server
npm run dev

# Build for production
npm run build

# Preview production build
npm run preview

# Run linter
npm run lint

Project Structure

src/
  ├── App.tsx              # Main application component
  ├── BusinessSearch.tsx   # Business search component
  ├── main.tsx            # Application entry point
  └── App.css             # Component styles

Technologies

  • React 19: UI library
  • TypeScript: Type safety
  • Vite: Build tool and dev server
  • @ausdata/sdk: Ausdata API client

License

MIT © Ausdata Science

Support