---
description: How to define and use queries in Triplit.
---

# Defining queries

Data in Triplit is organized into collections, so to define a query you must first specify which collection you want to query.

For example, if you want to query the `users` collection, you would write the following:

```typescript
const query = client.query('users');
```

## Using queries

This query object is a builder that allows you to specify (and then reuse) a query. To fetch data you must use a method like [`fetch`](/client/fetch) or [`subscribe`](/client/subscribe), or if you're using a query in a frontend component, you can [use one of the Triplit-provided hooks](/frameworks).
