{"id":29274956,"url":"https://github.com/charliedigital/nestia-api","last_synced_at":"2025-07-05T05:09:12.571Z","repository":{"id":286485810,"uuid":"961547385","full_name":"CharlieDigital/nestia-api","owner":"CharlieDigital","description":"Experiments with Nestia, Typia, Kysely, and Nest.js","archived":false,"fork":false,"pushed_at":"2025-04-06T18:32:14.000Z","size":148,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T19:32:38.148Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/CharlieDigital.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":"2025-04-06T18:29:52.000Z","updated_at":"2025-04-06T18:32:17.000Z","dependencies_parsed_at":"2025-04-06T19:43:00.402Z","dependency_job_id":null,"html_url":"https://github.com/CharlieDigital/nestia-api","commit_stats":null,"previous_names":["charliedigital/nestia-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CharlieDigital/nestia-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlieDigital%2Fnestia-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlieDigital%2Fnestia-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlieDigital%2Fnestia-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlieDigital%2Fnestia-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CharlieDigital","download_url":"https://codeload.github.com/CharlieDigital/nestia-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlieDigital%2Fnestia-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263687157,"owners_count":23496090,"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":[],"created_at":"2025-07-05T05:09:08.408Z","updated_at":"2025-07-05T05:09:12.566Z","avatar_url":"https://github.com/CharlieDigital.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nestia + Typia\n\n## Motivation\n\nTypeScript lacks runtime types and this creates issues when working in scenarios where data quality matters because there are no runtime types.\n\nTo work around this, packages like Zod, Valibot, class-validator, et al allow modeling of schemas that remain at runtime (whereas the TypeScript itself disappears at build).  However, this precisely means that there is an excess of modeling code being written.\n\nWhile the mechanism of Zod and Valibot is different from class-validator, both approaches effectively require the user to provide additional runtime artifacts (schema objects versus decorator functions) which provide the type metadata at runtime.  In the case of Zod and Valibot, this means creating runtime schema objects.  In the case of class-validator, this means creating runtime function wrappers using decorators.\n\nWhere Typia and Nestia differ is that the solution approach is *build time* meaning that at the point of build, it alters the actual underlying code and inlines the JavaScript type checking.  This yields significant performance benefits ([see the benchmarks](https://moltar.github.io/typescript-runtime-type-benchmarks/)) while also simplifying the data modelling process by removing much of the duplication that occurs with pure runtime solutions.\n\nIn this codebase, we explore the ergonomics and DX or working with Typia, Nestia, and Kysely.\n\n## Layout\n\nThis section documents the key points in this source tree.\n\n```\n/root\n  └─ /.config\n    └─ kysely.config.ts       # Kysely CTL (CLI) configuration file\n  └─ /packages\n    └─ /api                   # Nestia generated SDK package\n    └─ /client                # Sample TypeScript client generated using openapi-typescript-codegen tooling\n    └─ /nestia-client         # Sample client generated using Nestia's built in SDK generation\n    └─ model.ts               # Model file for this app\n  └─ nestia.config.ts         # Config file for the Nestia CLI for Swagger gen\n  └─ tsconfig.json            # Auto configured during npx nestia setup\n```\n\n## Setup\n\n```shell\n# If you don't already have the Nest CLI\nnpm i -g @nestjs/ci\n\n# Create a normal Nest.js app\nnest new nestia-api # (Or whatever you want to call your project)\n\n# Install Nestia\nyarn -D nestia@latest\n\n# Run the setup wizard: https://nestia.io/docs/setup/#setup-wizard\nnpx nestia setup\n\n# Install pg driver\nyarn add pg\nyarn add @types/pg\n\n# Install Kysely\nyarn add kysely\n\n# Install Kysely-ctl\nyarn add -D kysely-ctl\n```\n\n## Swagger\n\nNestia includes facilities for generating the OpenAPI spec file:\n\n```shell\n# Config for build time generation is in nestia.config.ts\nnpx nestia swagger\n\n# To generate clients as well\nnpx nestia sdk\n```\n\nIt can also generate SDK \"packages\"\n\n## Resources\n\n- [Nestia Docs](https://nestia.io/docs/pure/)\n- [Typia Docs](https://typia.io/docs/validators/tags/)\n- [Nestia Swagger](https://nestia.io/docs/swagger/)\n- [Kysely vs Drizzle](https://www.reddit.com/r/node/comments/1c0776v/kysely_or_drizzle/)\n- [Query Type Safety with Kysely](https://github.com/thetutlage/meta/discussions/8)\n- [Kysely CTL](https://github.com/kysely-org/kysely-ctl)\n- [Kysely in Action](https://marmelab.com/blog/2024/02/14/type-safe-sql-wheries-with-kysely.html)\n- [Swagger Viewer](https://editor-next.swagger.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharliedigital%2Fnestia-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharliedigital%2Fnestia-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharliedigital%2Fnestia-api/lists"}