# Time tracking

> Time entries with one running timer per member and no overlaps, on any record, billable with a rate. Weekly timesheets go through approvals, and a submitted or approved week is locked.

- Category: People
- Module: `time-entries`
- Modes: `managed`, `custom`
- Docs: https://bettersupabase.com/docs/blocks/time-entries
- Page: https://bettersupabase.com/blocks/time-entries

## Install

```bash
npx better-supabase add time-entries
```

The command also installs `updated-at`, `memberships`, `permissions`, `approvals`, `housekeeping`.

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Required by time-entries; add installs them too.
    "updated-at": {},
    memberships: {},
    permissions: {},
    approvals: {},
    housekeeping: {},
    // Modes: "managed", "custom". The default is "managed".
    "time-entries": { mode: "managed" },
  },
});
```

## Client

The block has no React entry yet. Its server-side TypeScript is in `better-supabase/blocks/time-entries`.

## Events

- `time_entry.deleted`
- `time_entry.recorded`
- `time_entry.started`
- `time_entry.updated`
- `timesheet.approved`
- `timesheet.reopened`
- `timesheet.submitted`

## Related blocks

Requires: [memberships](https://bettersupabase.com/blocks/memberships.md), [permissions](https://bettersupabase.com/blocks/permissions.md), [approvals](https://bettersupabase.com/blocks/approvals.md)

Works with: [outbox](https://bettersupabase.com/blocks/outbox.md), [audit](https://bettersupabase.com/blocks/audit.md), [employees](https://bettersupabase.com/blocks/employees.md), [approvals](https://bettersupabase.com/blocks/approvals.md)

## Recipes

- [Timesheet](https://bettersupabase.com/recipes/timesheet.md): A week of time entries per project with a running timer and totals.
