{"id":18307825,"url":"https://github.com/davidroman0o/tempolite","last_synced_at":"2026-02-14T20:05:28.514Z","repository":{"id":257825461,"uuid":"865736421","full_name":"davidroman0O/tempolite","owner":"davidroman0O","description":"A lightweight SQLite-based workflow engine for Go supporting activities, side effects, sagas, signals and versioning","archived":false,"fork":false,"pushed_at":"2025-03-26T02:40:40.000Z","size":3021,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T18:40:44.452Z","etag":null,"topics":["deterministic","durable-execution","golang","saga","saga-pattern","sagas","sqlite","sqlite3","workflow","workflow-automation","workflow-engine","workflow-reusable","workflows"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidroman0O.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-01T03:31:57.000Z","updated_at":"2025-01-21T20:42:42.000Z","dependencies_parsed_at":"2024-11-07T21:27:05.069Z","dependency_job_id":"a5d87d20-4b93-467b-8de5-7dd115c63384","html_url":"https://github.com/davidroman0O/tempolite","commit_stats":null,"previous_names":["davidroman0o/go-tempolite"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davidroman0O/tempolite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidroman0O%2Ftempolite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidroman0O%2Ftempolite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidroman0O%2Ftempolite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidroman0O%2Ftempolite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidroman0O","download_url":"https://codeload.github.com/davidroman0O/tempolite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidroman0O%2Ftempolite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29454780,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deterministic","durable-execution","golang","saga","saga-pattern","sagas","sqlite","sqlite3","workflow","workflow-automation","workflow-engine","workflow-reusable","workflows"],"created_at":"2024-11-05T16:05:40.152Z","updated_at":"2026-02-14T20:05:28.497Z","avatar_url":"https://github.com/davidroman0O.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tempolite 🚀\n\nTempolite is a lightweight, workflow engine for Go that provides deterministic execution of workflows with support for activities, side effects, sagas, signals, and versioning. It's designed to be a simpler alternative to complex workflow engines while maintaining essential features for reliable business process automation.\n\n\u003e Work In Progress: Not ready for prime time not even good enough for playing with it and small applications.\n\u003e I'm going to make a massive refactoring as I discover better ways \n\n\u003c!-- TODO: make a section that explain the different patterns, explain what you should or should not do --\u003e\n\u003c!-- TODO: explain the whole idea of \"it's not temporal but a specialized local pocket workflow engine\", we're staking tasks to do in a convinient way --\u003e\n\n## Features\n\n### 🔄 Workflows\n- Deterministic execution with automatic retries\n- Support for sub-workflows\n- Version management for handling code changes\n- Pause/Resume capabilities\n- ContinueAsNew for long-running workflows\n- Automatic state persistence\n\n### 🛠 Activities\n- Non-deterministic operations isolation\n- Automatic retries on failure\n- Support for both function-based and struct-based activities\n- Error handling and recovery\n\n### 📡 Side Effects\n- Management of non-deterministic operations within workflows\n- Perfect for handling random numbers, timestamps, or UUIDs\n- Consistent replay behavior\n\n### ⚡ Signals\n- Asynchronous workflow communication\n- Wait for external events\n- Perfect for human interactions or system integrations\n\n### 🔄 Sagas\n- Transaction coordination with compensation logic\n- Automatic rollback of completed steps on failure\n- Step-by-step transaction execution\n- Built-in error handling and recovery\n\n\u003c!-- ### 📦 Database Management --\u003e\n\n### TODO:\n- Replay and retry mechanisms for debugging and recovery\n- SQLite database implementation\n\n## Getting Started\n\n```bash\ngo get github.com/davidroman0O/tempolite\n```\n\nLet's create a simple workflow that processes an order:\n\n```go\n\nfunc ProcessOrderWorkflow(ctx tempolite.WorkflowContext, orderID string) error {\n    // Execute an activity to validate the order\n    var isValid bool\n    if err := ctx.Activity(\"validate\", ValidateOrder, orderID).Get(\u0026isValid); err != nil {\n        return err\n    }\n\n    if !isValid {\n        return fmt.Errorf(\"invalid order: %s\", orderID)\n    }\n\n    return nil\n}\n\nfunc main() {\n\n\tdatabase := tempolite.NewMemoryDatabase()\n\n    tp, err := tempolite.New(\n        context.Background(),\n        database,\n    )\n    if err != nil {\n        log.Fatal(err)\n    }\n    defer tp.Close()\n\n    if err := tp.ExecuteDefault(\"process-order\", ProcessOrderWorkflow, nil, \"order-123\").Get(); err != nil {\n        log.Fatal(err)\n    }\n}\n```\n\n## Working with Workflow Components: The Info Pattern\n\nWhen you trigger any operation in a workflow (activities, side effects, signals, or sagas), Tempolite returns an Info struct with a `Get` method. This consistent pattern helps you handle results and errors:\n\n```go\nfunc OrderWorkflow(ctx tempolite.WorkflowContext, orderID string) error {\n    // ActivityInfo\n    var total float64\n    if err := ctx.Activity(\"calculate\", CalculateTotal, orderID).Get(\u0026total); err != nil {\n        return err\n    }\n\n    // SideEffectInfo\n    var trackingNumber string\n    if err := ctx.SideEffect(\"tracking\", GenerateTrackingNumber).Get(\u0026trackingNumber); err != nil {\n        return err\n    }\n\n    // SignalInfo\n    var approval bool\n    if err := ctx.Signal(\"approval\", \u0026approval); err != nil {\n        return err\n    }\n\n    // SagaInfo\n    // TODO: I will change that `.Get` to a direct call instead\n    if err := ctx.Saga(\"process\", sagaDef).Get(); err != nil {\n        return nil\n    }\n\n    // WorkflowInfo (when starting workflows)\n    var result string\n    if err := ctx.Workflow(\"sub-process\", SubWorkflow, nil, \"data\").Get(\u0026result); err != nil {\n        return err\n    }\n\n    return err\n}\n```\n\n### Understanding the Info Pattern\n\nEach Info struct (`ActivityInfo`, `SideEffectInfo`, etc.) follows the same principles:\n\n1. They're returned immediately when you trigger the operation\n2. The `Get` method blocks until the operation completes\n3. `Get` accepts pointer arguments to store results\n4. The number of pointer arguments must match the operation's return values\n\nHere's a more detailed example:\n\n```go\n// An activity that returns multiple values\nfunc ProcessOrder(ctx tempolite.ActivityContext, orderID string) (float64, string, error) {\n    return 99.99, \"processed\", nil\n}\n\nfunc WorkflowWithMultipleReturns(ctx tempolite.WorkflowContext, orderID string) error {\n    var (\n        amount  float64\n        status  string\n    )\n\n    // Get accepts multiple pointers matching the activity's return values\n    // (excluding the error which is returned by Get itself)\n    if err := ctx.Activity(\"process\", ProcessOrder, orderID).Get(\u0026amount, \u0026status); err != nil {\n        return fmt.Errorf(\"process failed: %w\", err)\n    }\n\n    log.Printf(\"Processed order: amount=%f, status=%s\", amount, status)\n    return nil\n}\n```\n\n### Working with Results\n\nThe Info pattern helps you handle operation results in a clean way:\n\n```go\n// Store the info struct for later use\nactivityFuture := ctx.Activity(\"process\", ProcessOrder, orderID)\n\n// Do other work...\n\n// Get the results when you need them\nvar amount float64\nvar status string\nif err := activityFuture.Get(\u0026amount, \u0026status); err != nil {\n    return err\n}\n```\n\nThis pattern is especially useful when working with multiple operations:\n\n```go\n// Trigger multiple activities\nvalidateFuture := ctx.Activity(\"validate\", ValidateOrder, orderID)\npaymentFuture := ctx.Activity(\"payment\", ProcessPayment, orderID)\nshippingFuture := ctx.Activity(\"shipping\", ArrangeShipping, orderID)\n\n// Get results in any order\nvar validationResult bool\nif err := validateFuture.Get(\u0026validationResult); err != nil {\n    return err\n}\n\nvar shippingLabel string\nif err := shippingFuture.Get(\u0026shippingLabel); err != nil {\n    return err\n}\n\nvar paymentRef string\nif err := paymentFuture.Get(\u0026paymentRef); err != nil {\n    return err\n}\n```\n\n### During Replay\n\nThe Info pattern handles replay seamlessly. During replay or retry:\n1. Previously successful operations return their original results instantly\n2. Failed operations are re-executed\n3. The `Get` method behavior remains consistent\n\nThis makes your workflow code clean and predictable, whether it's running for the first time or being replayed.\n\n####\n\nTODO: finish the readme.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidroman0o%2Ftempolite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidroman0o%2Ftempolite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidroman0o%2Ftempolite/lists"}