Remix run stack built for the edge (cloudflare pages and d1)

Overview

Remix Race Stack

The Remix Race Stack

Learn more about Remix Stacks.

npx create-remix@latest --template jose-donato/race-stack

What's in the stack

Want to modify something on the stack? Create an issue or fork it, change it, and use npx create-remix --template your/repo! Make it your own.

Development

This project uses D1 for its database. Steps are straightforward and can be found in the D1 docs. If the following doesn't work, please refer to the docs mentioned above. We will be utilizing Wrangler for local development to emulate the Cloudflare runtime.

  1. Install wrangler - npm install -g wrangler
  2. Create a new D1 database named race-stack (or whatever you want to name it) - wrangler d1 create race-stack
  3. Make sure your wrangler.toml file has the correct database name and id (check ./wrangler.toml for an example)
  4. Modify your drizzle schema app/lib/schema.ts to match your needs
  5. Run npm run generate to generate your sql file
  6. Run wrangler d1 execute race-stack --local --file=./drizzle/<file>.sql to migrate your database
  7. Install project dependencies - npm install
  8. Start the server - npm run dev

Open up http://127.0.0.1:8788 and you should be ready to go!

Relevant code:

This is a simple app, but it's a good example of how you can build a full stack app with Remix fully deployed on the edge using Cloudflare products. The main functionality is creating users, logging in and out, and creating teams that may include one or more users. The code that handles this is in:

Deployment

Cloudflare Pages

  1. Fork this repo
  2. If you don't already have an account, then create a Cloudflare account here and after verifying your email address with Cloudflare, go to your dashboard and follow the Cloudflare Pages deployment guide.
  3. Connect your forked repo to your new Cloudflare Pages project

Cloudflare D1

  1. Create a new D1 database named race-stack (or whatever you want to name it) - wrangler d1 create race-stack
  2. Make sure your wrangler.toml file has the correct database name and id (check ./wrangler.toml for an example)
  3. Go into the project settings in Cloudflare Pages project, visit the functions tab, and create a D1 database binding. Variable name should be DB and the value should be the database name you got from step 1.
  4. Deploy the database by running wrangler d1 execute race-stack --file=./drizzle/<file>.sql

Type Checking

This project uses TypeScript. It's recommended to get TypeScript set up for your editor to get a really great in-editor experience with type checking and auto-complete. To run type checking across the whole project, run npm run typecheck.

Linting

This project uses ESLint for linting. That is configured in .eslintrc.js.

Formatting

We use Prettier for auto-formatting in this project. It's recommended to install an editor plugin (like the VSCode Prettier plugin) to get auto-formatting on save. There's also a npm run format script you can run to format all files in the project.

You might also like...

A Tauri update server, hosted as a Cloudflare edge function

Tauri Update Server: Cloudflare One-Click Deploy Click the button above, let Cloudflare walk you through: it's easy! Go to your forked repository, edi

Dec 14, 2022

simple-remix-blog is a blog template built using Remix and TailwindCSS. Create your own blog in just a few minutes!

simple-remix-blog is a blog template built using Remix and TailwindCSS. Create your own blog in just a few minutes!

simple-remix-blog is a blog template built using remix.run and TailwindCSS. It supports markdown and MDX for the blog posts. You can clone it and star

Dec 8, 2022

Functional-style Cloudflare Durable Objects with direct API calls from Cloudflare Workers and TypeScript support.

durable-apis Simplifies usage of Cloudflare Durable Objects, allowing a functional programming style or class style, lightweight object definitions, a

Jan 2, 2023

