{"id":30078588,"url":"https://github.com/rohittcodes/vibe-coded-db","last_synced_at":"2025-08-08T17:29:28.464Z","repository":{"id":305274158,"uuid":"996720711","full_name":"rohittcodes/vibe-coded-db","owner":"rohittcodes","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-07T11:12:56.000Z","size":172,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-30T22:26:38.360Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/rohittcodes.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":"2025-06-05T11:10:58.000Z","updated_at":"2025-07-11T14:40:28.000Z","dependencies_parsed_at":"2025-07-19T10:26:51.951Z","dependency_job_id":"e84699c3-fc9e-4cb7-ac9c-08b0c86dde32","html_url":"https://github.com/rohittcodes/vibe-coded-db","commit_stats":null,"previous_names":["rohittcodes/vibe-coded-db"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rohittcodes/vibe-coded-db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittcodes%2Fvibe-coded-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittcodes%2Fvibe-coded-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittcodes%2Fvibe-coded-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittcodes%2Fvibe-coded-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rohittcodes","download_url":"https://codeload.github.com/rohittcodes/vibe-coded-db/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittcodes%2Fvibe-coded-db/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269459164,"owners_count":24420539,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-08-08T17:29:23.507Z","updated_at":"2025-08-08T17:29:28.454Z","avatar_url":"https://github.com/rohittcodes.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Time Series Database (TSDB) with DataCrate Support\n\nA high-performance time series database written in Rust, featuring the innovative DataCrate concept for organizing time series data. This database is optimized specifically for time-based data operations with built-in SQL-like query capabilities and efficient data management.\n\n## Features\n\n### Core TSDB Features\n- **DataCrate Organization**: Logical grouping of time series tables with individual retention policies\n- **Time Series Engine**: Optimized storage and indexing for time-stamped data\n- **SQL-like Query Language**: Flexible querying with time range filtering and aggregation\n- **Schema Management**: Define fields and tags for structured time series data\n- **Efficient Indexing**: Separate indices for time-based and tag-based queries\n- **Retention Policies**: Automatic data expiration at both DataCrate and table levels\n\n### Time Series Database (TSDB) with DataCrate Support\n- **DataCrate Concept**: Organize time series data into logical collections (similar to databases)\n- **Multiple Tables**: Each datacrate can contain multiple tables with different schemas\n- **Retention Policies**: Set retention at both datacrate and table level\n- **Schema Management**: Define fields and tags for structured data storage\n- **Efficient Indexing**: Optimized for both time-based and tag-based queries\n- **Command Structure**: Dedicated command sets for crate, table, and data operations\n\n### Query Language\n- **Time Range Queries**: Efficient filtering by timestamp ranges\n- **Tag-based Filtering**: Filter by metadata tags (host, region, etc.)\n- **Field Selection**: Choose specific fields to retrieve\n- **Aggregation Functions**: COUNT, SUM, AVG, MIN, MAX with time grouping\n- **Sorting and Limiting**: ORDER BY timestamp with result limits\n- **Complex WHERE Clauses**: Multiple conditions with AND/OR logic\n\n### Performance \u0026 Storage\n- **Compression**: Automatic data compression for storage efficiency\n- **Time-based Partitioning**: Efficient data organization by time periods\n- **Concurrent Access**: Thread-safe operations for multiple clients\n- **Memory Management**: Configurable caching with high hit ratios\n- **Batch Operations**: Optimized bulk insert and query operations\n\n## Running the Application\n\nThere are multiple ways to run the application:\n\n### Using the run.cmd Script (Windows)\nSimply run the `run.cmd` script and select an option:\n```\nrun.cmd\n```\n\n### Running the TSDB Demo (Windows)\nTo run a demonstration of the time series database functionality:\n```\nrun_tsdb_demo.cmd\n```\n\n### Running the DataCrate TSDB Demo (Windows)\nTo run a demonstration of the datacrate-based time series database functionality:\n```\nrun_datacrate_demo.cmd\n```\n\n### Using Cargo Directly\nTo run the server:\n```\ncargo run --bin my-database-app\n```\n\nTo run the client:\n```\ncargo run --bin client\n```\n\nMake sure the server is running before connecting with the client.\n\n## Database Commands\n\nOnce the client is running, you can use the following commands:\n\n### DataCrate Commands\n\n| Command | Description | Example |\n|---------|-------------|---------|\n| `TSDB_CREATE_CRATE \u003cname\u003e \"\u003cdescription\u003e\" [retention_days]` | Create a new DataCrate | `TSDB_CREATE_CRATE metrics \"System metrics\" 90` |\n| `TSDB_LIST_CRATES` | List all DataCrates | `TSDB_LIST_CRATES` |\n| `TSDB_GET_CRATE \u003cname\u003e` | Get DataCrate information | `TSDB_GET_CRATE metrics` |\n| `TSDB_DELETE_CRATE \u003cname\u003e` | Delete a DataCrate | `TSDB_DELETE_CRATE metrics` |\n\n### Table Commands\n\n| Command | Description | Example |\n|---------|-------------|---------|\n| `TSDB_CREATE_TABLE \u003ccrate\u003e \u003ctable\u003e \u003cfield_name\u003e:\u003ctype\u003e [\u003ctag_name\u003e, ...]` | Create a table | `TSDB_CREATE_TABLE metrics cpu_usage value:float host,region` |\n| `TSDB_LIST_TABLES \u003ccrate\u003e` | List tables in a crate | `TSDB_LIST_TABLES metrics` |\n| `TSDB_GET_SCHEMA \u003ccrate\u003e \u003ctable\u003e` | Get table schema | `TSDB_GET_SCHEMA metrics cpu_usage` |\n| `TSDB_DELETE_TABLE \u003ccrate\u003e \u003ctable\u003e` | Delete a table | `TSDB_DELETE_TABLE metrics cpu_usage` |\n\n### Data Commands\n\n| Command | Description | Example |\n|---------|-------------|---------|\n| `TSDB_INSERT \u003ccrate\u003e \u003ctable\u003e \u003ctimestamp\u003e \u003cfield\u003e=\u003cvalue\u003e [\u003ctag\u003e=\u003cvalue\u003e, ...]` | Insert time series data | `TSDB_INSERT metrics cpu_usage 1645123200 value=85.2 host=server1,region=us-east` |\n| `TSDB_QUERY \u003ccrate\u003e [\u003ctable\u003e] [START \u003ctimestamp\u003e] [END \u003ctimestamp\u003e] [WHERE \u003cconditions\u003e]` | Query time series data | `TSDB_QUERY metrics cpu_usage START 1645123200 END 1645126800 WHERE host=server1` |\n| `TSDB_DELETE \u003ccrate\u003e \u003ctable\u003e START \u003cstart\u003e END \u003cend\u003e [WHERE \u003cconditions\u003e]` | Delete time series data | `TSDB_DELETE metrics cpu_usage START 1645123200 END 1645126800` |\n\n### SQL-like Queries\n\nYou can also use SQL-like syntax for complex queries:\n\n```sql\nSELECT value, timestamp FROM cpu_usage \nWHERE host = 'server1' AND timestamp \u003e= 1645123200 \nORDER BY timestamp DESC LIMIT 100;\n\nSELECT AVG(value) as avg_cpu, COUNT(*) as samples\nFROM cpu_usage \nWHERE timestamp \u003e= 1645123200 \nGROUP BY timestamp / 3600;\n```\n\n### Legacy Time Series Commands (for backward compatibility)\n\n| Command | Description | Example |\n|---------|-------------|---------|\n| `TS_INSERT \u003cmeasurement\u003e \u003ctimestamp\u003e \u003cfield\u003e=\u003cvalue\u003e [\u003ctag\u003e=\u003cvalue\u003e, ...]` | Insert time series data | `TS_INSERT cpu_usage 1645123200 value=85.2 host=server1` |\n| `TS_QUERY \u003cmeasurement\u003e [START \u003ctimestamp\u003e] [END \u003ctimestamp\u003e] [WHERE \u003cconditions\u003e]` | Query time series data | `TS_QUERY cpu_usage START 1645123200 WHERE host=server1` |\n| `SELECT \u003cfields\u003e FROM \u003cmeasurement\u003e WHERE \u003cconditions\u003e` | Query data from a measurement | `SELECT value, unit FROM temperature_reading WHERE value \u003e 20` |\n| `DELETE FROM \u003cmeasurement\u003e WHERE \u003cconditions\u003e` | Delete data from a measurement | `DELETE FROM temperature_reading WHERE value \u003c 0` |\n| `CREATE RETENTION POLICY \u003cname\u003e ON \u003cmeasurement\u003e DURATION \u003cduration\u003e REPLICATION \u003cn\u003e` | Create a retention policy | `CREATE RETENTION POLICY one_week ON temperature_reading DURATION 7d REPLICATION 1` |\n| `SHOW MEASUREMENTS` | List all measurements | `SHOW MEASUREMENTS` |\n| `SHOW TAG KEYS FROM \u003cmeasurement\u003e` | Show tag keys for a measurement | `SHOW TAG KEYS FROM temperature_reading` |\n| `SHOW FIELD KEYS FROM \u003cmeasurement\u003e` | Show field keys for a measurement | `SHOW FIELD KEYS FROM temperature_reading` |\n\n## Project Structure\n\n```\nmy-database-app\n├── src\n│   ├── main.rs                    # Entry point and server implementation\n│   ├── database.rs                # Core database operations\n│   ├── compression.rs             # Data compression utilities\n│   ├── storage\n│   │   ├── disk.rs               # Persistent storage with WAL\n│   │   └── memory.rs             # In-memory storage\n│   ├── query\n│   │   ├── parser.rs             # SQL and ML command parser\n│   │   └── executor.rs           # Query execution engine\n│   ├── tsdb                      # Time Series Database\n│   │   ├── types.rs              # TSDB data structures\n│   │   ├── index.rs              # Time and tag indexing\n│   │   ├── query.rs              # SQL-like query parser and executor\n│   │   └── storage.rs            # TSDB storage engine\n│   └── ml\n│       ├── predictor.rs          # ML model management\n│       ├── feature_engineering.rs # Automated feature engineering\n│       └── time_series.rs        # Time series analysis\n├── tests\n│   ├── integration_tests.rs       # Integration tests\n│   └── tsdb_tests.rs             # TSDB specific tests\n├── Cargo.toml                     # Project configuration\n└── README.md                      # Documentation\n```\n\n### Key Components\n\n#### Storage Layer\n- `disk.rs`: Implements persistent storage with Write-Ahead Logging\n- `memory.rs`: Provides high-performance in-memory storage\n- `compression.rs`: Handles data compression using multiple algorithms\n\n#### Time Series Database\n- `types.rs`: Core TSDB data structures and schemas\n- `index.rs`: Efficient time-based and tag-based indexing\n- `query.rs`: SQL-like query language for time series data\n- `storage.rs`: Specialized storage engine for time series data\n\n#### Query Processing\n- `parser.rs`: Parses both traditional SQL and ML-specific commands\n- `executor.rs`: Executes queries and manages transaction flow\n\n#### Machine Learning\n- `predictor.rs`: Manages ML models, training, and predictions\n- `feature_engineering.rs`: Automates feature selection and engineering\n- `time_series.rs`: Handles time series analysis and forecasting\n\n## Usage Examples\n\n### Basic Database Operations\n```\n-- Insert data\nINSERT 1 {\"temperature\": 25.5, \"humidity\": 60}\n\n-- Query data\nGET 1\n\n-- List all records\nLIST\n\n-- Count records\nCOUNT\n\n-- Search records by content\nSEARCH temperature\n\n-- Delete data\nDELETE 1\n```\n\n### Time Series Database Operations\n```\n-- Create a measurement\nTS.CREATE \"{\\\"name\\\":\\\"weather\\\",\\\"fields\\\":{\\\"temperature\\\":0.0,\\\"humidity\\\":0.0,\\\"pressure\\\":0.0},\\\"retention_policy\\\":{\\\"Duration\\\":2592000}}\"\n\n-- Insert time series data\nTS.INSERT weather \"{\\\"timestamp\\\":\\\"2025-06-06T12:00:00Z\\\",\\\"fields\\\":{\\\"temperature\\\":72.5,\\\"humidity\\\":45.0,\\\"pressure\\\":1013.2},\\\"tags\\\":{\\\"location\\\":\\\"NYC\\\",\\\"station\\\":\\\"central\\\"}}\"\n\n-- Simple query\nTS.QUERY \"SELECT temperature, humidity FROM weather WHERE TIME \u003e= '2025-06-01T00:00:00Z' AND TIME \u003c= '2025-06-07T00:00:00Z'\"\n\n-- Query with tag filter\nTS.QUERY \"SELECT temperature, humidity FROM weather WHERE location = 'NYC'\"\n\n-- Aggregation query\nTS.QUERY \"SELECT AVG(temperature), MAX(humidity), MIN(pressure) FROM weather GROUP BY TIME(6h)\"\n\n-- List all measurements\nTS.LIST\n```\n\nFor more detailed documentation, see [TSDB.md](docs/TSDB.md).\n\n### Machine Learning Operations\n```sql\n-- Create and train a predictor\nCREATE PREDICTOR weather_forecast\nFROM weather_data\nPREDICT temperature\nUSING features (humidity, pressure, wind_speed)\nWITH time_series_settings (\n    time_column='timestamp',\n    horizon=24,\n    window_size=168\n);\n\n-- Make predictions\nSELECT temperature, confidence, explanation\nFROM weather_forecast\nWHERE humidity = 65 AND pressure = 1013;\n\n-- Get feature importance\nEXPLAIN weather_forecast\nWITH feature_importance = true;\n```\n\n### Time Series Analysis\n```sql\n-- Create a time series predictor\nCREATE PREDICTOR stock_forecast\nFROM stock_data\nPREDICT price\nUSING features (volume, open, close, high, low)\nWITH time_series_settings (\n    time_column='date',\n    horizon=7,\n    window_size=30\n);\n\n-- Get forecast with confidence intervals\nSELECT price, confidence_interval, seasonal_components\nFROM stock_forecast\nNEXT 7 DAYS;\n```\n\n## Setup Instructions\n\n1. Install Rust (if not already installed):\n   ```bash\n   curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n   ```\n\n2. Clone and build the project:\n   ```bash\n   git clone \u003crepository-url\u003e\n   cd my-database-app\n   cargo build --release\n   ```\n\n3. Run the database server:\n   ```bash\n   cargo run --release\n   ```\n\nThe server will start on `localhost:8080` by default.\n\n## Usage\n\nAfter running the application, you can interact with the database through the provided commands. Refer to the documentation in the source files for detailed usage instructions.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohittcodes%2Fvibe-coded-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohittcodes%2Fvibe-coded-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohittcodes%2Fvibe-coded-db/lists"}