{"id":28230481,"url":"https://github.com/almeidazs/vust","last_synced_at":"2026-04-06T08:01:14.715Z","repository":{"id":246825639,"uuid":"819507899","full_name":"almeidazs/vust","owner":"almeidazs","description":"The modern and secure local TypeScript database","archived":false,"fork":false,"pushed_at":"2024-07-07T15:44:16.000Z","size":170,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-10T16:46:30.339Z","etag":null,"topics":["database","driver","json","local","localdatabase","mongodb","mongoose"],"latest_commit_sha":null,"homepage":"https://discord.gg/J2YBETNw","language":"TypeScript","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/almeidazs.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}},"created_at":"2024-06-24T16:37:13.000Z","updated_at":"2024-07-07T15:44:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"0902a1f4-7b4e-4422-ac9d-68058a0bb795","html_url":"https://github.com/almeidazs/vust","commit_stats":null,"previous_names":["yunreal/vust","savageszz/vust","almeidazs/vust"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/almeidazs/vust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almeidazs%2Fvust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almeidazs%2Fvust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almeidazs%2Fvust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almeidazs%2Fvust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/almeidazs","download_url":"https://codeload.github.com/almeidazs/vust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almeidazs%2Fvust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31464101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"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":["database","driver","json","local","localdatabase","mongodb","mongoose"],"created_at":"2025-05-18T17:14:57.731Z","updated_at":"2026-04-06T08:01:14.673Z","avatar_url":"https://github.com/almeidazs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vust\n\nThe modern and secure local TypeScript database\n\n## Why?\n\nThis local database aims to guide new developers to learn how to use NoSQL database\n\n-   You need to have the [Node.js](http://nodejs.org/) installed\n\nNext step is install the vust library:\n\n```bash\nnpm install vust --save\n```\n\n## Create a Schema\n\nVust has full support to TypeScript, so you can create a schema based in a interface or type. Schemas are the way how Vust must manage/validate the data.\n\n```ts\ninterface User {\n    name: string;\n    age: number;\n}\n\nconst userSchema = new Schema\u003cUser\u003e({\n    name: S.string(),\n    age: S.number().integer({ message: 'Age must be an integer!' }),\n});\n```\n\nNow we have our schema that has 2 keys (`name` and `age`), that is how our data will be saved. Now we have to create our collection to save/read/find/update the data.\n\n```ts\nconst users = collection('users', userSchema);\n```\n\nThe collection is where the magic happens, where our documents will be saved, created, updated, deleted and found. Each document has all properties declared in the Schema and an unique identifier (`_uid`) used in the collection.\n\nLet's create a new user:\n\n```ts\nconst { data } = users.create({\n    username: 'Drezzy',\n    age: 18,\n});\n\nconsole.log(`User name is: ${data.username}`);\n```\n\nFinding the user:\n\n```ts\nconst drezzy = users.findUnique({ query: { username: 'Drezzy' } });\n\nconsole.log(drezzy.data.age);\n```\n\nDeleting the user:\n\n```ts\nusers.deleteOne({ _uid: drezzy._uid });\n\n// Or we can just delete by the user document\n\ndrezzy.delete();\n```\n\nUpdating the user:\n\n```ts\nconst { data: newDrezzy } = users.updateOne(\n    { query: { Greater: { age: 17 } } },\n    { Increment: { age: 1 } }\n);\n\nconsole.log(`Now \"${newDrezzy.username}\" is ${newDrezzy.age} years old!`);\n```\n\n### Congrats\n\nNow you know how to manage any data with Vust!\n\n## Managing the data by yourself\n\nVust let you to manage the data by yourself, like reading and updating any data in a JSON file. For it, use `JSONDriver` driver.\n\n```ts\nimport { JSONDriver } from 'vust';\n\nconst users = new JSONDriver('./database/users.json');\n\nusers.update((currentData) =\u003e (currentData['Me'] = { username: 'John' }));\n\n// Will print something like: `{ \"Me\": { \"username\": \"John\" } }`\nconsole.log(users.read());\n```\n\n## Schema\n\nAs you read above, schemas are the way that Vust knows how to save the data in the database.\n\n### Types\n\nVust has a huge variety of types for schemas:\n\n-   Any: `S.any()` (Represents any value)\n-   BigInt: `S.bigint()` (Represents a bigint)\n-   Boolean: `S.boolean()` (Represents a boolean)\n-   Date: `S.date()` (Represents any valid date)\n-   Literal: `S.literal(\u003cV\u003e)` (Reprents a literal value, a value that never change)\n-   Number: `S.number()` (Represents a number, float or integer)\n-   Object: `S.object(\u003cShape\u003e)` (Represents a shaped object)\n-   Record: `S.record(\u003cKey\u003e, \u003cValue\u003e)` (Represents **any** object)\n-   String: `S.string()` (Represents a string)\n-   UUID: `S.id()` (Represents the unique identifier of a document)\n-   Unions: `S.union(...\u003cUnions\u003e)` (Represents a union of values)\n-   Array: `S.array(...\u003cItems\u003e)` (Represents an array)\n-   Tuple: `S.tuple(...\u003cItems\u003e)` (Represents a tuple)\n-   Buffer: `S.buffer()` (Represents a buffer)\n\n#### Unions\n\nUnions are custom schema keys that can be of a type or another type. Example:\n\n```ts\ninterface User {\n    name: string;\n    age: number | string;\n}\n\nnew Schema\u003cUser\u003e({\n    name: S.string(),\n    age: S.union(S.string(), S.number()),\n});\n```\n\n-   Here the key `age` can be a string or a number.\n\n#### Literal\n\nLiteral schema key reprents a literal value, a value that never changes\n\n```ts\ninterface Me {\n    name: 'John';\n    age: number;\n}\n\nnew Schema\u003cMe\u003e({\n    age: S.literal('John'),\n    age: S.number().integer(),\n});\n```\n\n#### Object\n\nObject schema key represents a shaped object\n\n```ts\ninterface Post {\n    content: string;\n    author: {\n        id: string;\n        name: string;\n    };\n}\n\nnew Schema\u003cPost\u003e({\n    content: S.string().min(50),\n    author: S.object({\n        id: S.string(),\n        name: S.string(),\n    }),\n});\n```\n\n#### Record\n\nRecord schema key represents **any** object\n\n```ts\ninterface User {\n    name: string;\n    children: Record\u003cstring, { age: number }\u003e;\n}\n\nnew Schema\u003cUser\u003e({\n    name: S.string(),\n    children: S.record(S.string(), S.object({ age: S.number() })),\n});\n```\n\n#### Array\n\nArray schema key represents any array\n\n```ts\ninterface StartWars {\n    jedis: ({ name: string } | string)[];\n}\n\nnew Schema\u003cStarWars\u003e({\n    jedis: S.array(S.object({ name: S.string() }), S.string()),\n});\n```\n\n#### Tuple\n\nTuple schema key represents a tuple\n\n```ts\ninterface Candy {\n    name: string;\n    specs: [is_sweet: true, ingredients: string];\n}\n\nnew Schema\u003cCandy\u003e({\n    name: S.string(),\n    specs: S.tuple(S.literal(true), S.string()),\n});\n```\n\n## Congrats\n\nNow you know the basic of Vust!\n\n## Support\n\nIf you need help with Vust, join in our [Discord Server](https://discord.gg/J2YBETNw)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmeidazs%2Fvust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falmeidazs%2Fvust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmeidazs%2Fvust/lists"}