Be sure to have the following set up before using this project. Check the docs for more information.
- A database with the following configuration
- Postgres version 12+
- Ensure your database is publicly accessible
- Enable logical replication on your database
- A database superuser that can be used for connections inside Pulse
- An invitation to Pulse's Early Access program.
- A Pulse Cloud Projects API key
Clone this repository:
git clone https://github.com/prisma/pulse-starter.gitInstall dependencies:
cd pulse-starter
npm iCreate your .env file:
cp .env.example .envOpen your new .env file and set your two variables:
DATABASE_URL=""
PULSE_API_KEY=""
Run prisma migrate:
npx prisma migrate dev --name initTo run a Pulse subscription, execute the index.ts file. This file contains multiple function calls, each with comments explaining their purpose. Feel free to use these to test different subscriptions.
npx ts-node index.tsℹ️ Note: that you can only run one subscription per file. Therefore, do not uncomment more than one call, as it will cause the code to break.
In a seperate terminal run prisma studio and create a user:
npx prisma studioIf you are running the userCreateSub() function in the index.ts file you should see the following output in your termainl where you ran npx ts-node index.ts
just received a user create event: {
action: 'create',
after: {
id: 1,
email: 'marc@pulseiscool.io',
name: 'Marc'
}
}