backend for palworld server with supabase-realtime on docker
https://github.com/thijsvanloef/palworld-server-docker
sudo docker-compose up -d --build
npm init -y
npm install -D typescript ts-node
npx tsc --init
npm i dotenv express nodemon
npm i -D @types/express
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "npx tsc",
"start": "node ./dist/index.js",
"dev": "nodemon index.ts"
},
"rootDir": "./"
"allowJs": true
"outDir": "./dist"
npm install @prisma/client
npm install prisma --save-dev
npx prisma init
npx prisma migrate dev
npx prisma migrate reset
npx prisma generate
npx prisma init --datasource-provider sqlite
npx prisma migrate dev --name init
npx prisma migrate dev --create-only
TRUNCATE TABLE realtime_systeminfo RESTART IDENTITY;
sudo sh -c "truncate -s 0 /var/lib/docker/containers/**/*-json.log"
sudo systemctl restart docker
GRANT USAGE ON SCHEMA myschema TO anon, authenticated, service_role;
GRANT ALL ON ALL TABLES IN SCHEMA myschema TO anon, authenticated, service_role;
GRANT ALL ON ALL ROUTINES IN SCHEMA myschema TO anon, authenticated, service_role;
GRANT ALL ON ALL SEQUENCES IN SCHEMA myschema TO anon, authenticated, service_role;
ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA myschema GRANT ALL ON TABLES TO anon, authenticated, service_role;
ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA myschema GRANT ALL ON ROUTINES TO anon, authenticated, service_role;
ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA myschema GRANT ALL ON SEQUENCES TO anon, authenticated, service_role;
import { createClient } from '@supabase/supabase-js'
const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY, { db: { schema: 'myschema' } })
const { data: todos, error } = await supabase.from('todos').select('*')