- Install Rancher (or Docker if you prefer/you have a license) and make sure it is running.
- Spin up a postgres database with the following command. You need to choose your own password and username:
docker run --name tech-survey -e "POSTGRES_USER=dummyusr" -e "POSTGRES_PASSWORD=dummypw" -e "POSTGRES_DB=tech-survey" -d -p 5432:5432 docker.io/postgres
- Copy
.env.example
to.env
and update theDATABASE_URL
variable with the username and password you chose in the previous step. The default value is:DATABASE_URL="postgresql://dummyusr:dummypw@localhost/tech-survey
- Create a secret for NEXTAUTH_SECRET by running the following command. Use WSL for this command if you are on Windows.
openssl rand -base64 32
- Ask a co-worker for the Azure credentials or the rights to create an app registration yourself.
- AZURE_AD_CLIENT_SECRET: A secret credential created in an app registration.
- AZURE_AD_CLIENT_ID: The client ID of the app registration.
- AZURE_AD_TENANT_ID: The tenant ID of the Azure AD.
- Run the following commands to setup your db locally.
npm run db:generate
npm run db:push
- You can seed the database with some initial data by running the following command. For this you need a file called
survey.csv
in the folder./import
. Ask a co-worker for this file.
npm run db:seed
Note that if you run this command again, your database will be populated with duplicate data. 8. Now you should be ready to go! 🎉 You can check your local database by opening the studio of Prisma. Here you should see that the database populated with questions, roles, etc.
npm run db:studio
To run the application, you can use the following command:
npm run dev
Tests are done using Playwright. To run the tests, you can use the following command:
npm run test
In this project, the code style is enforced by ESLint and Prettier. You can run the following command to check if your code is compliant with the code style:
npm run lint
If you want to automatically fix the code style issues, you can run the following command:
npm run lint:fix
Your IDE can help you with this, check out these links:
If you make changes to the database schema, you need to generate a new migration. You can do this by running the following command:
npx prisma migrate dev --name <name-of-your-migration>
For more information, look at the Prisma documentation.