{"id":18885947,"url":"https://github.com/meldiron/appwrite-ssr-remix","last_synced_at":"2025-04-14T22:15:40.180Z","repository":{"id":159146988,"uuid":"634464771","full_name":"Meldiron/appwrite-ssr-remix","owner":"Meldiron","description":"Appwrite Loves Remix! Demo application with authorized server-side and client-side rendering.","archived":false,"fork":false,"pushed_at":"2023-05-11T11:48:44.000Z","size":1920,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T22:15:25.572Z","etag":null,"topics":["appwrite","remix"],"latest_commit_sha":null,"homepage":"https://remix.ssr.almostapps.eu/","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/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-30T07:51:50.000Z","updated_at":"2024-12-11T14:44:04.000Z","dependencies_parsed_at":"2024-11-08T07:27:43.243Z","dependency_job_id":"c49a5fa2-9653-4490-bcc1-b76725319c2b","html_url":"https://github.com/Meldiron/appwrite-ssr-remix","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-remix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meldiron%2Fappwrite-ssr-remix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meldiron%2Fappwrite-ssr-remix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meldiron%2Fappwrite-ssr-remix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Meldiron","download_url":"https://codeload.github.com/Meldiron/appwrite-ssr-remix/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968917,"owners_count":21191162,"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","remix"],"created_at":"2024-11-08T07:23:22.724Z","updated_at":"2025-04-14T22:15:40.160Z","avatar_url":"https://github.com/Meldiron.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Almost Cover](public/cover.png)\n\n# Almost SSR - Remix\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* [🔦 Nuxt](https://github.com/Meldiron/appwrite-ssr-nuxt) | [nuxt.ssr.almostapps.eu](https://nuxt.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\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- [Remix](https://remix.run/)\n- [Pink Design](https://pink.appwrite.io/)\n- [TypeScript](https://www.typescriptlang.org/)\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 `src/lib/AppwriteService.ts`\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 `src/lib/AppwriteService.ts` 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\n## Welcome to Remix!\n\n- [Remix Docs](https://remix.run/docs)\n\n## Deployment\n\nAfter having run the `create-remix` command and selected \"Vercel\" as a deployment target, you only need to [import your Git repository](https://vercel.com/new) into Vercel, and it will be deployed.\n\nIf you'd like to avoid using a Git repository, you can also deploy the directory by running [Vercel CLI](https://vercel.com/cli):\n\n```sh\nnpm i -g vercel\nvercel\n```\n\nIt is generally recommended to use a Git repository, because future commits will then automatically be deployed by Vercel, through its [Git Integration](https://vercel.com/docs/concepts/git).\n\n## Development\n\nTo run your Remix app locally, make sure your project's local dependencies are installed:\n\n```sh\nnpm install\n```\n\nAfterwards, start the Remix development server like so:\n\n```sh\nnpm run dev\n```\n\nOpen up [http://localhost:3000](http://localhost:3000) and you should be ready to go!\n\nIf you're used to using the `vercel dev` command provided by [Vercel CLI](https://vercel.com/cli) instead, you can also use that, but it's not needed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeldiron%2Fappwrite-ssr-remix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeldiron%2Fappwrite-ssr-remix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeldiron%2Fappwrite-ssr-remix/lists"}