{"id":19456701,"url":"https://github.com/semicognitive/sveltekit-modal","last_synced_at":"2025-04-25T05:31:04.703Z","repository":{"id":144710199,"uuid":"600332345","full_name":"semicognitive/sveltekit-modal","owner":"semicognitive","description":"Write Python endpoints in SvelteKit using Modal","archived":false,"fork":false,"pushed_at":"2023-05-22T21:37:42.000Z","size":92,"stargazers_count":74,"open_issues_count":3,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-01T16:28:15.925Z","etag":null,"topics":["javascript","python","svelte","sveltekit","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/semicognitive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2023-02-11T06:39:16.000Z","updated_at":"2025-03-31T01:58:12.000Z","dependencies_parsed_at":"2024-11-10T17:29:00.564Z","dependency_job_id":null,"html_url":"https://github.com/semicognitive/sveltekit-modal","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":"semicognitive/es-package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semicognitive%2Fsveltekit-modal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semicognitive%2Fsveltekit-modal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semicognitive%2Fsveltekit-modal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semicognitive%2Fsveltekit-modal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semicognitive","download_url":"https://codeload.github.com/semicognitive/sveltekit-modal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250760693,"owners_count":21482850,"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":["javascript","python","svelte","sveltekit","typescript"],"created_at":"2024-11-10T17:18:12.465Z","updated_at":"2025-04-25T05:31:04.693Z","avatar_url":"https://github.com/semicognitive.png","language":"TypeScript","funding_links":[],"categories":["Miscellaneous"],"sub_categories":[],"readme":"\u003cimg width=\"200\" alt=\"image\" src=\"https://user-images.githubusercontent.com/20548516/218344678-d41f4c4a-6b1b-48cc-8553-2b9fbe2169d6.png\"/\u003e\u003cimg width=\"200\" alt=\"image\" src=\"https://user-images.githubusercontent.com/20548516/219166985-96888b52-51de-4f6b-b37d-cc66264c40eb.png\"/\u003e\n\n# sveltekit-modal\nWrite Python endpoints in [SvelteKit](https://kit.svelte.dev/) using [Modal](https://modal.com).\n\n## Why\n- Start deploying **Python endpoints** in **just a few steps**\n- GPU support for an entire ML Stack in your SvelteKit app\n- Integrates completely, write `+server.py` just like your `+server.js` files\n- Deploy the rest of your app anywhere, with [SvelteKit's adapters for Vercel, Netlify, Cloudflare, etc.](https://kit.svelte.dev/docs/adapters)\n- Serverless Python with [ease](https://kit.svelte.dev/docs/adapters)\n\n## Add to your SvelteKit project\n- Open a [new](https://kit.svelte.dev/docs/creating-a-project) or **existing** SvelteKit Project\n- Install `npm i -D sveltekit-modal`\n- Sign up for [modal.com](https://modal.com/signup), the serverless python platform. All users get $30 free monthly credits!\n- Update `vite.config.js`\n  ```javascript\n  import { sveltekit } from '@sveltejs/kit/vite';\n  import { defineConfig } from 'vite';\n\n  import { sveltekit_modal } from 'sveltekit-modal/vite'; //Add this import\n\n  export default defineConfig({\n\t  plugins: [sveltekit_modal(), sveltekit()] //Add the `sveltekit_modal()` plugin\n  });\n  ```\n- Update `svelte.config.js`\n  ```javascript\n  import adapter from '@sveltejs/adapter-auto';\n  import { vitePreprocess } from '@sveltejs/kit/vite';\n\n  /** @type {import('@sveltejs/kit').Config} */\n  const config = {\n\t  preprocess: vitePreprocess(),\n\t  kit: {\n\t\t  adapter: adapter(),\n\t\t  moduleExtensions: [\".js\", \".ts\", \".py\"] //Add this line, to resolve +server.py endpoints\n\t  }\n  };\n\n  export default config;\n  ```\n - Create `sveltekit_modal_config.py`. The option `stub_asgi` is passed to [Modal](https://modal.com/docs/reference/modal.Stub#asgi). This is where you can define GPU acceleration, secrets, and an Image for pip installs, etc. Explore their [docs](https://modal.com/docs/guide)!\n    ```python\n    import modal\n\n    config = {\n        'name': 'sveltekit-example',\n        'log': False,\n        'stub_asgi': {\n            'image': modal.Image.debian_slim()\n        }\n    }\n    ```\n  - Update `.gitignore`, add `!.env.production`.\n  - Write your endpoints! See an example [here](https://github.com/semicognitive/sveltekit-modal-langchain).\n\n## Use\n- Develop like a normal SvelteKit app, just `npm run dev`\n- Deploy all your python endpoints with one command, just `npx sveltekit-modal deploy`\n\n## Examples\n\nThe `example_app/` directory contains an incredibly bare and demonstrates how to get it working.\n\n- [semicognitive/sveltekit-modal-langchain](https://github.com/semicognitive/sveltekit-modal-langchain) demonstrates a nice version of the library with [langchain](https://github.com/hwchase17/langchain) and [tailwindcss](https://tailwindcss.com/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemicognitive%2Fsveltekit-modal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemicognitive%2Fsveltekit-modal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemicognitive%2Fsveltekit-modal/lists"}