GithubHelp home page GithubHelp logo

remix-deno-demo's Introduction

Remix + Deno

Welcome to the Deno template for Remix! ๐Ÿฆ•

For more, check out the Remix docs.

Install

npx create-remix@latest --template deno

Managing dependencies

Read about how we recommend to manage dependencies for Remix projects using Deno.

  • โœ… You should use npm to install NPM packages
    npm install react
    import { useState } from "react";
  • โœ… You may use inlined URL imports or deps.ts for Deno modules.
    import { copy } from "https://deno.land/[email protected]/streams/conversion.ts";
  • โŒ Do not use import maps.

Development

From your terminal:

npm run dev

This starts your app in development mode, rebuilding assets on file changes.

Type hints

This template provides type hinting to VS Code via a dedicated import map.

To get types in another editor, use an extension for Deno that supports import maps and point your editor to ./.vscode/resolve_npm_imports.json.

For more, see our decision doc for interop between Deno and NPM.

Production

First, build your app for production:

npm run build

Then run the app in production mode:

npm start

Deployment

Building the Deno app (npm run build) results in two outputs:

  • build/ (server bundle)
  • public/build/ (browser bundle)

You can deploy these bundles to any host that runs Deno, but here we'll focus on deploying to Deno Deploy.

Setting up Deno Deploy

  1. Sign up for Deno Deploy.

  2. Create a new Deno Deploy project for this app.

  3. Replace <your deno deploy project> in the deploy script in package.json with your Deno Deploy project name:

{
  "scripts": {
    "deploy": "deployctl deploy --project=<your deno deploy project> --include=.cache,build,public ./build/index.js"
  }
}
  1. Create a personal access token for the Deno Deploy API and export it as DENO_DEPLOY_TOKEN:
export DENO_DEPLOY_TOKEN=<your Deno Deploy API token>

You may want to add this to your rc file (e.g. .bashrc or .zshrc) to make it available for new terminal sessions, but make sure you don't commit this token into git. If you want to use this token in GitHub Actions, set it as a GitHub secret.

  1. Install the Deno Deploy CLI, deployctl:
deno install --allow-read --allow-write --allow-env --allow-net --allow-run --no-check -r -f https://deno.land/x/deploy/deployctl.ts
  1. If you have previously installed the Deno Deploy CLI, you should update it to the latest version:
deployctl upgrade

Deploying to Deno Deploy

After you've set up Deno Deploy, run:

npm run deploy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.