diff --git a/packages/superflare/docs/file-storage.md b/packages/superflare/docs/file-storage.md index 301dd16a..402f8cb2 100644 --- a/packages/superflare/docs/file-storage.md +++ b/packages/superflare/docs/file-storage.md @@ -140,7 +140,7 @@ You can import this utility in a route handler and pass it the current pathname ```ts // app/routes/storage.$.ts -import { type LoaderFunctionArgs } from "@remix-run/cloudflare"; +import { type LoaderFunctionArgs } from "react-router"; import { servePublicPathFromStorage } from "superflare"; export async function loader({ request }: LoaderFunctionArgs) { diff --git a/packages/superflare/docs/getting-started.md b/packages/superflare/docs/getting-started.md index 9266c82a..ad952c40 100644 --- a/packages/superflare/docs/getting-started.md +++ b/packages/superflare/docs/getting-started.md @@ -32,7 +32,7 @@ npm install @superflare/remix Then, in your `worker.ts` file, import the `handleFetch` function from `@superflare/remix`, and import your local `superflare.config.ts` as `config`. Superflare handles building and providing the load context, so you’ll be able to delete a lot of the code required with the [default Remix adapter](https://github.com/remix-run/remix/blob/main/templates/cloudflare-workers/server.ts): ```ts -import { createRequestHandler, type ServerBuild } from "@remix-run/cloudflare"; +import { createRequestHandler, type ServerBuild } from "react-router"; import { handleFetch } from "@superflare/remix"; import config from "./superflare.config"; import * as build from "./build/server"; @@ -83,12 +83,12 @@ export default { } satisfies ExportedHandler; ``` -For local development, Remix uses Vite’s dev server with a [Cloudflare Proxy Vite plugin](https://remix.run/docs/en/main/guides/vite#cloudflare-proxy) that invokes [`getPlatformProxy`](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy) to provide [bindings](https://developers.cloudflare.com/workers/wrangler/api/#supported-bindings) to your application from outside of the deployed `workersd` environment. Superflare has an additional entry point, `@superflare/remix/dev`, that exports `superflareDevProxyVitePlugin`, which adds Superflare support and can be used in place of Remix’s proxy plugin in your Vite config: +For local development, React Router uses Vite’s dev server with a [Cloudflare Proxy Vite plugin](https://github.com/remix-run/react-router/blob/main/packages/react-router-dev/vite/cloudflare-dev-proxy.ts#L32-L37) that invokes [`getPlatformProxy`](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy) to provide [bindings](https://developers.cloudflare.com/workers/wrangler/api/#supported-bindings) to your application from outside of the deployed `workersd` environment. Superflare has an additional entry point, `@superflare/remix/dev`, that exports `superflareDevProxyVitePlugin`, which adds Superflare support and can be used in place of React Router’s proxy plugin in your Vite config: ```ts // vite.config.ts -import { vitePlugin as remix } from "@remix-run/dev"; +import { reactRouter } from "@react-router/dev/vite""; import { superflareDevProxyVitePlugin } from "@superflare/remix/dev"; import { defineConfig } from "vite"; import tsconfigPaths from "vite-tsconfig-paths"; @@ -96,7 +96,7 @@ import tsconfigPaths from "vite-tsconfig-paths"; export default defineConfig({ plugins: [ superflareDevProxyVitePlugin(), - remix(), + reactRouter(), tsconfigPaths(), ], ssr: { @@ -114,7 +114,7 @@ export default defineConfig({ **Do not** use `build: { minify: true }` in your Vite config. This will mangle the variable names of the `workerd` (SSR) build and change the names of your [models](/models), which will in turn break the mapping between those models and their corresponding DB tables. Vite’s [default minify behavior](https://vite.dev/config/build-options.html#build-minify) is to minify the client build and leave the SSR build untouched, which is what we want. {% /callout %} -The Superflare Remix integration creates a [cookie-based session storage](https://remix.run/docs/en/main/utils/sessions#createcookiesessionstorage) and injects `auth`, `session`, and `cloudflare` objects into your load context (the `AppContext` type), which is provided to your loaders and actions. The `cloudflare` object matches the return value of [Wrangler’s `getPlatformProxy`](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy). +The Superflare React Router integration creates a [cookie-based session storage](https://reactrouter.com/explanation/sessions-and-cookies) and injects `auth`, `session`, and `cloudflare` objects into your load context (the `AppContext` type), which is provided to your loaders and actions. The `cloudflare` object matches the return value of [Wrangler’s `getPlatformProxy`](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy). {% callout title="Cookie Monster" %} Superflare automatically commits your session data to the outgoing response's `set-cookie` header, so you don't need to worry about that like you do in a standard Remix app. diff --git a/packages/superflare/docs/index.md b/packages/superflare/docs/index.md index 74b355cb..8445a5eb 100644 --- a/packages/superflare/docs/index.md +++ b/packages/superflare/docs/index.md @@ -5,7 +5,7 @@ description: A new way to build full-stack applications on Cloudflare Workers [Superflare](https://superflare.dev) is an experimental full-stack toolkit for Cloudflare Workers. It features a relational ORM for [D1 databases](/models), utilities for [R2 storage](/file-storage), and lots more. -Superflare is _not_ a full-stack framework. In fact, Superflare works best when combined with [Remix](https://remix.run), [Next.js](https://nextjs.org) (soon!) or [Nuxt.js](https://nuxtjs.com) (soon!). +Superflare is _not_ a full-stack framework. In fact, Superflare works best when combined with [React Router](https://reactrouter.com)/[Remix](https://remix.run), [Next.js](https://nextjs.org) (soon!) or [Nuxt.js](https://nuxtjs.com) (soon!). Check out various Superflare [example apps](https://github.com/jplhomer/superflare/tree/main/examples/) to get a feel for what you can build next, or [get started](/getting-started) with a new Superflare application. diff --git a/packages/superflare/docs/reference/cli.md b/packages/superflare/docs/reference/cli.md index 5dd548b3..40bbaa9f 100644 --- a/packages/superflare/docs/reference/cli.md +++ b/packages/superflare/docs/reference/cli.md @@ -49,7 +49,7 @@ npx wrangler d1 migrations apply DB --remote ## `superflare dev` -The `dev` command starts a local development server for your Superflare app. It’s a wrapper around two commands: `remix vite:dev` (starts the main Vite dev server) and `wrangler dev --no-bundle` (enables working with [Durable Object bindings](https://developers.cloudflare.com/workers/wrangler/api/#supported-bindings)). You can use it directly or put it in your `package.json`’s scripts: `"dev": "superflare dev"`. +The `dev` command starts a local development server for your Superflare app. It’s a wrapper around two commands: `react-router dev` (starts the main Vite dev server) and `wrangler dev --no-bundle` (enables working with [Durable Object bindings](https://developers.cloudflare.com/workers/wrangler/api/#supported-bindings)). You can use it directly or put it in your `package.json`’s scripts: `"dev": "superflare dev"`. ## `superflare generate` diff --git a/packages/superflare/docs/security/authentication.md b/packages/superflare/docs/security/authentication.md index ab9d38cc..5a212d83 100644 --- a/packages/superflare/docs/security/authentication.md +++ b/packages/superflare/docs/security/authentication.md @@ -26,7 +26,7 @@ If you've created a Superflare app with `npx superflare new`, you should already ## Register and Login pages -The [Superflare Remix template](https://github.com/jplhomer/superflare/tree/main/templates/remix) provides basic `/register` and `/login` routes and forms for you to use. You can use these as-is, or you can copy the code and modify it to your liking. +The [Superflare React Router template](https://github.com/jplhomer/superflare/tree/main/templates/remix) provides basic `/register` and `/login` routes and forms for you to use. You can use these as-is, or you can copy the code and modify it to your liking. ## Protecting routes diff --git a/packages/superflare/docs/sessions.md b/packages/superflare/docs/sessions.md index 4eb1fa5f..378c1d7b 100644 --- a/packages/superflare/docs/sessions.md +++ b/packages/superflare/docs/sessions.md @@ -9,7 +9,7 @@ The `SuperflareSession` instance keeps track of any changes to the session, and ## Creating sessions -_The following instructions assume you are using Remix. They will be updated when Superflare supports other frameworks._ +_The following instructions assume you are using React Router. They will be updated when Superflare supports other frameworks._ The `@superflare/remix` package exports `handleFetch`, which takes care of session creation and makes the session available on your Remix `AppContext` in deployed workers. There is an additional entry point, `@superflare/remix/dev`, that exports `superflareDevProxyVitePlugin` to provide the same automatic session handling in local dev when using the Vite dev server. See the [Getting Started](/getting-started) guide for details.