Spaces:
Sleeping
Sleeping
SnapLocal Implementation Guide
β MVP Features Implemented (Complete)
Backend (Node.js + MongoDB)
1. Package System β
- Model:
server/src/models/Package.js - Routes:
server/src/routes/packageRoutes.js - Endpoints:
GET /api/packages/photographer/:photographerId- Get photographer's packagesGET /api/packages/:id- Get single packagePOST /api/packages- Create new package (auth required)PUT /api/packages/:id- Update package (auth required)DELETE /api/packages/:id- Delete package (auth required)
2. Photographer Verification β
- Model:
server/src/models/Verification.js - Routes:
server/src/routes/verificationRoutes.js - Endpoints:
GET /api/verification/status/:photographerId- Get verification statusPOST /api/verification/submit- Upload documents (auth required)POST /api/verification/:verificationId/approve- Admin approvePOST /api/verification/:verificationId/reject- Admin reject
3. Photo Delivery β
- Model:
server/src/models/PhotoDelivery.js - Routes:
server/src/routes/deliveryRoutes.js - Endpoints:
GET /api/delivery/booking/:bookingId- Get delivery statusPOST /api/delivery/booking/:bookingId- Create delivery recordPOST /api/delivery/:deliveryId/upload- Upload photos (auth required)POST /api/delivery/:deliveryId/complete- Mark as deliveredPOST /api/delivery/:deliveryId/request-revision- Request revisions
4. Invoice Generator β
- Model:
server/src/models/Invoice.js - Routes:
server/src/routes/invoiceRoutes.js - Endpoints:
GET /api/invoices/:id- Get invoiceGET /api/invoices/user/:userId- Get user's invoicesPOST /api/invoices- Create invoicePUT /api/invoices/:id/payment- Update payment statusGET /api/invoices/:id/download- Download invoice
5. Smart Tags (Enhanced Search) β
- Implemented in
Photographer.jsmodel with tags array - Frontend Search component with tag filters
6. Additional Models Created β
- Loyalty Points (
server/src/models/LoyaltyPoints.js) - Report System (
server/src/models/Report.js) - Trip Planner (
server/src/models/TripPlan.js) - Dynamic Pricing (
server/src/models/DynamicPrice.js) - Deals/Discounts (
server/src/models/Deal.js)
Frontend (React + Vite)
Components Created β
Photographer Dashboard Components:
PackagePanel.jsx- Create and manage packagesPackageCard.jsx- Individual package card displayCreatePackageModal.jsx- Modal form for creating/editing packagesVerificationPanel.jsx- Verification document upload and statusDeliveryPanel.jsx- Photo upload and delivery managementInvoiceView.jsx- Invoice display and download
Customer Dashboard Components:
TrendingSpots.jsx- Popular photography locationsLastMinuteDeals.jsx- Time-limited discount offersLeaderboard.jsx- Top photographers by ratingShootTimeline.jsx- Booking progress timeline
Utilities:
src/utils/invoiceGenerator.js- Invoice HTML generation and PDF export
π± Technology Stack
Backend
- Express.js - REST API server
- MongoDB - Database
- Mongoose - ODM
- JWT - Authentication
- Socket.io - Real-time messaging (already in place)
Frontend
- React 19.2.4 - UI framework
- Vite 8.0.0 - Build tool
- Tailwind CSS 4.2.1 - Styling
- Lucide React - Icons
- Axios - HTTP client
π How to Run
Prerequisites
- Node.js 18+
- MongoDB running locally or cloud URL in
.env - npm or yarn
1. Install Dependencies
# Backend
cd server
npm install
# Frontend
cd ../client
npm install
2. Configure Environment
Create server/.env:
MONGODB_URI=mongodb://localhost:27017/snaplocal
PORT=5000
JWT_SECRET=your_secret_key
3. Start Development Servers
# Terminal 1: Backend
cd server
npm run dev
# Server runs on http://localhost:5000
# Terminal 2: Frontend
cd client
npm run dev
# Client runs on http://localhost:5173
π API Usage Examples
Create a Package (Photographer)
// POST http://localhost:5000/api/packages
{
"name": "Premium Wedding Package",
"description": "8 hours coverage with 300+ edited photos",
"price": 15000,
"priceUnit": "session",
"duration": 8,
"deliverables": {
"numPhotos": 350,
"numEdited": 200,
"numLocations": 2,
"includesAlbum": true
},
"tags": ["wedding", "bride", "groom"]
}
Submit Verification
// POST http://localhost:5000/api/verification/submit
{
"idDocumentUrl": "https://example.com/aadhar.jpg",
"portfolioUrls": [
"https://example.com/photo1.jpg",
"https://example.com/photo2.jpg"
]
}
Upload Photos for Delivery
// POST http://localhost:5000/api/delivery/{deliveryId}/upload
{
"photoUrls": [
"https://example.com/photo1.jpg",
"https://example.com/photo2.jpg",
// ... more photos
]
}
Create Invoice
// POST http://localhost:5000/api/invoices
{
"bookingId": "booking_id_here",
"photographerId": "photographer_id",
"customerId": "customer_id",
"items": [
{
"description": "Premium Wedding Photography",
"quantity": 1,
"unitPrice": 15000,
"total": 15000
}
],
"subtotal": 15000,
"tax": 2700,
"taxRate": 18,
"totalAmount": 17700
}
π― Dashboard Features
Photographer Dashboard
- Overview - Statistics (bookings, revenue, pending, rating)
- My Profile - Edit bio, specialty, rate, experience
- Portfolio - Upload images/videos
- Packages β - Create and manage service packages
- Verification β - Upload documents for verification badge
- Availability - Set weekly schedule
- Bookings - Manage booking requests with timeline
- Photo Delivery β - Upload and deliver photos to customers
- Reports - View and respond to customer complaints
Customer Dashboard
- Search - Find photographers (enhanced with tag filters)
- Trending Spots β - Popular photography locations
- Last-Minute Deals β - Time-limited discounts
- Nearby Photographers - Map view with location filtering
- My Bookings - Manage reservations and download photos
- Leaderboard β - Top-rated photographers
- Loyalty/Rewards - Points and tier benefits
- Trip Planner - Plan photo shoot trips
π File Structure Summary
server/src/
βββ models/
β βββ Package.js β NEW
β βββ Verification.js β NEW
β βββ PhotoDelivery.js β NEW
β βββ Invoice.js β NEW
β βββ LoyaltyPoints.js β NEW
β βββ Report.js β NEW
β βββ TripPlan.js β NEW
β βββ DynamicPrice.js β NEW
β βββ Deal.js β NEW
βββ routes/
β βββ packageRoutes.js β NEW
β βββ verificationRoutes.jsβ NEW
β βββ deliveryRoutes.js β NEW
β βββ invoiceRoutes.js β NEW
β βββ reportRoutes.js β NEW
β βββ loyaltyRoutes.js β NEW
β βββ tripPlanRoutes.js β NEW
β βββ dealRoutes.js β NEW
βββ index.js β UPDATED
client/src/
βββ components/
β βββ PackagePanel.jsx β NEW
β βββ PackageCard.jsx β NEW
β βββ CreatePackageModal.jsxβ NEW
β βββ VerificationPanel.jsx β NEW
β βββ DeliveryPanel.jsx β NEW
β βββ InvoiceView.jsx β NEW
β βββ TrendingSpots.jsx β NEW
β βββ LastMinuteDeals.jsx β NEW
β βββ Leaderboard.jsx β NEW
β βββ ShootTimeline.jsx β NEW
βββ utils/
βββ invoiceGenerator.js β NEW
β¨ Next Steps (Phase 2+)
Advanced Features
AI-Powered Features
- Style matching (upload reference photo for similar photographers)
- Dynamic pricing suggestions based on demand
- Smart recommendations
Enhanced Search
- Geolocation-based photographer search
- Advanced filters (availability, price range, ratings, tags)
Performance Analytics
- Charts and graphs for photographer earnings/bookings
- Customer analytics for trends
Trip Planning
- Itinerary builder
- Recommended photography spots
- Travel packages
Additional Features
- Watermark protection for portfolio images
- Live photographer availability map
- Video introductions for photographers
- Social sharing buttons
π Security Notes
- All protected routes require JWT authentication
- Password hashing with bcryptjs (already implemented)
- CORS enabled for development
- Input validation needed (in production)
- Rate limiting recommended for API endpoints
π Database Schema Overview
Package
{
photographerId, name, description, price, priceUnit, duration,
deliverables: { numPhotos, numEdited, numLocations, includesAlbum },
active, bookingCount, tags, timestamps
}
Verification
{
photographerId, status (pending|verified|rejected),
idDocument, portfolioSamples[], submittedAt, verifiedAt,
adminNotes, rejectionReason, timestamps
}
Invoice
{
invoiceNumber, bookingId, photographerId, customerId,
items[], subtotal, tax, taxRate, discount, totalAmount,
paymentStatus, paidAt, timestamps
}
PhotoDelivery
{
bookingId, photographerId, customerId, photos[],
status (pending|partially_delivered|delivered|revision_requested),
deliveredAt, downloadLink, linkExpiresAt, revisionNotes, timestamps
}
π Code Examples
Use PackagePanel in Dashboard
import PackagePanel from '../components/PackagePanel';
export default function PhotographerDashboard() {
const { user } = useAuth();
return <PackagePanel photographerId={user.id} />;
}
Use DeliveryPanel in Booking Page
import DeliveryPanel from '../components/DeliveryPanel';
export default function BookingDetail({ bookingId }) {
return (
<DeliveryPanel
bookingId={bookingId}
photographerId={currentPhotographerId}
role="photographer"
/>
);
}
Generate and Download Invoice
import { downloadInvoiceAsPDF } from '../utils/invoiceGenerator';
const handleDownload = (invoice, photographer, customer) => {
downloadInvoiceAsPDF(invoice, photographer, customer);
};
π Troubleshooting
Port Already in Use
# Kill process on port 5000
lsof -i :5000
kill -9 <PID>
MongoDB Connection Failed
- Ensure MongoDB is running:
mongod - Check MONGODB_URI in
.env - Verify connection string format
Components Not Loading
- Clear Vite cache:
rm -rf client/node_modules/.vite - Restart dev server
π Future Enhancements
- Payment gateway integration (Stripe/Razorpay)
- Email notifications for bookings
- SMS alerts for photographers
- Multi-language support
- Mobile app (React Native)
- Admin dashboard
- Analytics and reporting
- Advanced booking calendar with time slots
- Subscription tiers for photographers
- Automated invoice generation and payment reminders
π Support
For issues or questions:
- Check the Feature Implementation Map:
/FEATURE_IMPLEMENTATION_MAP.md - Review API routes in respective
server/src/routes/files - Check component prop requirements in
client/src/components/
Version: 1.0.0 MVP Last Updated: March 18, 2026 Status: β Complete and Running