1. Generate .env.local file and fill in the values
cp .env.local.sample .env.local2. Start the app and DB services with docker compose
docker compose up -d3. Initialize the DB
docker exec -it frontend yarn prisma migrate deployOpen http://localhost:3000 with your browser to see the result.
docker exec -it frontend yarn prisma migrate resetyarn prisma migrate devdocker compose exec -it frontend yarn prisma studioOpen http://localhost:5555 to access the database GUI
The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.
When making changes to docker-related files, it will be necessary to build and test a production image locally. To build an image tagged as myimg, run the following:
docker build -t myimg .Or, to build the hardened chainguard image, run:
docker build -f Dockerfile.chainguard -t myimg .To run myimg locally:
- Have docker compose already up
- Bind to a port other than 3000 (used by the dev container), e.g. 3001
- Include the network docker compose created so the container will have access to the DB service
- Pass in the contents of your .env.local
- Override the NEXTAUTH_URL environment variable to reflect the bind port (3001 in this example)
docker run -it --rm --env-file .env.local -e NEXTAUTH_URL=http://localhost:3001 -p 3001:3000 --network palm-net myimgIf Docker reports palm-net is not a known network, docker compose may have used a different prefix, run docker network list to find the correct name for your machine- it'll be in the form palm-net.
.eslintrc.json rules are derived from https://eslint.org/docs/latest/rules
To check for any linter errors and warnings, run this command:
docker exec -it frontend yarn lintTo automatically resolve any errors or warnings identified by ESLint, use the following command:
docker exec -it frontend yarn lint:fixNote: Not all linting issues can be automatically fixed. Some may require manual intervention.
Run a local build via yarn to check for failing type errors or dependencies
docker exec -it -e NODE_ENV=production frontend yarn buildCheck for failing tests locally. Write unit tests for any changes you make and for related parts of the application that do not already have tests.
docker exec -it frontend yarn test