Skip to content

infosupport/tech-survey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Info Support Tech Survey

Setup for local development

To allow for a reproducible dev-environment, we use Nix and direnv!

Nix can be easily installed using the Determinate Systems Nix Installer. Installation & integration instructions for direnv can be found here.

When using Nix flakes with direnv integration, skip right ahead to step 6 in the installation instructions below. The database can be started by running devenv up.

To develop locally without using Nix, follow the instructions below:

  1. Install Node.js and NPM.
  2. Install Rancher (or Docker if you prefer/you have a license) and make sure it is running.
  3. 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
  1. Copy .env.example to .env and update the DATABASE_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
  2. Create a secret for AUTH_SECRET by running the following command. Use WSL for this command if you are on Windows.
openssl rand -base64 32
  1. Ask a co-worker for the Azure credentials or the rights to create an app registration yourself.

    1. AUTH_MICROSOFT_ENTRA_ID_SECRET: A secret credential created in an app registration.
    2. AUTH_MICROSOFT_ENTRA_ID_ID: The client ID of the app registration.
    3. AUTH_MICROSOFT_ENTRA_ID_ISSUER: The tenant ID of the Azure AD.
    4. AUTH_MICROSOFT_ENTRA_ID_ADMIN_GROUP: The group ID of the Azure AD group that has admin rights in the app registration.
  2. Install NPM dependencies using the following command:

npm i
  1. Run the following commands to setup your db locally.
npm run db:generate
npm run db:push
  1. (Optional): You can seed the database with some initial data by running the following command.
npm run db:seed

Note that this will delete all survey data (but not accounts) from your database. If you have a csv file with survey data, you can import it by running the following command:

tsx .\prisma\seed.js

For this, put the csv-file in ./import/survey.csv

  1. Now you should be ready to go! 🎉 You can check your local database by opening the studio of Prisma. If you followed step 7, you should see that the database has been populated with questions, roles, etc.
npm run db:studio

Running the application

To run the application, you can use the following command:

npm run dev

Running the tests

Tests are done using Testcontainers & Playwright. To run the tests locally, you must have docker installed.

Use the following command to run the tests:

npm run test

Code style

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:

Database changes

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.

About

An app to create tech surveys

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 9