Skip to content

Kaleidoscope-Systems/epitaph

Repository files navigation

Node.js CI

Epitaph is a Next.js project bootstrapped with create-next-app. Its aim is to be a platform for managing the last wishes of the faithful and displaying information pages to the public. These instructions are incomplete and in progress.

Getting Started

Set Up The Database

  • Install Postgres

  • Login to Postgres pgsql -U postgres

  • Create a user for the database CREATE USER epitaph WITH PASSWORD 'your_pwd';

  • Create the database CREATE DATABASE epitaphdb;

  • Grant privileges to the user for the database GRANT ALL PRIVILEGES ON DATABASE epitaphdb TO epitaph;

  • Exit Postgres \q

  • Login with the new user psql -U postgres -d epitaphdb

  • Grant privileges on the schema to the new user

GRANT CREATE ON SCHEMA public TO epitaph;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO epitaph;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO epitaph;
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO epitaph;
  • Do a Prisma migration npx prisma migrate dev

Application Setup

First, copy .env.local.example to .env.local and fill in the missing values. NEXT_PUBLIC_GA_MEASUREMENT_ID is only needed if you'd like to use Google Analytics. Also copy .env.example to .env and fill in the missing values.

Then, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying pages/index.js. The page auto-updates as you edit the file.

API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.js.

The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

Grant Admin Rights

To give youself admin rights in the application, first login with one of the authentication providers. If all goes well, the application will show your name in the top right. Now, open up Postgres again.

  • List users
select  id
,name
,email
,"emailVerified"
,image
,caps
from public."User"
LIMIT 1000
  • Copy the id of your user. Use it in the following command:
UPDATE public."User"
SET caps = '{"editPeople": true, "viewPeople": true, "viewSettings": true, "viewDashboard": true, "editAllRecords": true, "viewAllRecords": true}'::jsonb
WHERE id = 'your_id_here';

This command fills in the caps column with the JSON needed to grant access to your user.

Learn More

To learn more about Next.js, take a look at the following resources: