Build Your Family Tree

Click the button to start adding your ancestors.

``` --- ## 2. Backend (Node.js + Express) **Save as `server.js`** ```js require('dotenv').config(); const express = require('express'); const nodemailer = require('nodemailer'); const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY); const path = require('path'); const app = express(); app.use(express.json()); app.use(express.static('.')); // Email transporter const transporter = nodemailer.createTransport({ host: 'smtp.yourmail.com', port: 587, secure: false, auth: { user: process.env.EMAIL_USER, pass: process.env.EMAIL_PASS } }); // Special Quote Email app.post('/api/quote', async (req, res) => { const { tree, unknowns } = req.body; const csv = Object.keys(tree).map(id => { const p = tree[id]; return `${id},${p.first},${p.surname},${p.dob},${p.pob},${p.gender}`; }).join('\n'); await transporter.sendMail({ from: '"Genealogy Service" ', to: 'research@yourdomain.co.uk', subject: `Special Quote Needed – ${unknowns} Unknowns`, text: `Customer needs research. ${unknowns} missing fields.\n\nCSV:\n${csv}` }); res.json({ success: true }); }); // Stripe Checkout app.post('/api/create-checkout', async (req, res) => { const session = await stripe.checkout.sessions.create({ payment_method_types: ['card'], line_items: [{ price_data: { currency: 'gbp', product_data: { name: 'Family Tree Chart (Digital)' }, unit_amount: 4999, }, quantity: 1, }], mode: 'payment', success_url: 'https://yourdomain.co.uk/success.html', cancel_url: 'https://yourdomain.co.uk/cancel.html', }); res.json({ sessionId: session.id }); }); const PORT = process.env.PORT || 3000; app.listen(PORT, () => console.log(`Server running on port ${PORT}`)); ``` --- ## 3. `.env` File (keep secret) ```env STRIPE_SECRET_KEY=sk_live_... EMAIL_USER=your-email@domain.co.uk EMAIL_PASS=your-app-password ``` --- ## 4. Success / Cancel Pages **`success.html`** ```html

Thank You!

Your family tree is being prepared. You’ll receive it via email within 3 days.

``` **`cancel.html`** ```html

Payment Cancelled

You can try again anytime.

``` --- ## 5. Deployment Instructions 1. **Frontend**: Upload `index.html`, `success.html`, `cancel.html` 2. **Backend**: ```bash npm init -y npm install express nodemailer stripe dotenv node server.js ``` 3. Use **PM2** or **Render.com** / **Railway.app** for hosting 4. Set **webhook** for Stripe (optional for delivery)