{"id":19931556,"url":"https://github.com/peterhenryd/supermodel","last_synced_at":"2025-06-13T20:34:55.286Z","repository":{"id":221624890,"uuid":"754919126","full_name":"peterhenryd/supermodel","owner":"peterhenryd","description":"Supermodel is an abstract data-modeling library written in Rust.","archived":false,"fork":false,"pushed_at":"2024-04-19T19:55:03.000Z","size":74,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-09T06:10:33.386Z","etag":null,"topics":["sql"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/peterhenryd.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":"ROADMAP.md","authors":null,"dei":null}},"created_at":"2024-02-09T02:44:00.000Z","updated_at":"2024-04-16T00:44:04.000Z","dependencies_parsed_at":"2024-04-19T20:49:16.428Z","dependency_job_id":"caa36726-51fa-499f-9ca1-b48078b11160","html_url":"https://github.com/peterhenryd/supermodel","commit_stats":null,"previous_names":["peterhenryd/supermodel"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhenryd%2Fsupermodel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhenryd%2Fsupermodel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhenryd%2Fsupermodel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhenryd%2Fsupermodel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterhenryd","download_url":"https://codeload.github.com/peterhenryd/supermodel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224360247,"owners_count":17298319,"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","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":["sql"],"created_at":"2024-11-12T23:07:28.365Z","updated_at":"2024-11-12T23:07:29.080Z","avatar_url":"https://github.com/peterhenryd.png","language":"Rust","readme":"# supermodel\n[![https://img.shields.io/crates/v/supermodel](https://img.shields.io/badge/crates.io-supermodel-red)](https://crates.io/crates/supermodel)\n[![https://img.shields.io/crates/v/supermodel__macros](https://img.shields.io/badge/crates.io-supermodel--macros-orange)](https://crates.io/crates/supermodel-macros)\n[![https://img.shields.io/crates/v/supermodel__sqlx](https://img.shields.io/badge/crates.io-supermodel--sqlx-yellow)](https://crates.io/crates/supermodel-sqlx)\n\nSupermodel is an abstract data-modeling library. It provides an interface for creating, editing, and modifying data in various types of databases and APIs.\n\n## Goals\n- **Be generic.** The library tries be as abstract as possible. This allows the same code to be used for multiple purposes. Moreover, this means prioritizing the Rust type system over the type system of a database implementation.\n- **Be intuitive.** Supermodel is centered around the `Model` and `Dialect` trait. With an implementation of a Dialect (typically through a crate like `supermodel-sqlx`) and an implementation of a Model (typically through the `model` proc-macro), all of Supermodel's features can be accessed.\n- **Be fast.** While I would not consider myself skilled at high-performance Rust, this library aims to be only a thin layer over its implementations when it comes to runtime performance.\n \n## Examples\n\n```rs\n#[model(Postgres)]\n#[name = \"users\"]\npub struct User {\n    username: String,\n    password: String\n}\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), sqlx::Error\u003e {\n    dotenv().expect(\"initializing .env file\");\n\n    let url = std::env::var(\"DATABASE_URL\").expect(\"missing DATABASE_URL in env\");\n    let mut connection = Postgres::create_connection(\u0026url).await?;\n\n    User::register().execute(\u0026mut connection).await?;\n\n    Ok(())\n}\n```\n\nGenerated SQL:\n```sql\ncreate table if not exists users\n(\n    id       bigserial\n             primary key,\n    username varchar(30),\n    password varchar(30)\n);\n```\n\nCheck out some more example programs written with Supermodel [here](https://github.com/peterhenryd/supermodel/tree/main/packages/supermodel/examples).\n\n## Usability\n\nSupermodel currently compiles, but is largely unusable. It only supports a handful of data types and many operations are unimplemented. Moreover, the API is very unstable as I haven't yet decided the best way to go about certain things.\n\n## Roadmap\n\nCheck out the plans for the future of this library [here](https://github.competerhenryd/supermodel/tree/main/ROADMAP.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterhenryd%2Fsupermodel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterhenryd%2Fsupermodel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterhenryd%2Fsupermodel/lists"}