{"id":19006043,"url":"https://github.com/riwert/alpinejs-spa-template","last_synced_at":"2025-09-06T11:33:13.782Z","repository":{"id":183821583,"uuid":"669147898","full_name":"riwert/alpinejs-spa-template","owner":"riwert","description":"An AlpineJS SPA template with an intuitive folder structure, simple features and included examples.","archived":false,"fork":false,"pushed_at":"2023-07-26T08:34:11.000Z","size":1293,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-08T18:43:24.906Z","etag":null,"topics":["alpinejs","alpinejs-head","alpinejs-router","spa","structure","tailwindcss"],"latest_commit_sha":null,"homepage":"https://alpinejs-spa.netlify.app","language":"HTML","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/riwert.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}},"created_at":"2023-07-21T13:08:22.000Z","updated_at":"2024-10-29T21:11:25.000Z","dependencies_parsed_at":"2023-07-25T23:48:44.188Z","dependency_job_id":null,"html_url":"https://github.com/riwert/alpinejs-spa-template","commit_stats":null,"previous_names":["riwert/alpinejs-spa-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riwert%2Falpinejs-spa-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riwert%2Falpinejs-spa-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riwert%2Falpinejs-spa-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riwert%2Falpinejs-spa-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riwert","download_url":"https://codeload.github.com/riwert/alpinejs-spa-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232121440,"owners_count":18475558,"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":["alpinejs","alpinejs-head","alpinejs-router","spa","structure","tailwindcss"],"created_at":"2024-11-08T18:30:02.967Z","updated_at":"2025-01-01T19:43:54.681Z","avatar_url":"https://github.com/riwert.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AlpineJS SPA template\n\nThis is an **[AlpineJS SPA template](https://github.com/riwert/alpinejs-spa-template)** with an intuitive folder structure, simple features and included examples.\n\nThe template includes the **[Alpine.js](https://github.com/alpinejs/alpine)** library, structured files with **[alpinejs-router](https://github.com/shaunlee/alpinejs-router)** for dynamic templates based on URLs, and **[alpinejs-head](https://github.com/markmead/alpinejs-head)** for meta updates. The design is based on the **[Tailwind Atlas theme](https://www.tailwindawesome.com/resources/atlas)**, and it functions as a SPA.\n\n## App demo\n[alpinejs-spa.netlify.app](https://alpinejs-spa.netlify.app)\n\n[!['alpinejs-spa sceenshot example'](screenshot.jpg)](https://alpinejs-spa.netlify.app 'See app demo')\n\n## Structure\n\n|No |Folder            |Description|\n|---|------------------|-----------|\n| 1 |```/components/```| - components dir to keep html files and inject it's contenten via x-include directive|\n| 1 |```/content/```   | - content dir for markdown files to parse and inject as html via x-include.markdown directive|\n| 2 |```/json/```      | - json dir for json files|\n| 2 |```/pages/```     | - pages dir for content in html|\n| 3 |```/partials/```  | - partial elements dir for separate html sections like header, footer, etc.|\n\n## Custom directives\n\n- ```x-include``` - include custom content like components from file and inject response inside directive's element:\n  - default without modifier returns file content as text/html,\n  - ```.markdown``` modifier to parse markdown file content to html,\n- ```x-json:value``` - fetch JSON file or API response and bind it to store named :\u0026lt;value\u0026gt; declared after colon, example:\n  -  ```x-json:example=\"json/example.json\"``` the response from a file will be available in ```$store.example``` in template and ```Alpine.store('example')``` in JS.\n\n## Router templates example\n\n```html\n\u003ca x-link href=\"/hello/world\"\u003eHello World\u003c/a\u003e\n\n\u003ca x-link href=\"/somewhere\"\u003eLoad template\u003c/a\u003e\n\n\u003ctemplate x-route=\"/hello/:name\"\u003e\n  \u003c!-- Inner template --\u003e\n  \u003cdiv\u003eSay hello to \u003cspan x-text=\"$router.params.name\"\u003e\u003c/span\u003e\u003c/div\u003e\n\u003c/template\u003e\n\n\u003c!-- Separate template file --\u003e\n\u003ctemplate x-route=\"/somewhere\" template=\"/somewhere.html\"\u003e\u003c/template\u003e\n```\n\n## Meta updates in the head tag example\n\n```html\n\u003cscript x-data x-head.json type=\"application/json\"\u003e\n  {\n    \"title\": \"Hello World 👋\",\n    \"meta\": [\n      {\n        \"name\": \"description\",\n        \"content\": \"How are you today?\"\n      },\n      {\n        \"name\": \"theme-color\",\n        \"content\": \"#00f\"\n      }\n    ],\n    \"links\": [\n      {\n        \"type\": \"rel\",\n        \"href\": \"popup.css\"\n      }\n    ],\n    \"scripts\": [\n      {\n        \"src\": \"popup.js\",\n        \"async\": true\n      }\n    ]\n  }\n\u003c/script\u003e\n```\n\n## Disclaimer\n\nIt's worth noticing that an SPA mode like this may not be the best for SEO. Perhaps using an SSR wrapper would work better for SEO.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friwert%2Falpinejs-spa-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friwert%2Falpinejs-spa-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friwert%2Falpinejs-spa-template/lists"}