@titas_mallick/wedding-site-gen 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -0
- package/cli.mjs +1 -1
- package/firestore.rules +26 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,6 +74,77 @@ npx @titas_mallick/wedding-site-gen
|
|
|
74
74
|
- *Logic*: Uses a `setInterval` to calculate time until the `weddingStart` date.
|
|
75
75
|
- **`OurStory.tsx`**: The timeline component showing the couple's history.
|
|
76
76
|
|
|
77
|
+
## 🧠 Deep-Dive: How it Works
|
|
78
|
+
|
|
79
|
+
### 1. AI Wedding Concierge (`ConciergeBot.tsx`)
|
|
80
|
+
The floating assistant uses **Google Gemini 2.5-flash**.
|
|
81
|
+
- **Personality**: Defined in the `systemInstruction` constant. It's programmed to be a warm, respectful Indian wedding host.
|
|
82
|
+
- **Customization**: To update facts (like venue changes), simply edit the `Key Info` section inside the `systemInstruction` in `components/ConciergeBot.tsx`.
|
|
83
|
+
|
|
84
|
+
### 2. Personalized Invitations (`/app/invitation/[slug]`)
|
|
85
|
+
This route handles dynamic guest experiences.
|
|
86
|
+
- **Dynamic Content**: Based on the `slug` (guest ID), it fetches personalized data from Firestore.
|
|
87
|
+
- **Smart Bengali Translation**: Uses Gemini to translate invitation details into formal Bengali when the user clicks "বাংলায় দেখুন".
|
|
88
|
+
|
|
89
|
+
### 3. Digital Guestbook (`/app/guestbook`)
|
|
90
|
+
- **Image Processing**: Before uploading, photos are client-side resized and compressed (JPEG 70% quality) to ensure fast uploads even on mobile networks.
|
|
91
|
+
- **Storage**: Images go to Cloudinary, and the resulting URL is saved to Firestore.
|
|
92
|
+
|
|
93
|
+
### 4. Sentiment Wall (`/app/sagun`)
|
|
94
|
+
- **Collective Blessing**: When guests leave wishes, Gemini periodically summarizes the latest messages into a single "poetic paragraph" that updates live on the "Sentiment Wall."
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 📊 Database Structure (Firestore)
|
|
99
|
+
|
|
100
|
+
To make the site functional, create these collections in Firestore:
|
|
101
|
+
|
|
102
|
+
### `invitation` (Collection)
|
|
103
|
+
Each document ID should be a unique `slug` (e.g., `rahul-wedding`).
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"name": "Rahul & Priya",
|
|
107
|
+
"invitedGuests": 2,
|
|
108
|
+
"relation": "Close Friend",
|
|
109
|
+
"familySide": "groom",
|
|
110
|
+
"invitedFor": ["wedding", "reception"]
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### `rsvps` (Collection)
|
|
115
|
+
Automatically populated when guests confirm attendance.
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"guestId": "rahul-wedding",
|
|
119
|
+
"attending": "yes",
|
|
120
|
+
"guests": 2,
|
|
121
|
+
"food": "non-veg",
|
|
122
|
+
"note": "Looking forward to it!",
|
|
123
|
+
"timestamp": "serverTime"
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### `guestbook` & `wishes` (Collections)
|
|
128
|
+
Store guest memories and text blessings respectively.
|
|
129
|
+
|
|
130
|
+
### 🔒 Recommended Firestore Rules
|
|
131
|
+
Paste these into your Firebase Console to secure your data (also available in `firestore.rules`):
|
|
132
|
+
```javascript
|
|
133
|
+
rules_version = '2';
|
|
134
|
+
service cloud.firestore {
|
|
135
|
+
match /databases/{database}/documents {
|
|
136
|
+
match /wishes/{wishId} { allow read, write: if true; }
|
|
137
|
+
match /song_requests/{requestId} { allow read, write: if true; }
|
|
138
|
+
match /guestbook/{entryId} { allow read, write: if true; }
|
|
139
|
+
match /rsvps/{rsvpId} { allow read, write: if true; }
|
|
140
|
+
match /{document=**} {
|
|
141
|
+
allow read: if true;
|
|
142
|
+
allow write: if request.auth != null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
77
148
|
---
|
|
78
149
|
|
|
79
150
|
## 🎨 Customization & Development
|
|
@@ -108,6 +179,7 @@ This project uses **Tailwind CSS** and **HeroUI**.
|
|
|
108
179
|
5. Copy the `firebaseConfig` values into your `.env.local`:
|
|
109
180
|
- `NEXT_PUBLIC_APIKEY`, `NEXT_PUBLIC_AUTHDOMAIN`, `NEXT_PUBLIC_PROJECTID`, etc.
|
|
110
181
|
6. **Admin SDK**: Go to **Project Settings > Service accounts**, click "Generate new private key", and use those values for the `FIREBASE_ADMIN_*` variables in `.env.local`.
|
|
182
|
+
7. **Security Rules**: Go to the **Rules** tab in Firestore and paste the contents of `firestore.rules` found in this project.
|
|
111
183
|
|
|
112
184
|
### 2. Google Gemini (AI Concierge)
|
|
113
185
|
1. Go to the [Google AI Studio](https://aistudio.google.com/).
|
package/cli.mjs
CHANGED
|
@@ -112,7 +112,7 @@ export default adminCred;
|
|
|
112
112
|
|
|
113
113
|
// Only process text files for replacements
|
|
114
114
|
const ext = path.extname(srcPath).toLowerCase();
|
|
115
|
-
const textExtensions = ['.ts', '.tsx', '.js', '.jsx', '.json', '.md', '.css', '.html'];
|
|
115
|
+
const textExtensions = ['.ts', '.tsx', '.js', '.jsx', '.json', '.md', '.css', '.html', '.rules'];
|
|
116
116
|
|
|
117
117
|
if (textExtensions.includes(ext)) {
|
|
118
118
|
let content = await fs.readFile(srcPath, 'utf8');
|
package/firestore.rules
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
rules_version = '2';
|
|
2
|
+
service cloud.firestore {
|
|
3
|
+
match /databases/{database}/documents {
|
|
4
|
+
// Wishes collection - anyone can read and write
|
|
5
|
+
match /wishes/{wishId} {
|
|
6
|
+
allow read, write: if true;
|
|
7
|
+
}
|
|
8
|
+
// Song requests collection - anyone can read and write
|
|
9
|
+
match /song_requests/{requestId} {
|
|
10
|
+
allow read, write: if true;
|
|
11
|
+
}
|
|
12
|
+
// Guestbook collection - anyone can read and write
|
|
13
|
+
match /guestbook/{entryId} {
|
|
14
|
+
allow read, write: if true;
|
|
15
|
+
}
|
|
16
|
+
// RSVPs collection - anyone can read and write
|
|
17
|
+
match /rsvps/{rsvpId} {
|
|
18
|
+
allow read, write: if true;
|
|
19
|
+
}
|
|
20
|
+
// All other documents - read public, write authenticated only
|
|
21
|
+
match /{document=**} {
|
|
22
|
+
allow read: if true;
|
|
23
|
+
allow write: if request.auth != null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|