{"id":13722769,"url":"https://github.com/jamen/svelte-router","last_synced_at":"2025-07-25T15:11:30.583Z","repository":{"id":57120113,"uuid":"186966031","full_name":"jamen/svelte-router","owner":"jamen","description":"  Svelte router using a store and components.","archived":false,"fork":false,"pushed_at":"2024-08-30T17:10:21.000Z","size":14,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-05T03:12:51.402Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/jamen.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}},"created_at":"2019-05-16T06:33:04.000Z","updated_at":"2023-07-27T12:05:21.000Z","dependencies_parsed_at":"2024-10-20T16:04:27.540Z","dependency_job_id":null,"html_url":"https://github.com/jamen/svelte-router","commit_stats":{"total_commits":15,"total_committers":3,"mean_commits":5.0,"dds":0.4666666666666667,"last_synced_commit":"8df024be144b7eb12104207c1d4c0984aba0b086"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jamen/svelte-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fsvelte-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fsvelte-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fsvelte-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fsvelte-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamen","download_url":"https://codeload.github.com/jamen/svelte-router/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fsvelte-router/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267023245,"owners_count":24022919,"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","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"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":[],"created_at":"2024-08-03T01:01:32.746Z","updated_at":"2025-07-25T15:11:30.555Z","avatar_url":"https://github.com/jamen.png","language":"JavaScript","funding_links":[],"categories":["components and libraries"],"sub_categories":["routers"],"readme":"# @jamen/svelte-router\n\nSvelte router with a store and components.\n\n**NOTE:** Consider using [SvelteKit](https://kit.svelte.dev/) with [@sveltejs/adapter-static](https://github.com/sveltejs/kit/tree/master/packages/adapter-static) instead. It has routing.\n\n## Usage\n\nFirst setup a view with `\u003cRouter\u003e`:\n\n```html\n\u003cscript\u003e\n    import { Router } from '@jamen/svelte-router'\n    import * as pages from './pages.js'\n\n    const routes = {\n        '/': pages.Home,\n        '/contact': pages.Contact,\n        404: pages.Lost,\n        // ...\n    }\n\u003c/script\u003e\n\n\u003cRouter {routes} /\u003e\n```\n\nThen you can use `\u003cLink\u003e` to change the view:\n\n```html\n\u003cscript\u003e\n    import { Link } from '@jamen/svelte-router'\n\u003c/script\u003e\n\n\u003cnav\u003e\n    \u003cLink href='/'\u003eHome\u003c/Link\u003e\n    \u003cLink href='/contact'\u003eContact\u003c/Link\u003e\n\u003c/nav\u003e\n```\n\nAnd you can use the `router` store to have your own routing:\n\n```html\n\u003cscript\u003e\n    import { router } from '@jamen/svelte-router'\n\u003c/script\u003e\n\n{#if $router.query.name}\n    \u003ch1\u003eHello {$router.query.name}!\u003c/h1\u003e\n{/if}\n\n\u003cp\u003eYou visited {$router.path}.\u003c/p\u003e\n```\n\nIf you want to use your own store, then both `Router` and `Link` accept a `router` to change the store:\n\n```html\n\u003cscript\u003e\n    import { Router, Link } from '@jamen/svelte-router'\n    import { custom } from '../stores.js'\n    // ...\n\u003c/script\u003e\n\n\u003cRouter router={custom} {routes} /\u003e\n\u003cLink router={custom} href='/'\u003eHome\u003c/Link\u003e\n```\n\nWith this you may want your own link component:\n\n```html\n\u003cscript\u003e\n    import { Link } from '@jamen/svelte-router'\n    import { custom } from '../stores.js'\n\u003c/script\u003e\n\n\u003cLink router={custom} {..$$props}\u003e\u003cslot\u003e\u003c/slot\u003e\u003c/Link\u003e\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fsvelte-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamen%2Fsvelte-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fsvelte-router/lists"}