Tracks usage events for billing and analytics. Stores event records scoped to organizations with event type classification and optional metadata.
Worker name: crow-core-analytics-service
Domain (prod): internal.analytics.crowai.dev
Domain (dev): dev.internal.analytics.crowai.dev
Schema
analytics_event
| Column | Type | Notes |
|---|
| id | text PK | |
| organization_id | text | |
| event_type | text | e.g. interaction.created, pattern.generated |
| source | text | nullable, originating service |
| metadata | text | nullable, JSON |
| created_at | integer | epoch ms |
Routes
| Method | Path | Description |
|---|
| POST | /api/v1/analytics/events | Create an analytics event |
| GET | /api/v1/analytics/events | List events for org (paginated) |
| GET | /api/v1/analytics/summary | Aggregated event summary |
| GET | /health | Health check |
Environment Variables
| Variable | Example |
|---|
| ENVIRONMENT | dev |
Secrets
| Secret | Purpose |
|---|
| INTERNAL_GATEWAY_KEY | Gateway trust validation |
Bindings
| Binding | Type | Name |
|---|
| DB | D1 | crow-core-analytics-service-db |
| R2_BUCKET | R2 | crow-core-analytics-service-store |
Dependencies
- Inbound: gateway (dashboard analytics queries), other services (event creation)
Key Behaviors
- INTERNAL_GATEWAY_KEY guard: All routes require the shared internal key
- BOLA: Events are scoped to
organization_id, checked against X-Organization-Id
- ZodError sanitization: Validation errors return generic messages