Sparkfund is a full-stack MERN crowdfunding platform where Creators launch campaigns, Supporters back them with platform credits, and Admins keep the whole system honest. Built as a role-based application with three distinct dashboards, real credit accounting, and a full moderation workflow.
π Live Site: https://spark-fund-client.vercel.app
π Client Repository: https://github.com/Avishek-Pratyay/SparkFund-Client
π Server Repository: https://github.com/Avishek-Pratyay/SparkFund-Server
π Admin Credentials
- Email:
admin@gmailcom - Password: Admin123
- Three role-based dashboards β Supporter, Creator, and Admin each get a purpose-built sidebar, home page, and permission set, enforced server-side with JWT + role middleware, not just hidden in the UI.
- Dual authentication β register/login with email and password, or sign in instantly with Google; passwords are hashed with bcrypt and sessions are stateless JWTs stored client-side.
- Starting credit grants β new Supporters receive 50 credits and new Creators receive 20 credits automatically on registration, granted exactly once.
- Full campaign lifecycle β Creators submit campaigns as "pending"; Admins approve, reject, or suspend them; approved campaigns become visible to Supporters until their deadline passes.
- Credit-hold contribution system β a Supporter's credits are held the moment they contribute and only released to the campaign (or refunded) once the Creator approves or rejects it.
- Automatic refund cascade β deleting a campaign refunds every Supporter whose contribution had already been approved, so no one loses credits to a cancelled project.
- Stripe-powered credit purchases β four credit packages (100β1500 credits) checked out through Stripe, with an automatic dummy-payment fallback so the flow is fully testable without live Stripe keys.
- Transparent withdrawal economics β Creators withdraw earnings at a fixed 20-credits-per-dollar rate once they've raised a 200-credit minimum, with Admin-side "Payment Success" confirmation before credits are deducted.
- Real-time-style notifications β every approval, rejection, and withdrawal confirmation writes a notification the recipient sees in a floating bell popover, sorted newest-first and dismissible by clicking anywhere on the page.
- Campaign reporting & moderation β Supporters can flag suspicious campaigns; Admins review, suspend, or remove them from a dedicated Reports table.
- imgBB-powered image uploads β campaign cover images and profile pictures upload directly to imgBB, with a manual URL fallback if no API key is configured.
- Paginated contribution history β a Supporter's full contribution history is paginated server-side rather than loaded all at once.
- Resilient private routing β reloading the browser on any dashboard route does not bounce the user back to the login page, since the auth check resolves before route guards make a decision.
- Fully responsive β the marketing pages, campaign browsing, and every dashboard table adapt cleanly from mobile through desktop, including a collapsible sidebar drawer on small screens.
Client
- React 18 + Vite
- React Router v6
- Tailwind CSS
- Firebase Authentication (Google sign-in)
- Axios
- Swiper (hero slider & testimonials)
- Stripe.js / React Stripe.js
- React Hot Toast
Server
- Node.js + Express
- MongoDB + Mongoose
- JSON Web Tokens (JWT) for stateless auth
- bcryptjs for password hashing
- Stripe (PaymentIntents API)
Hosting
- Client: Vercel
- Server: Render
crowdfunding-platform/
βββ client/ # React + Vite frontend
β βββ src/
β βββ api/ # axios instances (public + secured)
β βββ components/ # Navbar, Footer, notification bell, etc.
β βββ context/ # Auth context
β βββ hooks/ # useAuth, useAxiosSecure, useRole
β βββ layouts/ # MainLayout, DashboardLayout
β βββ pages/ # Home, Auth, Campaigns, Dashboard (per role)
β βββ providers/ # AuthProvider
β βββ routes/ # Route definitions, PrivateRoute, RoleRoute
βββ server/ # Express + MongoDB backend
βββ config/ # Database connection
βββ middleware/ # verifyToken, verifyRole
βββ models/ # User, Campaign, Contribution, Withdrawal, Payment, Notification, Report
βββ routes/ # REST endpoints, grouped by resource
βββ utils/ # Notification helper
βββ seedAdmin.js # One-time script to create/promote an admin account
- Node.js 18+
- A MongoDB Atlas cluster (or local MongoDB)
- A Firebase project with Google sign-in enabled
- (Optional) imgBB API key and Stripe test keys
git clone https://github.com/your-username/sparkfund-server.git server
git clone https://github.com/your-username/sparkfund-client.git clientcd server
npm installCreate a .env file in server/:
PORT=5000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_long_random_secret
STRIPE_SECRET_KEY=your_stripe_secret_key
CLIENT_URL=http://localhost:5173npm run devcd client
npm installCreate a .env file in client/:
VITE_API_URL=http://localhost:5000/api
VITE_FIREBASE_API_KEY=your_firebase_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id
VITE_IMGBB_API_KEY=your_imgbb_api_key
VITE_STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_keynpm run devThe client runs at http://localhost:5173, the server at http://localhost:5000.
There is no public admin registration option by design. After registering a normal account through the app, promote it from the server/ folder:
node seedAdmin.js admin@example.com "YourPassword123" "Admin Name"Log out and back in on the client to see the Admin dashboard.
- Client (Vercel): set all
VITE_*environment variables in the Vercel project settings, and pointVITE_API_URLat your deployed server's/apipath. Redeploy after changing any env var β Vite bakes them in at build time. - Server (Render): set
MONGODB_URI,JWT_SECRET,STRIPE_SECRET_KEY, andCLIENT_URLin the Render dashboard.CLIENT_URLmust match your Vercel URL exactly, with no trailing slash, or the browser will block requests with a CORS error.
This project was built as a technical assessment and is provided as-is for educational and portfolio purposes.