Intuitive web app for tracking pipeline integrity and visualizing risk assessment. Fully featured with secure cookie authentication, levels of user authorization, rules enforcement, and modification tracking.
- Next.js React framework with TypeScript
- Apollo Client to fetch, cache, and modify application data
- Node.js with TypeScript
- Apollo GraphQL server
- Prisma TypeScript ORM
- Nexus declarative, code-first and strongly typed GraphQL schema construction for TypeScript
- PostgreSQL object-relational database
Install dependencies by running npm i
in root directory.
Before running following commands make sure you have PostgreSQL installed on your machine.
Rename .env.example
file to .env
. Inside, replace the word 'password' of DATABASE_URL with your 'postgres' superuser password.
Migrate Prisma schema defined in prisma/schema.prisma
file to Postgres database schema by running npx prisma migrate dev --name init
.
Populate your database by running npx prisma db seed
.
Pipeline daily flow volume is the total of all upstream chained pipelines. Because the number of upstream pipelines is arbitrary, we are not able to write this query using Prisma Client. We must create user-defined database function that loops through left joins until it reaches null. Run psql -h localhost -U postgres -d integrity_pro -a -f prisma/pipeline_flow_dynamic.sql
to do that. You will be prompted to enter superuser password.
Prisma Client configures database to restrict deletion of records that are referenced by records in foreign tables. We want to alter this constraint for all the records referencing pipeline table to be automatically deleted when a pipeline is deleted. Run psql -h localhost -U postgres -d integrity_pro -a -f prisma/alter_on_delete_cascade.sql
.
npm run dev
Open http://localhost:3000/api to view GraphQL schema and test your queries and mutations in Apollo Studio. Open http://localhost:3000 to view the app.
If you have populated the database, use these credentials to log in:
email: joe.smith@integritypro.com
password: integrity-pro
If you haven't, app will automatically prompt you to register as the first user and make you an ADMIN. Only users with role of ADMIN can add new users.