Git Product home page Git Product logo

honcstore's Introduction

Honc Honc!

Honc

Quickstart

This is a template of a HONC project, which uses:

  • Hono as an api framework
  • Neon for a relational database
  • Drizzle as the ORM and migrations manager
  • Cloudflare Workers for deployment hosting

Use this template as follows:

# You can also use `yarn create`, `pnpm create`, or `bun create`
npm create cloudflare@latest -- [email protected]:fiberplane/honc-template.git

You'll be prompted with three simple questions, and then a fresh HONC project will arrive in a new directory on your machine.

Commands

To get started, install dependencies and run the development server:

npm install
npm run dev

Once you've set up a Neon database (see below), you can generate some migrations, apply them, and seed the database:

npm run db:generate
npm run db:migrate
npm run db:seed

If you're inclined to deploy the app to the wild wild internet, you can do so as follows (requires a Cloudflare account):

npm run deploy

Configuring Neon

Install the Neon CLI and follow the script below (you'll need the jq command line utility).

Alternatively, grab your connection string from the Neon dashboard and add it to a .dev.vars file in the root of the project under the key DATABASE_URL.

# Authenticate with neon cli
neonctl auth

# Create project if you haven't already
#
# > *skip this* if you already created a project,
# > and grab the DATABASE_URL from your dashboard
PROJECT_NAME=my-project
neonctl projects create --name $PROJECT_NAME --set-context

# Set project id because the call to `set-context` below needs it
PROJECT_ID=$(neonctl projects list --output=json | jq --arg name "$PROJECT_NAME" '.projects[] | select(.name == $name) | .id')

# Create a `dev` db branch then set context
BRANCH_NAME=dev
neonctl branches create --name=$BRANCH_NAME
neonctl set-context --project-id=$PROJECT_ID --branch=$BRANCH_NAME

# Finally, add connection string to .dev.vars
DATABASE_URL=$(neonctl connection-string)
echo -e '\nDATABASE_URL='$DATABASE_URL'\n' >> .dev.vars

This will create a .neon file, which is used by the neonctl command to know the proper context for running commands.

This file can be kept in version control. From the Neon docs:

Neon does not save any confidential information to the context file (for example, auth tokens). You can safely commit this file to your repository or share with others.

honcstore's People

Contributors

stephlow avatar

Watchers

Lucian avatar  avatar

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.