### Install Airbyte Golang SDK
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/connectors/airbytecdk/README.md
Use 'go get' to install the Airbyte Golang SDK.
```bash
go get github.com/bitstrapped/airbyte
```
--------------------------------
### Install jsoniter Go Library
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/jitsubase/jsonorder/README.md
Use the go get command to install the jsoniter library.
```go
go get github.com/json-iterator/go
```
--------------------------------
### Source Runner Initialization
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/connectors/airbytecdk/README.md
Example of how to initialize and start the Source Runner with a custom source implementation.
```APIDOC
## Source Runner Usage
### Description
This demonstrates how to integrate a custom source implementation with the Airbyte Source Runner.
### Method
- **main()**: The entry point for the application.
### Usage
1. Instantiate your custom source (e.g., `filesource.NewFileSource("foobar.txt")`).
2. Create a new Source Runner with your source instance (`airbyte.NewSourceRunner(fsrc)`).
3. Start the runner (`runner.Start()`). Handle any potential errors.
### Example
```go
func main() {
fsrc := filesource.NewFileSource("foobar.txt")
runner := airbyte.NewSourceRunner(fsrc)
err := runner.Start()
if err != nil {
log.Fatal(err)
}
}
```
```
--------------------------------
### Start Jitsu Services with Docker Compose
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/docker/README.md
Use this command to start all necessary Jitsu services for exploration and development. Access the UI at http://localhost:3000.
```bash
docker compose -f ./docker/docker-compose.yml up --force-recreate
```
--------------------------------
### Start Jitsu Dependencies with Docker Compose
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/docker/README.md
Use this command to start only the necessary databases and message queues for Jitsu. Ensure you are in the directory containing docker-compose.yml.
```bash
docker compose -f ./docker/docker-compose.yml --profile jitsu-dependencies up -d
```
--------------------------------
### Start All Development Services
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/CLAUDE.md
Starts all development services with hot-reloading enabled. This command is used for a full local development environment setup.
```bash
pnpm dev
```
--------------------------------
### Install Jitsu React Package
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/libs/jitsu-react/README.md
Use npm to install the @jitsu/jitsu-react package into your project.
```bash
npm install --save @jitsu/jitsu-react
```
--------------------------------
### Start Local Development Environment
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/CONTRIBUTING.md
Use this command to start all dependencies required to run Jitsu locally. For development with hot reload, use the second command with the '--profile jitsu-services-dev' flag.
```bash
docker compose -f ./docker/docker-compose.yml up --force-recreate
```
```bash
docker compose -f ./docker/docker-compose.yml up --profile jitsu-services-dev --force-recreate
```
--------------------------------
### Run a Source Connector in Go
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/connectors/airbytecdk/README.md
Instantiate your custom source and pass it to `airbyte.NewSourceRunner` to start the connector. Handle any errors during startup.
```go
func main() {
fsrc := filesource.NewFileSource("foobar.txt")
runner := airbyte.NewSourceRunner(fsrc)
err := runner.Start()
if err != nil {
log.Fatal(err)
}
}
```
--------------------------------
### Quick Start Deployment Commands
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/helm/README.md
Follow these commands to quickly set up and deploy Jitsu on Minikube. Ensure prerequisites are met before execution.
```bash
# 1. Start minikube
minikube start
# 2. Configure secrets (interactive prompt)
./dev-deploy.sh secrets
# 3. Deploy
./dev-deploy.sh deploy
# 4. Start tunnel for localhost access (in separate terminal)
./dev-deploy.sh tunnel
```
--------------------------------
### Start UI Development Stack
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/CLAUDE.md
Starts both the console and ee-api development servers in parallel using Turbo. This provides a comprehensive UI development environment.
```bash
pnpm ui:dev
```
--------------------------------
### Install Jitsu JS SDK
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/libs/jitsu-js/README.md
Install the Jitsu JavaScript SDK using npm. This command adds the package as a dependency to your project.
```bash
npm install --save @jitsu/jitsu-js
```
--------------------------------
### Start Console Development Server
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/CLAUDE.md
Starts only the console development server. Use this command when you need to work specifically on the admin UI.
```bash
pnpm console:dev
```
--------------------------------
### Start Only 3rd-Party Services with Docker Compose
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/docker/README.md
Starts only the third-party dependencies required by Jitsu.
```bash
docker compose -f ./docker/docker-compose.yml --profile jitsu-dependencies up --force-recreate
```
--------------------------------
### Start Enterprise Edition API Development Server
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/CLAUDE.md
Starts only the enterprise edition API development server. Use this command when focusing on the EE API functionalities.
```bash
pnpm ee-api:dev
```
--------------------------------
### Troubleshoot Jitsu Services Not Starting
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/docker/README.md
If Jitsu services fail to start, check Docker logs for errors. Ensure no other processes are using the required ports. Consider rebuilding images without cache if issues persist.
```bash
docker compose -f ./docker/docker-compose.yml logs
```
```bash
docker compose -f ./docker/docker-compose.yml build --no-cache
```
--------------------------------
### Jitsu 2.0 Docker Compose Quick Start
Source: https://context7.com/jitsucom/jitsu/llms.txt
Sets up a self-hosted Jitsu 2.0 environment using Docker Compose. Includes Jitsu console, ingest service, and necessary dependencies like Kafka and PostgreSQL.
```bash
git clone --depth 1 https://github.com/jitsucom/jitsu
cd jitsu/docker
touch .env.local # optional: set JITSU_DOMAIN, NEXTAUTH_SECRET, etc.
docker compose up -d
# Services started:
# jitsu-console → http://localhost:3000 (admin UI)
# jitsu-ingest → http://localhost:8080 (event collection)
# bulker → (internal, port 3042)
# kafka + zookeeper
# postgresql (metadata + destinations)
# rotor (event routing)
```
--------------------------------
### Install JS Dependencies with pnpm
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/CLAUDE.md
Installs JavaScript dependencies for the project using pnpm. Ensure Node.js and pnpm are set up correctly.
```bash
pnpm install
```
--------------------------------
### Local Testing Setup for Reprocessing Worker
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/reprocessing-worker/README.md
Sets up environment variables, creates necessary configuration files, and runs the reprocessing worker locally for testing. This requires Go, Kafka, and PostgreSQL to be running locally.
```bash
export JOB_ID=test-job-123
export WORKER_INDEX=0
export DATABASE_URL=postgresql://localhost/bulker
export KAFKA_BOOTSTRAP_SERVERS=localhost:9092
# Create config files
mkdir -p /tmp/config/files /tmp/config/job
echo '[{"path":"s3://bucket/file.ndjson","size":1024}]' > /tmp/config/files/files.json
echo '{"batch_size":100}' > /tmp/config/job/config.json
# Mount and run
go run main.go
```
--------------------------------
### PostgreSQL Destination Configuration
Source: https://context7.com/jitsucom/jitsu/llms.txt
Example JSON configuration for a PostgreSQL destination. Ensure the BULKER_DESTINATION_MYPG environment variable is set.
```json5
// BULKER_DESTINATION_MYPG environment variable value
{
"id": "mypg",
"type": "postgres", // postgres | mysql | redshift | snowflake | bigquery | clickhouse | s3 | gcs
"updatedAt": "2024-01-01T00:00:00Z",
"credentials": {
"host": "db.example.com",
"port": 5432,
"database": "analytics",
"defaultSchema": "public",
"username": "jitsu",
"password": "secret"
},
"options": {
"mode": "batch", // "stream" | "batch"
"batchSize": 10000,
"frequency": 5, // minutes between batch flushes
"primaryKey": "message_id", // for deduplication
"deduplicate": true,
"timestamp": "_timestamp", // optimise table partitioning / sorting
"retryBatchSize": 100,
"retryFrequency": 5
}
}
```
--------------------------------
### Start Minikube Tunnel
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/helm/README.md
Run this command in a separate terminal to establish a tunnel for localhost access to services exposed via LoadBalancer.
```bash
./dev-deploy.sh tunnel
```
--------------------------------
### Install Jitsu SDK with HTML Script Tag
Source: https://context7.com/jitsucom/jitsu/llms.txt
Load the Jitsu SDK using a script tag in your HTML. Configure options via data attributes. Use `jitsuQ` for pre-load commands.
```html
```
--------------------------------
### Rebuild Jitsu Images with Docker Compose
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/docker/README.md
Starts Jitsu in ordinary mode while rebuilding Docker images from local sources.
```bash
docker compose -f ./docker/docker-compose.yml up --force-recreate --build
```
--------------------------------
### Conventional Commit Example
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/CONTRIBUTING.md
Follow the conventional commit format for your commit messages. This includes a type, scope, and description.
```bash
fix(rotor): enable DNS caching for undici pools
feat(console): add workspace OIDC configuration
```
--------------------------------
### Run Development Server for Client-Side Code
Source: https://github.com/jitsucom/jitsu/wiki/Set-up-Development-Environment
Starts a simple echo server that accepts JSON from tracker.js and outputs it to stdout. This is useful for debugging client-side code independently of the Go server.
```bash
npm run devserver
```
--------------------------------
### BigQuery Destination Configuration
Source: https://context7.com/jitsucom/jitsu/llms.txt
Example JSON configuration for a BigQuery destination. Requires GCP project, key file, and BigQuery dataset.
```json5
// BigQuery credentials
{
"id": "mybq",
"type": "bigquery",
"credentials": {
"project": "my-gcp-project",
"keyFile": "{\"type\":\"service_account\", ...}",
"bqDataset": "jitsu_events"
},
"options": { "mode": "batch", "deduplicate": true, "primaryKey": "message_id" }
```
--------------------------------
### Start Jitsu in Docker Compose with Dev Mode
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/docker/README.md
Enables development mode with hot reload for Node.js services. Remember to clean local node_modules to avoid conflicts.
```bash
docker compose -f ./docker/docker-compose.yml --profile jitsu-services-dev up -d --force-recreate
```
--------------------------------
### Clone Jitsu Repository with Docker Compose
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/README.md
Use this command to clone the Jitsu repository and navigate to the docker directory for quick setup. Optionally, create and edit the .env.local file for environment variable configuration.
```bash
git clone --depth 1 https://github.com/jitsucom/jitsu
cd jitsu/docker
touch .env.local
```
--------------------------------
### Start Job
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/admin/REPROCESSING_K8S.md
Initiates a new reprocessing job. The response includes the total number of workers assigned and the Kubernetes job name.
```APIDOC
## POST /api/admin/reprocessing/jobs
### Description
Starts a new reprocessing job with specified parameters.
### Method
POST
### Endpoint
/api/admin/reprocessing/jobs
### Request Body
- **s3_path** (string) - Required - The S3 path to the data to be reprocessed.
- **stream_ids** (array of strings) - Required - A list of stream identifiers to process.
- **date_from** (string) - Required - The start date for reprocessing (ISO 8601 format).
- **date_to** (string) - Required - The end date for reprocessing (ISO 8601 format).
### Request Example
```json
{
"s3_path": "s3://bucket/failover/",
"stream_ids": ["stream1", "stream2"],
"date_from": "2024-01-01T00:00:00Z",
"date_to": "2024-01-31T23:59:59Z"
}
```
### Response
#### Success Response (200)
- **total_workers** (integer) - The total number of workers provisioned for the job.
- **k8s_job_name** (string) - The name of the Kubernetes job created.
```
--------------------------------
### Pixel Tracking API Example
Source: https://context7.com/jitsucom/jitsu/llms.txt
Use this endpoint for environments where JavaScript is unavailable, such as emails or AMP pages. Encode event properties as base64 JSON in the 'data' query parameter.
```bash
# Encode payload and send as GET
PAYLOAD=$(echo '{"event":"Email Opened","userId":"user_123"}' | base64 -w0)
curl "https://t.example.com/api/px/track?data=${PAYLOAD}&writeKey=myWriteKey:mySecret"
# Returns a 1x1 transparent GIF
```
--------------------------------
### ClickHouse Destination Configuration
Source: https://context7.com/jitsucom/jitsu/llms.txt
Example JSON configuration for a ClickHouse destination. Specify protocol, hosts, username, password, and database.
```json5
// ClickHouse credentials
{
"id": "mych",
"type": "clickhouse",
"credentials": {
"protocol": "clickhouse-secure",
"hosts": ["ch.example.com:9440"],
"username": "default",
"password": "secret",
"database": "analytics"
},
"options": { "mode": "batch", "timestamp": "_timestamp" }
```
--------------------------------
### Custom Configuration Example
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/helm/README.md
Create a `values-custom.yaml` file to override default Helm chart values for environment-specific settings, such as scaling or logging format.
```yaml
scaling:
ingest:
replicas: 2
env:
common:
LOG_FORMAT: "json"
```
--------------------------------
### Jitsu CLI: Deploy functions
Source: https://context7.com/jitsucom/jitsu/llms.txt
Deploy functions to a Jitsu workspace using `jitsu-cli deploy`. This command can be used interactively to select a workspace, or target a specific workspace and deploy selected functions. A full CI example demonstrates deploying from a specified directory with host and API key.
```bash
# Interactive: select workspace from list
jitsu-cli deploy
# Target a specific workspace
jitsu-cli deploy --workspace ws_abc123
# Deploy only selected functions
jitsu-cli deploy --name enrich-geo,filter-bots
# Full CI example
jitsu-cli deploy \
--host https://use.jitsu.com \
--apikey $JITSU_API_KEY \
--workspace $JITSU_WORKSPACE_ID \
--dir ./dist
```
--------------------------------
### Bulker Server Configuration - Dynamic Sources and Logging
Source: https://context7.com/jitsucom/jitsu/llms.txt
Configure dynamic destination configuration fetching from the Jitsu console and set up an optional ClickHouse event log.
```bash
# --- Dynamic destination config from Jitsu console ---
BULKER_CONFIG_SOURCE=http://console:3000/api/admin/export/bulker-connections
BULKER_CONFIG_SOURCE_HTTP_AUTH_TOKEN=service-admin-account:CONSOLE_TOKEN
# --- Optional events log ---
BULKER_CLICKHOUSE_HOST=ch.example.com:9440
BULKER_CLICKHOUSE_DATABASE=jitsu_events_log
BULKER_CLICKHOUSE_SSL=true
BULKER_CLICKHOUSE_USERNAME=default
BULKER_CLICKHOUSE_PASSWORD=secret
```
--------------------------------
### Initialize Go Workspace
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/GOWORK.md
Run this command to initialize a new Go workspace with specified modules. The go.work file generated should typically be ignored by version control.
```bash
go work init jitsubase kafkabase eventslog bulkerlib bulkerapp connectors/airbytecdk connectors/firebase ingest sync-sidecar sync-controller operator ingress-manager config-keeper admin reprocessing-worker
```
--------------------------------
### Dockerfile for Airbyte Connector
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/connectors/airbytecdk/README.md
A sample Dockerfile to build and package your Go-based Airbyte connector. It includes build steps and labels required by Airbyte.
```dockerfile
FROM golang:1.17-buster as build
WORKDIR /base
ADD . /base/
RUN go build -o /base/app .
LABEL io.airbyte.version=0.0.1
LABEL io.airbyte.name=airbyte/source
ENTRYPOINT ["/base/app"]
```
--------------------------------
### Get Job Status
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/admin/REPROCESSING_K8S.md
Retrieves the overall status and aggregated statistics for a specific reprocessing job.
```APIDOC
## GET /api/admin/reprocessing/jobs/{id}
### Description
Retrieves the status and aggregated statistics for a given reprocessing job.
### Method
GET
### Endpoint
/api/admin/reprocessing/jobs/{id}
### Parameters
#### Path Parameters
- **id** (string) - Required - The unique identifier of the reprocessing job.
```
--------------------------------
### Jitsu CLI: Initialize a new function project
Source: https://context7.com/jitsucom/jitsu/llms.txt
Use `jitsu-cli init` to scaffold a new Jitsu function project. This command sets up the necessary directory structure and configuration files.
```bash
npm install -g jitsu-cli
# or use pnpm / yarn
# Create a new project
jitsu-cli init my-functions
# Creates: my-functions/
# src/functions/my-function.ts
# package.json
# tsconfig.json
# With specific jitsu version
jitsu-cli init my-functions --jitsu-version 2.14.0
```
--------------------------------
### Get Worker Details
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/admin/REPROCESSING_K8S.md
Fetches detailed status information for all workers associated with a specific reprocessing job.
```APIDOC
## GET /api/admin/reprocessing/jobs/{id}/workers
### Description
Retrieves detailed status information for all workers of a specific reprocessing job.
### Method
GET
### Endpoint
/api/admin/reprocessing/jobs/{id}/workers
### Parameters
#### Path Parameters
- **id** (string) - Required - The unique identifier of the reprocessing job.
### Response
#### Success Response (200)
- **workers** (array of objects) - An array containing the status of each worker.
- **worker_index** (integer) - The index of the worker.
- **status** (string) - The current status of the worker (e.g., 'running').
- **assigned_files** (integer) - Number of files assigned to the worker.
- **processed_files** (integer) - Number of files processed by the worker.
- **total_lines** (integer) - Total lines of data the worker is expected to process.
- **success_count** (integer) - Number of lines successfully processed.
- **error_count** (integer) - Number of lines that resulted in an error.
- **skipped_count** (integer) - Number of lines skipped.
- **processed_bytes** (integer) - Total bytes processed by the worker.
- **current_file** (string) - The S3 path of the file currently being processed.
- **current_line** (integer) - The current line number being processed.
- **updated_at** (string) - Timestamp of the last update for the worker.
```
--------------------------------
### Get Worker Details API Request
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/admin/REPROCESSING_K8S.md
Fetches detailed status information for all workers associated with a specific reprocessing job.
```bash
GET /api/admin/reprocessing/jobs/{id}/workers
Authorization: Bearer
```
```json
{
"workers": [
{
"worker_index": 0,
"status": "running",
"assigned_files": 15,
"processed_files": 10,
"total_lines": 50000,
"success_count": 49500,
"error_count": 500,
"skipped_count": 0,
"processed_bytes": 10485760,
"current_file": "s3://bucket/file_10.ndjson.gz",
"current_line": 5000,
"updated_at": "2024-01-15T10:30:45Z"
}
]
}
```
--------------------------------
### Get Job Status API Request
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/admin/REPROCESSING_K8S.md
Retrieves the aggregated status and statistics for a specific reprocessing job using its ID.
```bash
GET /api/admin/reprocessing/jobs/{id}
Authorization: Bearer
```
--------------------------------
### Redshift Destination Configuration
Source: https://context7.com/jitsucom/jitsu/llms.txt
Example JSON configuration for a Redshift destination. This requires an intermediate S3 bucket for staging data.
```json5
// Redshift credentials (requires intermediate S3)
{
"id": "myrs",
"type": "redshift",
"credentials": {
"host": "cluster.us-east-1.redshift.amazonaws.com",
"port": 5439,
"database": "dev",
"username": "jitsu",
"password": "secret",
"s3Config": {
"bucket": "my-redshift-staging",
"region": "us-east-1",
"accessKeyId": "AKIA...",
"secretAccessKey": "..."
}
},
"options": { "mode": "batch" }
```
--------------------------------
### Bulker Server Configuration - Auth and Kafka
Source: https://context7.com/jitsucom/jitsu/llms.txt
Configure authentication tokens and Kafka connection details using environment variables. BULKER_RAW_AUTH_TOKENS is for development, while BULKER_AUTH_TOKENS with BULKER_TOKEN_SECRET is for production.
```bash
# docker-compose.yml / shell export
# --- Auth ---
BULKER_RAW_AUTH_TOKENS=my_secret_token # Plain token list (dev only)
BULKER_AUTH_TOKENS=abc.sha512hash # Hashed tokens for production
BULKER_TOKEN_SECRET=super_secret_salt
# --- Kafka ---
BULKER_KAFKA_BOOTSTRAP_SERVERS=kafka:9092
BULKER_KAFKA_SSL=true
BULKER_KAFKA_SASL='{"mechanism":"SCRAM-SHA-256","username":"user","password":"pass"}'
```
--------------------------------
### Build Reprocessing Worker Docker Image
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/reprocessing-worker/README.md
Builds and pushes the Docker image for the reprocessing worker. Ensure you have Docker installed and configured.
```bash
./reprocessing-worker-build.sh
```
--------------------------------
### Publish Beta Release
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/CONTRIBUTING.md
Execute this command to publish a beta release. Ensure all changes are committed.
```bash
./release.sh
```
--------------------------------
### Check Build Logs for Init Pods
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/helm/README.md
If pods are stuck in the init state, check their build logs using this command, specifying the service name.
```bash
./dev-deploy.sh build-logs
```
--------------------------------
### Configure Jitsu Secrets
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/helm/README.md
Run this command to interactively set up all required credentials for Jitsu. It creates or updates the `jitsu-secrets` Kubernetes Secret.
```bash
./dev-deploy.sh secrets
```
--------------------------------
### Get Reprocessing Worker Logs via API
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/admin/REPROCESSING_K8S.md
Fetch real-time logs from all workers of a specific reprocessing job via the API.
```bash
curl -H "Authorization: Bearer $TOKEN" \
http://admin:3049/api/admin/reprocessing/jobs/$JOB_ID/logs
```
--------------------------------
### Basic Usage of OrderedMap
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/jitsubase/types/README.md
Demonstrates how to create a new ordered map and perform basic operations like setting and deleting elements. Requires Go v1.18+ for generics.
```go
import "github.com/elliotchance/orderedmap/v2"
func main() {
m := orderedmap.NewOrderedMap[string, any]()
m.Set("foo", "bar")
m.Set("qux", 1.23)
m.Set("123", true)
m.Delete("qux")
}
```
--------------------------------
### Get Reprocessing Worker Details via API
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/admin/REPROCESSING_K8S.md
Retrieve details for individual workers associated with a reprocessing job using its ID.
```bash
curl -H "Authorization: Bearer $TOKEN" \
http://admin:3049/api/admin/reprocessing/jobs/$JOB_ID/workers
```
--------------------------------
### General Dev-Deploy Commands
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/helm/README.md
The `dev-deploy.sh` script provides various commands for managing the Jitsu deployment. Use `` to specify the desired action.
```bash
./dev-deploy.sh
```
--------------------------------
### Get Reprocessing Job Progress via API
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/admin/REPROCESSING_K8S.md
Use this curl command to check the overall progress of a specific reprocessing job by its ID.
```bash
curl -H "Authorization: Bearer $TOKEN" \
http://admin:3049/api/admin/reprocessing/jobs/$JOB_ID
```
--------------------------------
### Get Source Connector Specification
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/sync-controller/README.md
Asynchronously runs a task to retrieve the specification of a source connector. The result is stored in the `source_spec` database table.
```APIDOC
## GET /spec
### Description
Asynchronously runs a task to obtain the Source connector specification. The resulting specification is stored in the database table `source_spec`.
### Method
GET
### Endpoint
/spec
### Query Parameters
- **package*** (string) - Required - Source package image (for Airbyte-based sources, it's the Docker image).
- **version*** (string) - Required - Source package version.
- **connectorType** (string) - Optional - Defaults to `airbyte`.
### Response
#### Success Response (200)
Returns `{"status": "ok"}` upon successful completion.
#### Error Response
Returns `{"error": ...}` if an error occurs.
```
--------------------------------
### Build Client-Side JavaScript
Source: https://github.com/jitsucom/jitsu/wiki/Set-up-Development-Environment
Use this NPM command to build a compressed and minified JavaScript bundle for the client-side tracking code. This is also part of the Go Makefile.
```bash
npm run build
```
--------------------------------
### Bulker Prometheus Metrics Export
Source: https://context7.com/jitsucom/jitsu/llms.txt
Access the GET /metrics endpoint to retrieve Bulker's operational metrics in Prometheus text format for scraping.
```bash
curl https://bulker.example.com/metrics
```
--------------------------------
### Identify Call via HTTP API
Source: https://context7.com/jitsucom/jitsu/llms.txt
Example cURL command for an identify call to the Jitsu HTTP API. Used to associate user traits with a userId.
```bash
# Identify call
curl -X POST "https://t.example.com/api/s/identify" \
-H "Authorization: Bearer myWriteKey:mySecret" \
-H "Content-Type: application/json" \
-d '{
"userId": "user_123",
"traits": { "email": "alice@example.com", "plan": "pro" }
}'
```
--------------------------------
### Test Go Packages
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/CLAUDE.md
Runs Go tests within the `/bulker` directory. This command is used for verifying the functionality of the Go components.
```bash
go test ./...
```
--------------------------------
### Initialize Jitsu Analytics Instance (Browser/Node.js)
Source: https://context7.com/jitsucom/jitsu/llms.txt
Factory function to create an analytics instance. Works isomorphically. In browsers, it auto-detects runtime and uses cookies. Node.js requires a fetch implementation.
```typescript
import { jitsuAnalytics } from "@jitsu/js";
// Browser / Node.js (isomorphic)
const analytics = jitsuAnalytics({
host: "https://t.example.com", // required
writeKey: "keyId:keySecret", // optional if domain-based routing is configured
debug: false,
fetchTimeoutMs: 5000,
cookieDomain: ".example.com", // optional: set explicitly to share cookies across subdomains
// Privacy controls
privacy: {
dontSend: false, // set true to suppress all sends (e.g. cookie consent)
disableUserIds: false, // anonymise: strip userId/anonymousId
ipPolicy: "keep", // "keep" | "remove" | "stripLastOctet"
consentCategories: { analytics: true, marketing: false },
},
// Server-to-server mode (Node.js)
s2s: true,
fetch: globalThis.fetch, // required in Node.js environments
echoEvents: false, // set true in development to log events to console
defaultPayloadContext: { // merged into every event's context
app: { version: "2.1.0" }
},
});
// Track a custom event
await analytics.track("Product Viewed", {
product_id: "prod_123",
category: "Electronics",
price: 299.99,
});
// Page view
await analytics.page("Pricing", {
url: "https://example.com/pricing",
});
// Identify a user
await analytics.identify("user_123", {
email: "alice@example.com",
plan: "pro",
createdAt: "2023-06-01",
});
// Group / account association
await analytics.group("acme-corp", {
name: "Acme Corp",
industry: "Technology",
employees: 500,
});
// Reset (logout)
await analytics.reset();
// Node.js server-side example with fetch
import nodeFetch from "node-fetch";
const serverAnalytics = jitsuAnalytics({
host: "https://t.example.com",
writeKey: "s2sKeyId:s2sKeySecret",
s2s: true,
fetch: nodeFetch as any,
});
await serverAnalytics.track("Server Event", { orderId: "ord_789" });
```
--------------------------------
### Server-to-Server Event Ingestion
Source: https://context7.com/jitsucom/jitsu/llms.txt
Example cURL command for server-to-server event ingestion via Jitsu's HTTP API. Use an 's2s' writeKey and manually set 'context.ip'.
```bash
curl -X POST "https://t.example.com/api/s/s2s/track" \
-H "Authorization: Bearer s2sWriteKey:s2sSecret" \
-H "Content-Type: application/json" \
-d '{
"event": "Order Completed",
"userId": "user_123",
"properties": { "order_id": "ord_789", "revenue": 99.95 },
"context": { "ip": "203.0.113.10" }
}'
```
--------------------------------
### Registering a Driver Constructor
Source: https://github.com/jitsucom/jitsu/wiki/Data-loading-driver-implementation
Implements the init function to register a driver constructor with the Jitsu system. Ensure the driver type and constructor function are correctly specified.
```go
func init() {
if err := RegisterDriverConstructor(driverType, NewDriverConstructorFunc); err != nil {
logging.Errorf("Failed to register driver %s: %v", driverType, err)
}
}
```
--------------------------------
### Page View Event via HTTP API
Source: https://context7.com/jitsucom/jitsu/llms.txt
Example cURL command to send a page view event to the Jitsu HTTP API. Requires 'Authorization' header and JSON payload.
```bash
# Page view event
curl -X POST "https://t.example.com/api/s/page" \
-H "Authorization: Bearer myWriteKey:mySecret" \
-H "Content-Type: application/json" \
-d '{
"properties": {
"url": "https://example.com/pricing",
"title": "Pricing — Example",
"referrer": "https://google.com"
},
"anonymousId": "anon_456"
}'
```
--------------------------------
### Track Custom Event via HTTP API
Source: https://context7.com/jitsucom/jitsu/llms.txt
Example cURL command to track a custom event using the Jitsu HTTP API. Use 'Authorization: Bearer ' for authentication.
```bash
# Track a custom event (browser-origin)
curl -X POST "https://t.example.com/api/s/track" \
-H "Authorization: Bearer myWriteKey:mySecret" \
-H "Content-Type: application/json" \
-d '{
"messageId": "msg_abc123",
"event": "Product Purchased",
"properties": {
"product_id": "prod_789",
"price": 49.99,
"currency": "USD"
},
"userId": "user_123",
"anonymousId": "anon_456",
"timestamp": "2024-01-15T12:05:00Z"
}'
# Response: {"ok": true}
```
--------------------------------
### Initialize and Track with Jitsu EventNative (CommonJS)
Source: https://github.com/jitsucom/jitsu/wiki/JS-Tracker-Release-and-testing-process
Use this snippet to initialize the EventNative tracker with a specific key and tracking host, then track a 'pageview' event. Ensure the dev server console is monitored for successful event delivery and absence of errors.
```javascript
eventN.init({
"key": "test_key",
"tracking_host": "localhost"
});
eventN.track('pageview');
```
--------------------------------
### Publish Stable Release
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/bulker/CONTRIBUTING.md
Execute this command to publish the stable release with the 'latest' tag. Ensure all changes are committed.
```bash
./release.sh --release latest
```
--------------------------------
### Full Driver Template
Source: https://github.com/jitsucom/jitsu/wiki/Data-loading-driver-implementation
Provides a complete template for implementing a Jitsu data driver. This includes the necessary methods for retrieving intervals, loading objects, specifying the driver type, and closing connections.
```go
const driverType = "new_driver_type"
type SomeDriver struct {
// driver fields
}
func NewSomeDriver(ctx context.Context, sourceConfig *SourceConfig, collection *Collection) (Driver, error) {
// driver creation implementation
}
func init() {
if err := RegisterDriverConstructor(driverType, NewYourDriver); err != nil {
logging.Errorf("Failed to register driver %s: %v", driverType, err)
}
}
func (g *SomeDriver) GetAllAvailableIntervals() ([]*TimeInterval, error) {
// return time intervals. If objects of data source have no timestamps, return time interval with ALL granularity
}
func (g *SomeDriver) GetObjectsFor(interval *TimeInterval) ([]map[string]interface{}, error) {
// data loading logic
}
func (g *SomeDriver) Type() string {
return driverType
}
func (g *SomeDriver) Close() error {
// close all clients and connections created by driver
}
```
--------------------------------
### Initialize and Track with Jitsu EventNative (ESM)
Source: https://github.com/jitsucom/jitsu/wiki/JS-Tracker-Release-and-testing-process
This snippet demonstrates initializing the EventNative tracker using ECMAScript Module (ESM) import syntax. It's crucial to verify event delivery to localhost and check for console errors.
```javascript
import eventN from '@ksense/eventnative';
```
--------------------------------
### Initialize JitsuProvider in React App
Source: https://context7.com/jitsucom/jitsu/llms.txt
Wrap your React application with `JitsuProvider` to make the Jitsu analytics instance available throughout your component tree. Configure Jitsu options within the `options` prop.
```tsx
// app/layout.tsx (Next.js App Router) or index.tsx (CRA)
import { JitsuProvider } from "@jitsu/jitsu-react";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
{children}
);
}
```
--------------------------------
### Bulker Health Check Endpoint
Source: https://context7.com/jitsucom/jitsu/llms.txt
The GET /ready endpoint checks if Bulker is ready to accept traffic. It returns HTTP 200 with status 'pass' if ready, or HTTP 503 with status 'fail' and an error message if not.
```bash
curl -f https://bulker.example.com/ready
```
--------------------------------
### Configure Jitsu.js and Track Events
Source: https://github.com/jitsucom/jitsu/blob/newjitsu/libs/jitsu-js/__tests__/playwright/cases/basic.html
Set up Jitsu.js with custom cookie configuration and then identify a user and track a page load event.
```javascript
window.jitsuConfig = { cookieCapture: { ttp: "_ttp", }, };
window.testOnload = async j => {
j.identify("john-doe-id-1", { email: "john.doe@gmail.com" });
j.track("pageLoaded", { trackParam: "trackValue" });
};
```
--------------------------------
### Batch Event Ingestion via HTTP API
Source: https://context7.com/jitsucom/jitsu/llms.txt
Example cURL command for batch event ingestion using Jitsu's HTTP API. Supports gzip-encoded bodies and returns per-batch counts and errors.
```bash
curl -X POST "https://t.example.com/api/s/s2s/batch" \
-H "Authorization: Bearer myWriteKey:mySecret" \
-H "Content-Type: application/json" \
-d '{
"writeKey": "myWriteKey:mySecret",
"batch": [
{
"type": "track",
"event": "App Opened",
"userId": "user_001",
"timestamp": "2024-01-15T10:00:00Z",
"messageId": "msg_001"
},
{
"type": "page",
"properties": { "url": "https://app.example.com/dashboard" },
"userId": "user_001",
"timestamp": "2024-01-15T10:00:01Z",
"messageId": "msg_002"
}
],
"context": { "ip": "1.2.3.4" }
}'
# Response:
# { "ok": true, "receivedEvents": 2, "okEvents": 2 }
# On partial errors:
# { "ok": false, "receivedEvents": 3, "okEvents": 2, "errors": ["Message ID: msg_003: ..."] }
```