{"id":28757737,"url":"https://github.com/kshitiz-mhto/xnap","last_synced_at":"2026-05-04T21:34:28.428Z","repository":{"id":295723386,"uuid":"910676530","full_name":"Kshitiz-Mhto/xnap","owner":"Kshitiz-Mhto","description":"xnap is a CLI tool designed to simplify the backup and restoration including databases,  and local system files.","archived":false,"fork":false,"pushed_at":"2025-05-30T14:18:05.000Z","size":724,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-17T03:46:32.138Z","etag":null,"topics":["cli","cobra","golang","gorm-orm","mysql","postgresql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kshitiz-Mhto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-01-01T03:08:50.000Z","updated_at":"2025-05-30T14:18:09.000Z","dependencies_parsed_at":"2025-05-27T04:18:04.113Z","dependency_job_id":"a51dd2d5-1e7f-4975-89eb-ccd6d17f0817","html_url":"https://github.com/Kshitiz-Mhto/xnap","commit_stats":null,"previous_names":["kshitiz-mhto/xnap"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Kshitiz-Mhto/xnap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kshitiz-Mhto%2Fxnap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kshitiz-Mhto%2Fxnap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kshitiz-Mhto%2Fxnap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kshitiz-Mhto%2Fxnap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kshitiz-Mhto","download_url":"https://codeload.github.com/Kshitiz-Mhto/xnap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kshitiz-Mhto%2Fxnap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32626253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"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":["cli","cobra","golang","gorm-orm","mysql","postgresql"],"created_at":"2025-06-17T03:40:04.950Z","updated_at":"2026-05-04T21:34:28.408Z","avatar_url":"https://github.com/Kshitiz-Mhto.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/logo.png\" alt=\"xnap Logo\" width=\"230\"\u003e\n\u003c/p\u003e\n\n**xnap**  is a command-line interface (CLI) tool designed for easy and efficient management of databases and local file backups and restoration. It offers a suite of features for maintaining database integrity, performing regular backups, restoring databases and files, and logging all actions to ensure transparency and accountability. This tool is ideal for developers, system administrators, and IT professionals who need reliable backup and restore mechanisms with clear logging capabilities.\n\n---\n\n## Key Features\n\n### 1. Backup and Restore\n- **Schema-Only or Data-only dump file**: Create backups dump file either complete dump file or data only or schema only \n- **Scheduled Backups**: Create backups for databases and local files on a schedule.\n- **Scheduled Restore**: Create Restores for databases and local files on a schedule.\n- **Versioning Backups**: Provide custom versioning for backup local files.\n\n### 2. Encryption/Decryption\n- **Security**: Uses AES for cryptographic securitry\n- **Encryption and Decryption**: Uses AES algorithm for cryptography\n\n### 2.Database Management\n  - Allows managing databases and Logs through simple CLI commands ie `CURDL`.\n  - Supports connecting to multiple database types and systems.\n  \n### 3. Logging And Alerting\n- **Detailed Logs**: Monitor status and troubleshoot with comprehensive logs ie, includes timestamps, error messages, and additional context for troubleshooting.\n- **Alert Mechanism**: Tracks both successful and failed backup and restore processes and sends email alert in case of failure backup/restore process to ensure immediate action can be taken.\n- **Retry Mechanisms**: Track and retry failed tasks automatically.\n\n---\n\n# Project: xnap\n\nThis project, `xnap`, is built using the Go programming language. Below is a list of the main technologies, libraries, and dependencies used in this project.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/home.png\" alt=\"xnap Logo\" width=\"800\"\u003e\n\u003c/p\u003e\n\n### *Brief Command Screenshot*\n\n\u003e *Database*\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/db.png\" alt=\"xnap Logo\" width=\"800\"\u003e\n\u003c/p\u003e\n\n\u003e *Database backup*\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/db_backup_create.png\" alt=\"xnap Logo\" width=\"800\"\u003e\n\u003c/p\u003e\n\n\u003e *Database restore*\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/db_restore.png\" alt=\"xnap Logo\" width=\"800\"\u003e\n\u003c/p\u003e\n\n\u003e *Backup and Restore Logs*\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/db_log_ls.png\" alt=\"xnap Logo\" width=\"800\"\u003e\n\u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/db_log_rm.png\" alt=\"xnap Logo\" width=\"800\"\u003e\n\u003c/p\u003e\n\n\u003e *Local Storage*\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/local.png\" alt=\"xnap Logo\" width=\"800\"\u003e\n\u003c/p\u003e\n\n\u003e *Local file Backup*\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/local_backup.png\" alt=\"xnap Logo\" width=\"800\"\u003e\n\u003c/p\u003e\n\n\u003e *Local file Restoration*\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/local_restore.png\" alt=\"xnap Logo\" width=\"800\"\u003e\n\u003c/p\u003e\n\n\n## Technologies and Libraries Used\n\n### Go Version\n- **Go**: 1.23.4\n\n### Main Dependencies\n\n- **Cobra**: v1.8.1  \n  A library for creating powerful modern CLI applications.\n\n- **Termlink**: v1.4.2  \n  A library for easy handling of terminal links (hyperlinks) in terminal environments.\n\n- **GORM**:  \n  - **GORM ORM**: v1.25.12  \n    The ORM library for Go for interacting with databases.\n  - **MySQL Driver**: v1.5.7  \n    MySQL driver for GORM.\n  - **PostgreSQL Driver**: v1.5.11  \n    PostgreSQL driver for GORM.\n\n- **Godotenv**: v1.5.1  \n  A Go library for loading environment variables from `.env` files.\n\n- **Color**: v1.5.4  \n  A library for easy terminal color manipulation and output formatting.\n\n- **Tablewriter**: v0.0.5  \n  A Go package for rendering tables in the terminal with customizable options.\n\n- **SMTP Server**:\n  A server for sending, receiving, and relaying outgoing emails between mail servers\n\n---\n\n## Environment Variables\n\n```env\n# Server\nDB_HOST=\nPORT=\n\n# MySQLDatabase\nMySQL_DB_HOST=\nMySQL_DB_PORT=\n\n#PostgresDatabase\nPOSTGRES_DB_HOST=\nPOSTGRES_DB_PORT=\n\n#xnap DB\nXNAP_DB=\nXNAP_LOGS_TABLE=\nXNAP_BACKUP_TABLE=\n\n#SMTP for Gmail\nFROM_EMAIL=\nFROM_EMAIL_PASSWORD=\"use passkey\"\nFROM_EMAIL_SMTP=\"smtp.gmail.com\"\nSMTP_ADDR=\"\"smtp.gmail.com:587\"\nOWNER_EMAIL=\n\n#Variables\nBACKUP_OR_RESTORE_STATUS=\"failure\"\n\n#Crypto\nAES_KEY_SIZE=32\nKEY_LOCATION=.xnap\nKEY_FILE=key\n```\n\n## xnap Database Schemas \n\n### MySQL Tables Schema\n\n- **Logs**\n\n```sql\nCREATE TABLE logs (\n    id CHAR(36) PRIMARY KEY DEFAULT (UUID()),\n    action VARCHAR(255) NOT NULL,\n    command VARCHAR(255) NOT NULL,\n    status VARCHAR(255) NOT NULL,\n    error_message TEXT,\n    user_name VARCHAR(255),\n    execution_duration DOUBLE DEFAULT 0,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP\n);\n```\n\n- **backups**\n\n```sql\nCREATE TABLE backups (\n    id BINARY(16) PRIMARY KEY DEFAULT (UUID_TO_BIN(UUID())),\n    file_name VARCHAR(255) NOT NULL UNIQUE,\n    source_path TEXT NOT NULL,\n    backup_path TEXT NOT NULL,\n    og_file_name TEXT NOT NULL,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP\n);\n```\n\n### PSQL Table Schemas\n\n\u003e **_NOTE:_**  If uuid extension not installed.\n\n```sql\nCREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";\n```\n\n- **logs**\n\n```sql\nCREATE TABLE logs (\n    id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),\n    action VARCHAR(255) NOT NULL,\n    command VARCHAR(255) NOT NULL,\n    status VARCHAR(255) NOT NULL,\n    error_message TEXT,\n    user_name VARCHAR(255),\n    execution_duration DOUBLE PRECISION DEFAULT 0,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n);\n```\n\n- **backups**\n\n```sql\nCREATE TABLE backups (\n    id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),\n    file_name VARCHAR(255) NOT NULL UNIQUE,\n    source_path TEXT NOT NULL,\n    backup_path TEXT NOT NULL,\n    og_file_name TEXT NOT NULL,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkshitiz-mhto%2Fxnap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkshitiz-mhto%2Fxnap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkshitiz-mhto%2Fxnap/lists"}