feat: add and refactor fcm script, update readme

- Add xsendReady.ts, a production-ready script for sending FCM notifications.
- Refactor script to be modular, use external config, and handle token validation efficiently.
- Update README.md with more detailed project information, setup instructions, and scripts.
This commit is contained in:
2025-06-30 15:09:35 +08:00
parent 1391482710
commit ae3b8c118d
3 changed files with 289 additions and 25 deletions

View File

@@ -1,38 +1,83 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
# Sistem Desa Mandiri
## Getting Started
Sistem Desa Mandiri adalah aplikasi web yang dirancang untuk membantu pengelolaan administrasi dan informasi di tingkat desa. Dibangun dengan Next.js, aplikasi ini menyediakan berbagai fitur untuk mendukung kegiatan desa, mulai dari pengumuman, diskusi, manajemen proyek, hingga administrasi kependudukan.
First, run the development server:
## Fitur Utama
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
* **Manajemen Pengguna:** Mengelola data anggota dan hak akses.
* **Pengumuman:** Menyebarkan informasi penting kepada seluruh warga desa.
* **Diskusi:** Forum untuk berdiskusi antar warga atau perangkat desa.
* **Manajemen Proyek & Tugas:** Melacak kemajuan proyek dan tugas yang sedang berjalan di desa.
* **Dokumentasi:** Tempat terpusat untuk menyimpan dan mengelola dokumen-dokumen penting.
* **Notifikasi Push:** Mengirimkan notifikasi real-time ke perangkat pengguna.
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
## Teknologi yang Digunakan
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
* **Framework:** [Next.js](https://nextjs.org/)
* **UI Framework:** [Mantine](https://mantine.dev/)
* **Database ORM:** [Prisma](https://www.prisma.io/)
* **Styling:** [Tailwind CSS](https://tailwindcss.com/)
* **State Management:** [Hookstate](https://hookstate.js.org/)
* **Push Notifications:** [Web Push](https://www.npmjs.com/package/web-push)
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
## Memulai
## Learn More
### Persyaratan
To learn more about Next.js, take a look at the following resources:
* [Node.js](https://nodejs.org/) (versi 20.x atau lebih tinggi)
* [Bun](https://bun.sh/) (direkomendasikan) atau package manager lain seperti npm/yarn/pnpm.
* Database (misalnya PostgreSQL, MySQL, atau SQLite).
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
### Instalasi
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
1. **Clone repositori ini:**
```bash
git clone https://github.com/username/sistem-desa-mandiri.git
cd sistem-desa-mandiri
```
## Deploy on Vercel
2. **Install dependensi:**
```bash
bun install
```
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
3. **Setup Variabel Lingkungan:**
Salin file `.env.test` menjadi `.env` dan sesuaikan nilainya, terutama untuk koneksi database.
```bash
cp .env.test .env
```
Buka file `.env` dan isi variabel yang diperlukan, seperti `DATABASE_URL`.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
4. **Migrasi Database:**
Jalankan migrasi Prisma untuk membuat skema database.
```bash
npx prisma migrate dev
```
v011
5. **Seed Database (Opsional):**
Jika Anda ingin mengisi database dengan data awal, jalankan perintah seed.
```bash
npx prisma db seed
```
6. **Jalankan Server Development:**
```bash
bun run dev
```
Aplikasi akan berjalan di [https://localhost:3000](https://localhost:3000).
## Skrip yang Tersedia
* `dev`: Menjalankan server development dengan HTTPS.
* `build`: Membuat build produksi dari aplikasi.
* `start`: Menjalankan server produksi.
* `lint`: Menjalankan linter untuk memeriksa kualitas kode.
* `prisma:seed`: Menjalankan skrip seed database.
## Kontribusi
Kontribusi dalam bentuk apapun sangat kami hargai. Jika Anda menemukan bug atau memiliki ide untuk fitur baru, silakan buat *issue* baru. Jika Anda ingin berkontribusi dalam kode, silakan buat *pull request*.
## Lisensi
Proyek ini dilisensikan di bawah [Lisensi ISC](LICENSE).