{"id":18885937,"url":"https://github.com/meldiron/appwrite-ssr-nuxt","last_synced_at":"2025-04-14T22:21:44.760Z","repository":{"id":159198542,"uuid":"630109326","full_name":"Meldiron/appwrite-ssr-nuxt","owner":"Meldiron","description":"Appwrite Loves Nuxt! Demo application with authorized server-side and client-side rendering.","archived":false,"fork":false,"pushed_at":"2023-09-21T08:03:23.000Z","size":1604,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T10:21:22.599Z","etag":null,"topics":["appwrite","nuxt3"],"latest_commit_sha":null,"homepage":"https://nuxt.ssr.almostapps.eu/","language":"Vue","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/Meldiron.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":"2023-04-19T17:28:03.000Z","updated_at":"2024-08-25T20:34:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"cacc58ee-da34-4ec3-ac87-d90df805dfc5","html_url":"https://github.com/Meldiron/appwrite-ssr-nuxt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meldiron%2Fappwrite-ssr-nuxt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meldiron%2Fappwrite-ssr-nuxt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meldiron%2Fappwrite-ssr-nuxt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meldiron%2Fappwrite-ssr-nuxt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Meldiron","download_url":"https://codeload.github.com/Meldiron/appwrite-ssr-nuxt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248969085,"owners_count":21191190,"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":["appwrite","nuxt3"],"created_at":"2024-11-08T07:23:20.743Z","updated_at":"2025-04-14T22:21:44.734Z","avatar_url":"https://github.com/Meldiron.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Almost Cover](public/cover.png)\n\n# Almost SSR - Nuxt\n\n\u003e Demo application with authorized server-side and client-side rendering.\n\n## 👀 Looking for Different Framework?\n\n* [🔦 Svelte Kit](https://github.com/Meldiron/appwrite-ssr-svelte-kit) | [svelte-kit.ssr.almostapps.eu](https://svelte-kit.ssr.almostapps.eu/)\n* [🔦 Next.js](https://github.com/Meldiron/appwrite-ssr-next-js) | [next-js.ssr.almostapps.eu](https://next-js.ssr.almostapps.eu/)\n* [🔦 Astro](https://github.com/Meldiron/appwrite-ssr-astro) | [astro.ssr.almostapps.eu](https://astro.ssr.almostapps.eu/)\n* [🔦 Qwik](https://github.com/Meldiron/appwrite-ssr-qwik) | [qwik.ssr.almostapps.eu](https://qwik.ssr.almostapps.eu/)\n* [🔦 Remix](https://github.com/Meldiron/appwrite-ssr-remix) | [remix.ssr.almostapps.eu](https://remix.ssr.almostapps.eu/)\n\n## 💭 So How Does It Work?\n\nAppwrite uses 1st party secure cookies for authorization. For legacy reasons, there are two such cookies. They are both very similar, but one's name ends with `_legacy` and is configured a tiny bit differently. It's also possible to use a fallback cookie, but that is not secure for production, and we will not be using that.\n\nTo ensure server-side rendering works, we need to set those cookies on our SSR server hostname instead of the Appwrite hostname. Let's say our Appwrite instance is on `cloud.appwrite.io`, and our app is on `myapp.com`. SSR server on domain `myapp.com` won't receive `appwrite.io` cookies. This is expected behavior, as browsers keep 1st party cookies securely scoped to specific domains.\n\nTo set those cookies on the SSR server, we need a special API endpoint in our SSR server. This endpoint will send a request to create a session, proxying email/password or other credentials. This endpoint next parses the response `set-cookie` header, replaces domain configuration on the cookies, and set's it's own `set-cookie` on the response to the client.\n\nWhen a client calls this endpoint, the cookie will now be set on the SSR server hostname instead of the Appwrite hostname.\n\nThis makes server-side rendering work, but now client-side rendering is broken. Since `set-cookie` coming to the browser only includes a cookie for the SSR server, talking to the Appwrite server directly won't have a proper cookie - there is no auth cookie on the Appwrite hostname. To overcome this problem, we ensure the Appwrite hostname is a subdomain of the SSR hostname. For example, if our SSR server runs on `myapp.com`, Appwrite needs a custom domain configured on `appwrite.myapp.com`. With this setup, all requests to the Appwrite server will include auth cookies, and the user will be properly authorized. This is possible thanks to Appwrite prefixing the cookie domain with `.`, meaning all subdomains can also access the cookie.\n\n## 🧰 Tech Stack\n\n- [Appwrite](https://appwrite.io/)\n- [Nuxt](https://nuxt.com/)\n- [Pink Design](https://pink.appwrite.io/)\n\n## 🛠️ Setup Server\n\n1. Setup Appwrite server\n2. Create project `almostSsr`\n\n## 👀 Setup Client\n\n1. Install libarries `npm install`\n2. Update `AppwriteEndpoint` in `nuxt.config.js`\n3. Start server `npm run dev`\n\n## 🚀 Deployment\n\n1. Deploy the frontend on your production domain. For example, `myapp.com`.\n2. Add the frontend domain as a trusted platform in your Appwrite project.\n3. Add a custom domain to your Appwrite project, which is a subdomain of your frontend. For example, `appwrite.myapp.com`.\n4. Update `SsrHostname` and `AppwriteHostname` in `nuxt.config.js` with proper domains.\n\n## 🤝 Contributing\n\nTo contribute to frontend, make sure to use the [Pink Design](https://pink.appwrite.io/) design system. Ensure both dark and light theme work properly, as well as responsivity on mobile, tablet and desktop.\n\nWhen contributing with static files, ensure all images are in WEBP or SVG format.\n\n## 🖼️ Screenshots\n\n![Screenshot](docs/screenshot1.png)\n![Screenshot](docs/screenshot2.png)\n![Screenshot](docs/screenshot3.png)\n\n## 🤖 Auto-generated documentation\n\nLook at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.\n\n## Setup\n\nMake sure to install the dependencies:\n\n```bash\n# yarn\nyarn install\n\n# npm\nnpm install\n\n# pnpm\npnpm install\n```\n\n## Development Server\n\nStart the development server on `http://localhost:3000`\n\n```bash\nnpm run dev\n```\n\n## Production\n\nBuild the application for production:\n\n```bash\nnpm run build\n```\n\nLocally preview production build:\n\n```bash\nnpm run preview\n```\n\nCheck out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeldiron%2Fappwrite-ssr-nuxt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeldiron%2Fappwrite-ssr-nuxt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeldiron%2Fappwrite-ssr-nuxt/lists"}