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

@ali7040/ng-signal-query

v0.0.2

Published

[![npm version](https://img.shields.io/npm/v/@ali7040/ng-signal-query?style=flat-square)](https://www.npmjs.com/package/@ali7040/ng-signal-query) [![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-lightpink?style=flat-square)](https://github.com/

Readme

🎯 ng-signal-query

npm version Sponsor License: MIT Angular TypeScript

A powerful, type-safe querying library for Angular applications built with signals. Manage server state, infinite queries, mutations, and caching with elegance and performance.

✨ Features

  • 🚀 Signal-Driven Architecture - Leverage Angular signals for reactive state management
  • 🔄 Server State Management - Queries, mutations, and automatic caching
  • Infinite Queries - Seamless pagination with automatic data accumulation
  • 🎯 Type-Safe - Full TypeScript support with strict typing
  • 🛠️ DevTools Integration - Built-in debugging component for development
  • 📦 Lightweight - Minimal bundle size with zero external dependencies (except Angular & RxJS)
  • 🔌 Adapter Pattern - Custom adapters for different HTTP clients
  • 💾 Smart Caching - Automatic query result caching with configurable strategies
  • 🌐 SSR Ready - Server-side rendering support with hydration

📦 Installation

npm install @ali7040/ng-signal-query

Or with yarn:

yarn add @ali7040/ng-signal-query

Or with pnpm:

pnpm add @ali7040/ng-signal-query

🐙 GitHub Packages

You can also publish/install this package from GitHub Packages.

Publish to GitHub Packages

  1. Create a GitHub Personal Access Token (classic) with:
  • write:packages
  • read:packages
  • repo (only if repository is private)
  1. Login to GitHub npm registry:
npm login --scope=@ali7040 --auth-type=legacy --registry=https://npm.pkg.github.com
  1. Publish:
npm run release:github

Install from GitHub Packages

npm install @ali7040/ng-signal-query --registry=https://npm.pkg.github.com

Requirements

  • Angular >= 21.1.0
  • TypeScript >= 5.9
  • RxJS >= 7.8

🚀 Quick Start

1. Import the Module

import { QueryClient } from '@ali7040/ng-signal-query';

@Component({
  selector: 'app-root',
  template: `
    <div *ngIf="users(); else loading">
      <div *ngFor="let user of users()">{{ user.name }}</div>
    </div>
    <ng-template #loading>Loading...</ng-template>
  `,
  standalone: true,
})
export class AppComponent {
  private queryClient = inject(QueryClient);

  users = this.queryClient.createQuery({
    queryKey: ['users'],
    queryFn: () => fetch('/api/users').then(r => r.json()),
  });
}

2. Create Queries

// Simple query
const users = this.queryClient.createQuery({
  queryKey: ['users'],
  queryFn: () => this.http.get('/api/users'),
  staleTime: 5 * 60 * 1000, // 5 minutes
});

// Parametized query
const user = signal('1');
const userDetails = this.queryClient.createSignalQuery({
  queryKey: computed(() => ['user', user()]),
  queryFn: async () => this.http.get(`/api/users/${user()}`),
});

3. Create Mutations

const createUser = this.queryClient.createMutation({
  mutationFn: (data: User) => this.http.post('/api/users', data),
  onSuccess: () => {
    this.queryClient.invalidateQueries(['users']);
  },
});

// Use in template
<button (click)="createUser.mutate({ name: 'John' })">
  {{ createUser.status() === 'pending' ? 'Creating...' : 'Create User' }}
</button>

4. Infinite Queries

const infiniteUsers = this.queryClient.createInfiniteQuery({
  queryKey: ['users', 'infinite'],
  queryFn: ({ pageParam = 0 }) =>
    this.http.get(`/api/users?page=${pageParam}`),
  getNextPageParam: (lastPage) => lastPage.nextCursor,
});

// Load more
<button (click)="infiniteUsers.fetchNextPage()">
  Load More
</button>

📚 API Documentation

QueryClient

Main service for managing all queries and mutations.

// Create a query
createQuery(options: CreateQueryOptions)

// Create a signal-based query
createSignalQuery(options: CreateSignalQuery)

// Create an infinite query
createInfiniteQuery(options: CreateInfiniteQueryOptions)

// Create a mutation
createMutation(options: CreateMutationOptions)

// Invalidate queries
invalidateQueries(queryKey: QueryKey)

// Refetch queries
refetchQueries(queryKey: QueryKey)

// Clear all caches
clearCache()

Query State

interface QueryState {
  data: TData | null;
  error: Error | null;
  status: 'pending' | 'error' | 'success';
  isLoading: boolean;
  isError: boolean;
  isSuccess: boolean;
}

Mutation State

interface MutationState {
  data: TData | null;
  error: Error | null;
  status: 'idle' | 'pending' | 'error' | 'success';
  isPending: boolean;
  isError: boolean;
  isSuccess: boolean;
}

🔧 Development

Building

npm run build

Running Tests

npm run test

Running Examples

npm run start

Browse to http://localhost:4200

🛠️ Examples

Check the examples directory for complete working examples:

📖 DevTools

Monitor your queries and mutations in real-time:

import { SignalQueryDevtoolsComponent } from '@ali7040/ng-signal-query';

@Component({
  selector: 'app-root',
  template: `
    <app-main></app-main>
    <signal-query-devtools *ngIf="isDev"></signal-query-devtools>
  `,
  imports: [SignalQueryDevtoolsComponent],
})
export class AppComponent {
  isDev = !environment.production;
}

🚀 Live Testing

Try the library in action:

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for detailed instructions.

📄 License

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

🙏 Acknowledgments

📮 Support

❤️ Sponsor

If you want to support this project, you can sponsor ongoing development:

🔗 Useful Links


Made with ❤️ by Ali

Running end-to-end tests

For end-to-end (e2e) testing, run:

ng e2e

Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.

Additional Resources

For more information on using the Angular CLI, including detailed command references, visit the Angular CLI Overview and Command Reference page.