First run the first time setup from local development server.
Then, when running for the first time, or whenever frontend changes are made, you need to create optimized frontend assets with:before you finally start the server each time with:
npm run build-dev
This setup runs the Next.js server in production mode locally. Running this setup locally might help debug some front-end deployment issues.
Building like this notably runs full typescript type checking, which is a good way to find bugs early.
But otherwise you will just normally use the local run as identical to deployment as possible setup instead for development, as that makes iterations quicker are you don't have to re-run the slow
npm run build-devcommand after every frontend change.
build-devis needed instead of
buildbecause it uses
NODE_ENV_OVERRIDEwhich is needed because Next.js forces
NODE_ENV=productionand wontfixed changing it: github.com/vercel/next.js/issues/4022#issuecomment-374010365, and that would lead to the PostgreSQL database being used, instead of the SQLite one we want.
npm run build-assetson toplevel which repacks ourbigbook itself and is a bit slow. To speed things up during the development loop, you can also use:
npm run build-dev-nodeps
TypeScript type checking an also be run in isolation as mentioned at Section "OurBigBook Web TypeScript type checking" with:
npm run tsc