Software-Lifecycle-Consultants / susdevos

0 stars 1 forks source link

NextJS split template

This is an opinionated Next.js template bootstrapped with create-next-app.

This tries to maintain a separation between API and Client side UI, which is not the intended use of NextJS 14.

Stack

Other libraries used

Getting Started

  1. Have docker (or podman + docker support) installed.
  2. Have NodeJS 20 or higher even number installed. (You can use Volta or NVM to manage multiple NodeJS versions.)
  3. Create a copy of the file .env.example, rename it to .env and change values if needed.
  4. Run docker compose up in project root directory (or alternative) to start a postgresql server.
  5. Have pnpm installed (this is faster than npm): npm i -g pnpm.
  6. Run pnpm install to install dependencies.
  7. Run pnpm dev to start the development server.
  8. Open http://localhost:3000 with your browser to see the result.

Running database migrations

  1. Use pnpm drizzle-kit studio to view database content in browser. Or use a tool like HeidiSQL or DBeaver.
  2. When you are in development mode and trying out things locally, use pnpm drizzle-kit push:pg to update the db according to your schemas at any time. Never use this in production.
  3. Before committing, run pnpm drizzle-kit generate:pg to generate migration scripts.
  4. Run pnpm tsx migrate-db.ts in production/staging to run database migrations.

Conventions

Learn More

To learn more about Next.js, take a look at the following resources:

Other: