Skip to content

dodycode/remix-nextui-cloudflare

Repository files navigation

Welcome to Remix + Vite + NextUI + Cloudflare

📖 See the Remix docs and the Remix Vite docs for details on supported features.

Getting Started

npx create-remix@latest --template https://github.com/dodycode/remix-nextui-cloudflare

Built in theme switcher

theme switcher

Hooks

This template comes with a few hooks to help you get started.

API Wrapper

This template has a built in API wrapper that you can use to fetch data from your API in your loader functions or actions.

import apiClient from "~/utils/api";

export const loader = async ({ request }) => {
  const data = await apiClient.get("/api/data");
  return json(data);
};

Typegen

Generate types for your Cloudflare bindings in wrangler.toml:

npm run typegen

You will need to rerun typegen whenever you make changes to wrangler.toml.

Development

Run the Vite dev server:

npm run dev

To run Wrangler:

npm run build
npm run start

Deployment

Warning

Cloudflare does not use wrangler.toml to configure deployment bindings. You MUST configure deployment bindings manually in the Cloudflare dashboard.

First, build your app for production:

npm run build

Then, deploy your app to Cloudflare Pages:

npm run deploy