A set of useful helper methods for writing functions to handle Cloudflare Pub/Sub messages (https://developers.cloudflare.com/pub-sub/)

pubsub A set of useful helper methods for writing functions to handle Cloudflare Pub/Sub messages. This includes: A isValidBrokerRequest helper for au

Dec 4, 2022

Connect to a Postgres database from a Cloudflare Worker, using Cloudflare Tunnel

Cloudflare Workers Postgres Client This is an experimental module. Heavily based on cloudflare/worker-template-postgres, but cleaned up and bundled in

Dec 22, 2022

A Cloudflare Workers service that fetches and renders Notion pages as HTML, Markdown, or JSON.

notion-fetch A Cloudflare Workers service that fetches and renders Notion pages as HTML, Markdown, or JSON. Powered by Durable Objects and R2. Usage P

Jan 6, 2023

Use Cloudflare Pages Functions as a reverse proxy with custom domain support.

Use Cloudflare Pages Functions as a reverse proxy with custom domain support.

cf-page-func-proxy Use Cloudflare Pages Functions as a reverse proxy with custom domain support. Getting Start 1.下载或是Fork本仓库 2.修改_worker.js中的url.hostn

Dec 23, 2022

A CloudFlare Worker / script / bot to sync Notion pages publicly as GitHub Discussions.

A CloudFlare Worker / script / bot to sync Notion pages publicly as GitHub Discussions.

notion-github-sync This bot syncs public Notion pages as GitHub Discussions/Issues. It's done periodically, based on the pages shared with the Notion

Dec 22, 2022

Running Next.js on Cloudflare Pages.

Nextflare - Run Next.js Edge Runtime on Cloudflare Pages (Workers) NOTE: We're still actively updating this repository, docs, and preparing a potentia

Jan 3, 2023
Comments
  • Login error

    Login error

    After succesfully creating an account, when i log in i get the following error:

    POST /login?_data=routes%2Flogin 204 No Content (55.65ms)

    Response { [Symbol(realm)]: { settingsObject: {} }, [Symbol(state)]: { aborted: false, rangeRequested: false, timingAllowPassed: false, requestIncludesCredentials: false, type: 'default', status: 401, timingInfo: null, cacheState: '', statusText: '', headersList: HeadersList { cookies: null, [Symbol(headers map)]: [Map], [Symbol(headers map sorted)]: null }, urlList: [], body: { stream: undefined, source: '{"message":"Invalid email or password"}', length: 39 } }, [Symbol(headers)]: HeadersList { cookies: null, [Symbol(headers map)]: Map(1) { 'content-type' => [Object] }, [Symbol(headers map sorted)]: null } }

    opened by manstfu 1
  • Add @types/eslint (same as in official stacks)

    Add @types/eslint (same as in official stacks)

    For me (WebStorm), my IDE couldn't use the eslint and displayed errors all the time. I compared with official stacks and this seemed to be missing, after installing types and restarting the IDE, it worked.

    opened by xdivby0 0
Owner
Software Engineer @ OpenBB
null
The Remix version of the fakebooks app demonstrated on https://remix.run. Check out the CRA version: https://github.com/kentcdodds/fakebooks-cra

Remix Fakebooks App This is a (very) simple implementation of the fakebooks mock app demonstrated on remix.run. There is no database, but there is an

Kent C. Dodds 61 Dec 22, 2022
🚀 A web extension starter built with React, Typescript, and Tailwind CSS. Build once, and run on multiple browsers: Google Chrome, Mozilla Firefox, Microsoft Edge, Brave, and Opera..

Web Extension Starter A web extension starter, built with React, Typescript, and Tailwind CSS. Build once, and run on multiple browsers: Google Chrome

BCIT Design & Development Club (BCIT-DDC) 28 Dec 28, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Remix Stack for deploying to Vercel with remix-auth, Planetscale, Radix UI, TailwindCSS, formatting, linting etc. Written in Typescript.

Remix Synthwave Stack Learn more about Remix Stacks. npx create-remix --template ilangorajagopal/synthwave-stack What's in the stack Vercel deploymen

Ilango 56 Dec 25, 2022
A Remix stack setup to run on Deno with support for Rust WASM modules!

Remix + Deno + Rust -> Webassembly - The Air Metal Stack Welcome to the Air Metal Stack for Remix! ?? + ?? This stack is a good choice if you want to

Ben Wishovich 60 Jan 5, 2023
This is a full-stack exercise tracker web application built using the MERN (MongoDB, ExpressJS, ReactJS, NodeJS) stack. You can easily track your exercises with this Full-Stack Web Application.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

WMouton 2 Dec 25, 2021
Abusing Cloudflare Workers to establish persistence and exfiltrate sensitive data at the edge.

Abusing Cloudflare Workers This repository contains companion code for the blog post MITM at the Edge: Abusing Cloudflare Workers. malicious-worker/ c

Christophe Tafani-Dereeper 10 Sep 16, 2022