{"id":28440768,"url":"https://github.com/joelseq/go-svelte-spa","last_synced_at":"2025-06-27T14:31:01.265Z","repository":{"id":296767404,"uuid":"992955163","full_name":"joelseq/go-svelte-spa","owner":"joelseq","description":"Golang backend with a Svelte SPA frontend","archived":false,"fork":false,"pushed_at":"2025-06-01T22:00:42.000Z","size":166,"stargazers_count":26,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-24T02:04:01.766Z","etag":null,"topics":["go","golang","single-page-app","svelte","sveltejs","sveltekit"],"latest_commit_sha":null,"homepage":"","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/joelseq.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,"zenodo":null}},"created_at":"2025-05-30T01:21:26.000Z","updated_at":"2025-06-21T23:29:20.000Z","dependencies_parsed_at":"2025-06-02T08:28:13.273Z","dependency_job_id":"b767ebcf-67cc-4348-af10-22fa5ffe3ab7","html_url":"https://github.com/joelseq/go-svelte-spa","commit_stats":null,"previous_names":["joelseq/go-svelte-spa"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/joelseq/go-svelte-spa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelseq%2Fgo-svelte-spa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelseq%2Fgo-svelte-spa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelseq%2Fgo-svelte-spa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelseq%2Fgo-svelte-spa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joelseq","download_url":"https://codeload.github.com/joelseq/go-svelte-spa/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelseq%2Fgo-svelte-spa/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262273254,"owners_count":23285648,"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":["go","golang","single-page-app","svelte","sveltejs","sveltekit"],"created_at":"2025-06-06T04:07:41.342Z","updated_at":"2025-06-27T14:31:01.257Z","avatar_url":"https://github.com/joelseq.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Svelte SPA\n\nThis repo contains example code of how to integrate a [Svelte](https://svelte.dev/) single-page application (SPA), built with [SvelteKit](https://svelte.dev/docs/kit/introduction), with a [Golang](https://go.dev/) backend.\n\nIn development mode, the Golang backend will proxy requests for the frontend assets to the Vite server (running at http://localhost:5173).\n\nIn production mode, the Golang backend will serve the assets bundled from the `ui/dist` directory.\n\nThe mode is determined by the `GO_ENV` environment variable. If it contains \"prod\" then it will run in production mode, otherwise it will run in development mode.\n\n## Motivation\n\nThis setup lets you create a single, easy-to-deploy binary that contains both your API and frontend code without sacrificing on the developer experience. It is inspired by [PocketBase](https://pocketbase.io/).\n\n## Requirements\n\n- Go 1.23+\n- pnpm (optional, you can replace `pnpm` with `npm` or `yarn` in the Makefile)\n\n## Try it out\n\nDevelopment mode:\n\n```\nmake watch\n```\n\nProduction mode:\n\n```bash\nmake build\nGO_ENV=production ./main\n```\n\nThe application will be accessible at http://localhost:8080\n\n## Development\n\nThe following commands use the `examples/stdlib/main.go` file for the backend.\n\nRun build make command with tests\n\n```bash\nmake all\n```\n\nBuild the entire application\n\n```bash\nmake build\n```\n\nBuild the UI which will output the assets to `ui/dist`\n\n```bash\nmake build-ui\n```\n\nBuild the server which will output a `main` executable binary\n\n```bash\nmake build-server\n```\n\nRun the application\n\n```bash\nmake run\n```\n\nLive reload the application:\n\n```bash\nmake watch\n```\n\nRun the test suite:\n\n```bash\nmake test\n```\n\nClean up binary from the last build:\n\n```bash\nmake clean\n```\n\n## Manually setting up the SvelteKit UI\n\nFollow instructions from the official docs for initializing a new app. At the\ntime of writing this:\n\n```\nnpx sv create ui\ncd ui\nnpm install\n```\n\nSetup the static adapter:\n\n- Install: `npm install @sveltejs/adapter-static`\n- Setup the adapter in `svelte.config.js`:\n\n```js\n// ...\nkit: {\n  adapter: adapter({\n    pages: \"dist\",\n    assets: \"dist\",\n    fallback: \"index.html\",\n    strict: true,\n  });\n}\n```\n\nAdd a `layout.js` (or layout.ts) file with the following exports to enable SPA routing:\n\n```js\nexport const ssr = false;\nexport const prerender = false;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoelseq%2Fgo-svelte-spa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoelseq%2Fgo-svelte-spa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoelseq%2Fgo-svelte-spa/lists"}