{"id":13514997,"url":"https://github.com/nksaraf/vinxi","last_synced_at":"2025-05-12T13:08:29.641Z","repository":{"id":178150822,"uuid":"661072965","full_name":"nksaraf/vinxi","owner":"nksaraf","description":"The Full Stack JavaScript SDK","archived":false,"fork":false,"pushed_at":"2025-04-27T20:52:48.000Z","size":31147,"stargazers_count":2580,"open_issues_count":114,"forks_count":96,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-05-12T13:07:54.175Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://vinxi.vercel.app","language":"JavaScript","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/nksaraf.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":"2023-07-01T17:47:37.000Z","updated_at":"2025-05-12T06:35:50.000Z","dependencies_parsed_at":"2023-11-18T21:25:16.630Z","dependency_job_id":"c9e27f05-6fdf-49e3-a9ec-1d7248760d57","html_url":"https://github.com/nksaraf/vinxi","commit_stats":null,"previous_names":["nksaraf/vinxi"],"tags_count":208,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nksaraf%2Fvinxi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nksaraf%2Fvinxi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nksaraf%2Fvinxi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nksaraf%2Fvinxi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nksaraf","download_url":"https://codeload.github.com/nksaraf/vinxi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745155,"owners_count":21957317,"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":"2024-08-01T05:01:05.152Z","updated_at":"2025-05-12T13:08:29.626Z","avatar_url":"https://github.com/nksaraf.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","others","Plugins","SSR"],"sub_categories":["Libraries"],"readme":" \u003cp align=\"center\"\u003e\n  \u003ch1  align=\"center\" \u003e\u003cimg src=\"/docs/public/logo.png\" width=\"196\" /\u003e\u003c/h1\u003e\n  \u003cp align=\"center\"\u003e\n\t \u003ci\u003eThe JavaScript toolkit to build full stack apps and frameworks with your own opinions.\u003cbr\u003epowered by \u003ccode\u003e\u003ca href=\"https://github.com/vitejs/vite\"\u003evite\u003c/a\u003e\u003c/code\u003e and \u003ccode\u003e\u003ca href=\"https://github.com/unjs/nitro\"\u003enitro\u003c/a\u003e\u003c/code\u003e\u003c/i\u003e\n  \u003c/p\u003e\n  \u003cdiv align=\"center\"\u003e\u003cimg src=\"https://badge.fury.io/js/vinxi.svg\" /\u003e\u003c/div\u003e\n\u003c/p\u003e\n\n# `vinxi`\n\nCompose full stack applications (and frameworks) using [**Vite**](https://github.com/vitejs/vite), the versatile bundler and dev server, and [**Nitro**](https://github.com/unjs/nitro), the universal production server.\n\nInspired by the [Bun.App](https://bun.sh/blog/bun-bundler#sneak-peek-bun-app) API, the core primitive in Vinxi is the **router**, which is simply a brief specification defining how a group of URLs should be handled.\n\nVinxi supports many common router types:\n\n- ['static'](https://vinxi.vercel.app/api/router/static.html) - for serving uncompiled, static assets\n- ['http'](https://vinxi.vercel.app/api/router/http.html) - for creating traditional web servers\n- ['spa'](https://vinxi.vercel.app/api/router/spa.html) - for building and serving single page application assets\n- ['client'](https://vinxi.vercel.app/api/router/client.html) - for building and serving of SSR application assets\n- [custom](https://vinxi.vercel.app/api/router/custom.html) - for adapting Vinxi to your use case\n\nCreating a new router is as simple as adding a specification object to the `routers` array in the `createApp` call:\n\n```ts\nimport { createApp } from \"vinxi\";\n\nexport default createApp({\n  routers: [\n    // A static router serving files from the `public` directory\n    {\n      name: \"public\",\n      type: \"static\",\n      dir: \"./public\",\n      base: \"/\",\n    },\n    // A http router for an api\n    {\n      name: \"api\",\n      type: \"http\",\n      handler: \"./app/api.ts\",\n      base: \"/api\",\n      plugins: () =\u003e [\n        // Vite plugins applying exclusively to `http` router\n      ],\n    },\n  ],\n});\n```\n\n---\n\nThere are currently two frameworks actively being developed on `vinxi`:\n\n- [SolidStart](https://github.com/solidjs/solid-start)\n- [TanstackStart](https://github.com/tanstack/router)\n\nThere are also a few other frameworks experimenting with vinxi:\n\n- [AngularStart](https://github.com/brandonroberts/analog-angular-start)\n\n## Examples\n\n| Framework | Category | Example                 | StackBlitz Link                                                                                                                                                                    |\n| --------- | -------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| React     | RSC      | SPA                     | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/react/rsc/spa)                 |\n|           | SPA      | Basic                   | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/react/spa/basic)               |\n|           |          | MDX                     | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/react/spa/mdx)                 |\n|           |          | TanStack Router (Pages) | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/react/spa/tanstack-router)     |\n|           |          | TanStack Router (App)   | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/react/spa/tanstack-router-app) |\n|           |          | Wouter                  | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/react/spa/wouter)              |\n|           | SSR      | Basic                   | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/react/ssr/basic)               |\n|           |          | Basic w/Cloudflare      | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/react/ssr/basic-cloudflare)    |\n|           |          | TanStack Router (App)   | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/react/ssr/tanstack-router-app) |\n|           |          | Wouter                  | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/react/ssr/wouter)              |\n| Solid     | SPA      | Basic                   | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/solid/spa/basic)               |\n|           | SSR      | Basic                   | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/solid/ssr/basic)               |\n|           |          | Solid Router            | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/solid/ssr/solid-router)        |\n| Vanilla   |          | SPA                     | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/vanilla/spa)                   |\n|           |          | TRPC                    | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/nksaraf/vinxi/tree/main/examples/vanilla/trpc)                  |\n\n## Goals\n\nPrimary goal is to build the tools needed to build a NextJS or SolidStart style metaframework on top of vite without worrying about a lot of the wiring required to keep dev and prod working along with SSR, SPA, RSC, and all the other acronyms. etc. On top of that, we should be able to deploy anywhere easily.\n\nMostly trying to disappear for the user outside the app.js file\n\nThe surface layer we are intending to tackle:\n\n1. Full stack builds (handle manifest stuff to figure out what assets to load at prod runtime)\n2. Dev time asset handling (avoiding FOUC in SSR frameworks) and smoothing over some of vite's dev/prod mismatching behaviours by providing common manifest APIs that work in dev and prod the same way\n3. File system router (not any specific file system conventions, just an API for interfacing with FileSystemRouters and utils to implement your conventions in them)\n4. Building the server, and providing a simple opaque `handler` API to control the server\n5. Adapter stuff to deploy to various platforms with support for all the features they provide\n6. Not to abstract away the platforms. Let people use what they want to the fullest\n7. Have little opinion about how the app should be authored or structured\n\n## Roadmap\n\n- [ ] `vinxi deploy`\n- [x] hooks throughout the app licycle:\n  - dev: app:created, app:started, router:created\n\n## Try it out\n\n```bash\nnpm install vinxi\n```\n\n### React SSR\n\n```ts\nimport reactRefresh from \"@vitejs/plugin-react\";\nimport { createApp } from \"vinxi\";\n\nexport default createApp({\n  routers: [\n    {\n      name: \"public\",\n      type: \"static\",\n      dir: \"./public\",\n    },\n    {\n      name: \"client\",\n      type: \"client\",\n      handler: \"./app/client.tsx\",\n      target: \"browser\",\n      plugins: () =\u003e [reactRefresh()],\n      base: \"/_build\",\n    },\n    {\n      name: \"ssr\",\n      type: \"http\",\n      handler: \"./app/server.tsx\",\n      target: \"server\",\n    },\n  ],\n});\n```\n\n### Solid SSR\n\n```ts\nimport { createApp } from \"vinxi\";\nimport solid from \"vite-plugin-solid\";\n\nexport default createApp({\n  routers: [\n    {\n      name: \"public\",\n      type: \"static\",\n      dir: \"./public\",\n    },\n    {\n      name: \"client\",\n      type: \"client\",\n      handler: \"./app/client.tsx\",\n      target: \"browser\",\n      plugins: () =\u003e [solid({ ssr: true })],\n      base: \"/_build\",\n    },\n    {\n      name: \"ssr\",\n      type: \"http\",\n      handler: \"./app/server.tsx\",\n      target: \"server\",\n      plugins: () =\u003e [solid({ ssr: true })],\n    },\n  ],\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnksaraf%2Fvinxi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnksaraf%2Fvinxi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnksaraf%2Fvinxi/lists"}