Skip to content

Latest commit

 

History

115 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Virtual Coffee Hacktoberfest Initiative (vchi)

Local Development Setup

Steps to run the site locally for development or curiosity

1. Fork and clone the repository

Follow these steps to create a fork of this repository and clone it to your local machine.

2. Navigate to the repo directory

If you have just run git clone ... , the next step would be to move into the cloned repo:

cd hacktoberfest

3. Install dependencies

This repo requires node, pnpm, and the Netlify CLI to get started.

Installing node:

The best way to install node is to download the installer from their site. This repo requires node version 24 or newer (see .nvmrc), which is the current LTS version.

If you already have a different version of node installed, but don't want to update globally, you can install a package called nvm, which will allow you to easily switch node versions. Once you have nvm installed (or if you already have it installed), you can run nvm use in the main directory and it will install the proper version of node.

Installing pnpm:

pnpm is a package manager that is used to install the rest of our dependencies.

Read more about pnpm on their docs site.

The best way to install pnpm for this project is by using Corepack, a new feature bundled with Node.

Install pnpm via corepack with the following commands:

corepack enable
corepack prepare

Setting up your .env

Use the following command to create a local .env.local file. Then open the new file (.env.local) and fill in the values -- every variable is documented inline in the example file.

cp .env.local.example .env.local

You will need two things of your own:

  • A secret. Generate one with openssl rand -base64 32 and put it in BETTER_AUTH_SECRET.
  • A GitHub OAuth app for local development, created under Developer settings -> OAuth Apps. Set its Authorization callback URL to http://localhost:8888/api/auth/callback/github -- note port 8888, which is what netlify dev serves on, not Next's 3000. Copy the client ID and secret into GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET.

Use your own OAuth app rather than sharing one: a GitHub OAuth app allows exactly one callback URL.

Leave VC_GITHUB_ORG unset if you are not a Virtual Coffee org member -- the admin-role lookup is then skipped entirely and everything else works normally.

Installing package dependencies

Once you have node, pnpm, and the Netlify CLI installed, you're ready to install the local dependencies! Run the following command:

pnpm install

Then link your checkout to the Netlify project, which is what lets the CLI start a local database for you:

netlify login
netlify link

At this point you're ready to roll! Run the following command to get rolling!

pnpm dev

Read more about what pnpm dev does in the following section.

Commands

The following commands are available for your use. Most of the time you'll only ever need pnpm dev.

pnpm dev

pnpm dev

This is the only command you need to do normal local development.

It runs netlify dev, which starts Next and the local Postgres database, then serves both at http://localhost:8888. Any changes you make should re-build the site and re-load your browser.

Use ctrl-c to quit the server when you're done.

Use pnpm dev, not next directly. The local database only starts alongside the Netlify dev server, so pnpm dev:next will boot the site and then fail on the first query. If you see an error saying no database connection is available, this is why.

Before your first run, apply the migrations:

netlify database migrations apply

Changing the database schema

The schema lives in db/schema/. auth.ts is generated by the Better Auth CLI and must not be hand-edited; app.ts holds the application tables.

Netlify owns migration state and applies netlify/database/migrations on deploy, so drizzle-kit is only ever used to author SQL -- never run drizzle-kit migrate or push against this project.

# 1. edit db/schema/app.ts, then generate the SQL
pnpm db:generate

# 2. create the migration Netlify will apply
netlify database migrations new -d "what changed"

# 3. copy the SQL from db/.drizzle into that migration file, then apply it
netlify database migrations apply

If you change the Better Auth config in lib/auth.ts in a way that affects its tables, run pnpm auth:generate first to regenerate db/schema/auth.ts.

Uses:

Releases

Sponsor this project

Packages

Used by

Contributors

Languages