{"id":25486576,"url":"https://github.com/soenneker/soenneker.zelos.suite","last_synced_at":"2026-05-03T07:04:44.728Z","repository":{"id":278076516,"uuid":"934445856","full_name":"soenneker/soenneker.zelos.suite","owner":"soenneker","description":"The file-based JSON document database engine","archived":false,"fork":false,"pushed_at":"2026-04-21T23:55:59.000Z","size":986,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-22T01:35:37.137Z","etag":null,"topics":["container","csharp","database","document","dotnet","json","nosql","suite","util","zelos","zelossuiteutil"],"latest_commit_sha":null,"homepage":"https://soenneker.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soenneker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"soenneker","thanks_dev":"soenneker"}},"created_at":"2025-02-17T21:06:19.000Z","updated_at":"2026-04-21T23:55:19.000Z","dependencies_parsed_at":"2026-03-07T15:02:14.648Z","dependency_job_id":null,"html_url":"https://github.com/soenneker/soenneker.zelos.suite","commit_stats":null,"previous_names":["soenneker/soenneker.zelos.suite"],"tags_count":311,"template":false,"template_full_name":null,"purl":"pkg:github/soenneker/soenneker.zelos.suite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.zelos.suite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.zelos.suite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.zelos.suite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.zelos.suite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soenneker","download_url":"https://codeload.github.com/soenneker/soenneker.zelos.suite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.zelos.suite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32187404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-23T15:28:30.493Z","status":"ssl_error","status_checked_at":"2026-04-23T15:28:29.972Z","response_time":53,"last_error":"SSL_read: 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":["container","csharp","database","document","dotnet","json","nosql","suite","util","zelos","zelossuiteutil"],"created_at":"2025-02-18T19:21:06.756Z","updated_at":"2026-04-23T16:01:01.720Z","avatar_url":"https://github.com/soenneker.png","language":"C#","funding_links":["https://github.com/sponsors/soenneker","https://thanks.dev/soenneker"],"categories":[],"sub_categories":[],"readme":"[![](https://img.shields.io/nuget/v/soenneker.zelos.suite.svg?style=for-the-badge)](https://www.nuget.org/packages/soenneker.zelos.suite/)\n[![](https://img.shields.io/github/actions/workflow/status/soenneker/soenneker.zelos.suite/publish-package.yml?style=for-the-badge)](https://github.com/soenneker/soenneker.zelos.suite/actions/workflows/publish-package.yml)\n[![](https://img.shields.io/nuget/dt/soenneker.zelos.suite.svg?style=for-the-badge)](https://www.nuget.org/packages/soenneker.zelos.suite/)\n[![](https://img.shields.io/github/actions/workflow/status/soenneker/soenneker.zelos.suite/codeql.yml?label=CodeQL\u0026style=for-the-badge)](https://github.com/soenneker/soenneker.zelos.suite/actions/workflows/codeql.yml)\n\n# ![](https://user-images.githubusercontent.com/4441470/224455560-91ed3ee7-f510-4041-a8d2-3fc093025112.png) Soenneker.Zelos.Suite\n### The file-based JSON document database engine\n\n---\n\n# What is Zelos?\n\nZelos is a lightweight, embedded data store for .NET applications. It leverages JSON for persistent storage while maintaining an in-memory cache for rapid data access. With asynchronous, thread-safe operations, Zelos minimizes I/O overhead by periodically saving only modified containers.\n\n---\n\n## Key Benefits \u0026 Features\n\n- **Embedded \u0026 Minimalistic:** Operates without the overhead of an external database server.\n- **Responsive Asynchronous I/O:** Uses async operations to keep your application fast and non-blocking.\n- **Robust Concurrency:** Employs asynchronous locks and semaphores to manage thread safety.\n- **Container Organization:** Segregate your data logically using named containers.\n- **Efficient Persistence:** Automatically saves only when necessary to reduce disk IO.\n- **Resource Management:** Designed to automatically dispose resources when no longer needed, ensuring clean shutdowns.\n- **Repository Pattern Integration:** Streamlines CRUD operations with a familiar design pattern.\n\n---\n\n## Architecture \u0026 Components\n\n### `ZelosDatabase`\n\n- Core engine managing the persistence layer.\n- Loads or creates the database file on startup.\n- Periodically saves dirty containers.\n- Manages container initialization and data consistency.\n\n### `ZelosContainer` \u0026 `IZelosContainerUtil`\n\n- **ZelosContainer:**\n  - Represents an in-memory container for key/value pairs (stored as JSON).\n  - Handles adding, updating, and deleting items, marking itself as �dirty� for periodic saves.\n  \n- **IZelosContainerUtil:**\n  - **Usage:** Retrieves containers by combining the database file path and container name.\n  - **Caching \u0026 Creation:** Manages container lifecycle, ensuring each container is only loaded once.\n\n### `ZelosRepository`\n\n- Provides a higher-level abstraction using the repository pattern.\n- Exposes common CRUD operations for generic document types.\n- Uses `IZelosContainerUtil` internally to obtain the right container.\n- Integrates logging and configuration for detailed diagnostics.\n\n---\n\n## Installation\n\n```\ndotnet add package Soenneker.Zelos.Suite\n```\n\nand then register it:\n\n```csharp\nservices.AddZelosSuiteAsSingleton();\n```\n---\n\n# Zelos User Management Example\n\nThis guide demonstrates how to build a simple user management system using Zelos. The example includes:\n\n- **UserDocument**: A data model representing a user.\n- **UsersRepository**: Inherits from `ZelosRepository\u003cUserDocument\u003e`.\n- **UserManager**: Injects the repository to perform CRUD operations.\n\n---\n\n## Step 1: Define the User Document\n\nCreate a `UserDocument` class that represents the user data model. This class should inherit from your base `Document` class.\n\n```csharp\nusing Soenneker.Documents.Document;\n\npublic class UserDocument : Document\n{\n    public string Name { get; set; } = string.Empty;\n    public string Email { get; set; } = string.Empty;\n}\n```\n---\n\n## Step 2: Create the Users Repository\n\nCreate an interface (`IUsersRepository`) for user-specific operations. Then, implement this interface in a class `UsersRepository` that inherits from `ZelosRepository\u003cUserDocument\u003e`. The repository will set the database file path and container name (in this case, `\"users\"`).\n\n```csharp\nusing Microsoft.Extensions.Configuration;\nusing Microsoft.Extensions.Logging;\nusing Soenneker.Zelos.Repository;\nusing Soenneker.Zelos.Container.Util.Abstract;\n\npublic class UsersRepository : IZelosRepository\u003cUserDocument\u003e\n{\n    public UsersRepository(IConfiguration configuration, ILogger\u003cUsersRepository\u003e logger, \n        IZelosContainerUtil containerUtil) : base(configuration, logger, containerUtil)\n    {\n        // Set the database file path and container name\n        DatabaseFilePath = \"data/zelos.db\";\n        ContainerName = \"users\";\n    }\n}\n```\n\n---\n\n## Step 3: Create the User Manager\n\nCreate a `UserManager` class that injects `UsersRepository` to perform operations. In this class, add a new user, update it, and then delete it.\n\n```csharp\nusing System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Extensions.Logging;\n\npublic class UserManager\n{\n    private readonly IUsersRepository _usersRepository;\n    private readonly ILogger\u003cUserManager\u003e _logger;\n\n    public UserManager(IUsersRepository usersRepository, ILogger\u003cUserManager\u003e logger)\n    {\n        _usersRepository = usersRepository;\n        _logger = logger;\n    }\n\n    public async Task Execute(CancellationToken cancellationToken = default)\n    {\n        // Create a new user document.\n        var user = new UserDocument\n        {\n            Id = Guid.NewGuid().ToString(),\n            Name = \"John Doe\",\n            Email = \"john@example.com\"\n        };\n\n        _logger.LogInformation(\"Adding user with Id: {UserId}\", user.Id);\n        await _usersRepository.AddItem(user, cancellationToken);\n\n        // Update the user.\n        user.Email = \"john.doe@example.com\";\n        _logger.LogInformation(\"Updating user with Id: {UserId}\", user.Id);\n        await _usersRepository.UpdateItem(user, cancellationToken);\n\n        // Delete the user.\n        _logger.LogInformation(\"Deleting user with Id: {UserId}\", user.Id);\n        await _usersRepository.DeleteItem(user.Id, cancellationToken);\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoenneker%2Fsoenneker.zelos.suite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoenneker%2Fsoenneker.zelos.suite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoenneker%2Fsoenneker.zelos.suite/lists"}