https://github.com/savelevmatthew/next-fcm
https://github.com/savelevmatthew/next-fcm
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/savelevmatthew/next-fcm
- Owner: SavelevMatthew
- Created: 2024-05-16T07:18:02.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-02T12:51:47.000Z (over 1 year ago)
- Last Synced: 2025-06-05T21:36:05.043Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://next-fcm.vercel.app
- Size: 98.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Serwist example - next-web-push
asdasd
This example demonstrates how to add push notifications to an app using Serwist with Next.js.
## Usage
1. Init the project
[](https://gitpod.io/#https://github.com/serwist/serwist/)
```bash
cd examples/next-web-push
```
or
Execute [`degit`](https://github.com/Rich-Harris/degit) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), [pnpm](https://pnpm.io), or [bun](https://bun.sh) to bootstrap the example:
```bash
npx degit serwist/serwist/examples/next-web-push my-app
```
```bash
yarn degit serwist/serwist/examples/next-web-push my-app
```
```bash
pnpx degit serwist/serwist/examples/next-web-push my-app
```
```bash
bunx degit serwist/serwist/examples/next-web-push my-app
```
1. Run
```bash
pnpm web-push generate-vapid-keys --json
```
1. Create a `.env` file, and put the keys generated from the previous steps
```shell
WEB_PUSH_EMAIL=user@example.com
WEB_PUSH_PRIVATE_KEY=
NEXT_PUBLIC_WEB_PUSH_PUBLIC_KEY=
```
1. Build and start
```bash
pnpm build
pnpm start
```
## Recommended `.gitignore`
```gitignore
**/public/sw**
**/public/swe**
```