- Node.js >=v20.11.0
- pnpm >=v9.15.1
-
The starter kit focuses on 2 environments, development on local machine and production on remote machine. So, create the following files:
.env.development
: duplicate.env.example
, and set the variables to development values..env.production
: duplicate.env.example
, and set the variables to production values.wrangler.toml.development
: duplicatewrangler.toml.example
, and set the variables to development values.wrangler.toml.production
: duplicatewrangler.toml.example
, and set the variables to production values.
-
Install the app's dependencies:
pnpm install
- Generate db migration files (that documents schema changes in an SQL script).
pnpm db:generate
- Run db migrations (that executes the SQL script to update the database to match the schema).
- dev (local) db:
pnpm db:migrate:dev
- prod (remote) db:
pnpm db:migrate:prod
- View the database using a graphical user interface:
- dev (local) db:
pnpm db:studio:dev
- prod (remote) db:
pnpm db:studio:prod
- Run Next.js on dev. Ideal for development since it supports hot-reload/fast refresh.
pnpm dev
next start
will return an error due to how the application is designed to run on
Cloudflare pages.
- Run Cloudflare Pages locally. Ideal to test how the app would work after being deployed.
pnpm pages:dev
revalidatePath
will throw
an error when running the app with pnpm pages:dev
. But, the functions work as expected after
deploying.
- Deploy code to pages:
pnpm pages:deploy