Official web platform for Aviyukt NGO with:
Aviyukt NGO is a community-focused platform designed to present social initiatives and support operational workflows like onboarding, donations, and user profile access.
The platform supports:
- Google-only authentication
- Donation and membership payments via Razorpay
- Payment verification and history lookup
- Contact email capture
- NGO service showcase pages and team/credits sections
- Google OAuth sign-in (no email/password auth flow)
- Session handling with JWT in HTTP-only cookies
- Donation flow and membership payment flow
- Razorpay order creation and signature verification
- Receipt generation (PDF) on the frontend after successful payment
- Payment history lookup by Aadhaar number
- Contact/volunteer form email capture
- Service pages across agriculture, health, education, legal/insurance, and household support
- Responsive UI with React Router-based navigation
The platform currently highlights the following service categories:
- Agriculture
- Medicine
- Health
- Placement
- Education
- Rental Work
- Property (Purchase, Loan, Registry, Mutation)
- Insurance (Legal and Court Case Work)
- Household Services
Aviyuktngo/
|- frontend/
| |- src/
| | |- Components/
| | |- context/
| | |- data/
| | |- instant/
| | |- pages/
| | |- routes/
| |- package.json
| |- vite.config.js
| |- vercel.json
|- BackEnd/
| |- src/
| | |- controller/
| | |- db/
| | |- middleware/
| | |- models/
| | |- routes/
| | |- app.js
| |- server.js
| |- package.json
|- README.md
- Node.js 18+
- npm
- MongoDB connection string
- Razorpay test/live keys
- Google OAuth Client ID
cd BackEnd
npm installCreate BackEnd/.env:
PORT=3000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
GOOGLE_CLIENT_ID=your_google_client_id
FRONTEND_URLS=http://localhost:5173,https://your-frontend-domain.com
RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret
NODE_ENV=developmentStart backend:
npm startBackend default URL: http://localhost:3000
cd frontend
npm installCreate frontend/.env:
VITE_API_BASE_URL=http://localhost:3000
VITE_GOOGLE_CLIENT_ID=your_google_client_id
VITE_RAZORPAY_KEY_ID=your_razorpay_key_idStart frontend:
npm run devFrontend default URL: http://localhost:5173
| Variable | Required | Purpose |
|---|---|---|
PORT |
No | API server port (default: 3000) |
MONGO_URI |
Yes | MongoDB connection string |
JWT_SECRET |
Yes | JWT signing secret |
GOOGLE_CLIENT_ID |
Yes | Google OAuth token audience verification |
FRONTEND_URLS |
Recommended | Comma-separated CORS allowlist additions |
RAZORPAY_KEY_ID |
Yes (payments) | Razorpay key ID for order creation |
RAZORPAY_KEY_SECRET |
Yes (payments) | Razorpay key secret for signature verification |
NODE_ENV |
Recommended | Cookie behavior (production enables secure cookie flags) |
Default CORS frontend origins already included in code:
http://localhost:5173https://aviyuktngo.vercel.apphttps://www.aviyuktngo.org
| Variable | Required | Purpose |
|---|---|---|
VITE_API_BASE_URL |
Yes | Backend base URL for API calls |
VITE_GOOGLE_CLIENT_ID |
Optional | Google OAuth client ID (if omitted, frontend fetches from backend) |
VITE_RAZORPAY_KEY_ID |
Yes (payments) | Razorpay publishable key used in checkout |
npm run dev # start Vite dev server
npm run build # build production bundle
npm run lint # lint source
npm run preview # preview production buildnpm start # run server.jsBase URL (local): http://localhost:3000
| Method | Route | Description |
|---|---|---|
GET |
/google-client-id |
Returns configured Google client ID |
POST |
/google |
Verifies Google ID token, upserts user, sets auth cookie |
GET |
/me |
Returns current logged-in user (requires token/cookie) |
POST |
/logout |
Clears auth cookie |
| Method | Route | Description |
|---|---|---|
POST |
/email |
Stores contact email in DB |
| Method | Route | Description |
|---|---|---|
POST |
/paymentcreate |
Creates Razorpay order and stores pending payment |
POST |
/paymentverify |
Verifies Razorpay signature and marks payment completed |
POST |
/payHistory |
Returns payment history by Aadhaar number |
name(required)email(required, unique)profilePicgoogleId(unique, sparse)- timestamps
orderId(required)paymentIdsignatureamount(required)currency(required)- donor/member details:
name,email,adhar,address,occupation,street,city,state,pincode,gender status(pending/completed)- timestamps
email(required)- timestamps
- Google-only authentication flow
- Backend verifies Google ID token audience with
GOOGLE_CLIENT_ID - JWT token is issued and stored in HTTP-only cookie (
token) - Auth middleware accepts cookie token or
Authorization: Bearer <token> - In production, cookie settings use
secure: trueandsameSite: None - CORS is origin-restricted using defaults +
FRONTEND_URLS
Important production recommendations:
- Use HTTPS for frontend and backend
- Use strong
JWT_SECRET - Never commit
.envfiles - Protect and rotate Razorpay keys as needed
- Frontend is Vercel-ready (
frontend/vercel.jsonhas SPA rewrite) - Backend can be deployed on Render, Railway, VPS, or any Node host
- Ensure all required env variables are configured in deployment platform
- Keep frontend
VITE_API_BASE_URLpointed to deployed backend URL
- President: Narayan Kumar Shrivastav
- Vice President: Vijay Kumar khare
- Secretary: Brajesh Pratap Singh
- Joint Secretary: Dr. Sukrati shrivastava
- Treasurer: Sapna Shrivastava
- Board Member: Awadh Bihari Gautam
- Board Member: Pankaj Kumar Panthi
- Anand Singh Chouhan - Founder and Visionary
- Ankesh Barhadiya - Co-Founder and Tech Lead
- Sameer Khan - Co-Founder and Tech Lead
- Deepti Lodhi - Co-Founder and Tech Lead
- Sameer Khan
- Email:
sameerkhan27560@gmail.com - LinkedIn:
https://www.linkedin.com/in/sameer-khan2210/
- Email:
- Email:
aviyuktngo@gmail.com - Phone:
+91 8770321854 - Location: Bhopal, India
Social links:
- Instagram:
https://www.instagram.com/aviyukt_samaja_sevi_sansthan - Facebook:
https://www.facebook.com/share/18ykXqs2ca/ - YouTube:
http://www.youtube.com/@Aviyuktngo
- Fork the repo
- Create a feature branch
- Make and test changes locally
- Open a pull request with clear description
Recommended before PR:
- Run frontend linting
- Validate auth flow
- Validate payment create + verify in Razorpay test mode
- Google login not appearing:
- Check
GOOGLE_CLIENT_IDin backend and/orVITE_GOOGLE_CLIENT_IDin frontend
- Check
- Unauthorized on
/api/auth/me:- Check cookie settings, CORS config, and
withCredentialsbehavior
- Check cookie settings, CORS config, and
- Payment create failing:
- Verify
RAZORPAY_KEY_IDandRAZORPAY_KEY_SECRETin backend
- Verify
- Payment verify failing:
- Ensure correct signature and order/payment IDs are sent
- No payment history:
- Aadhaar must be exactly 12 digits
- Backend currently uses
npm startonly (no nodemon script configured). - No automated tests are configured yet in this repository.
A complete Admin Panel with Gallery Management System that allows:
- ✅ Create, Read, Update, Delete (CRUD) categories with images
- ✅ Upload & manage multiple gallery images per category
- ✅ Cloud storage using Cloudinary
- ✅ User-facing gallery page with category browsing
- ✅ Admin authentication & authorization
- ✅ Beautiful, responsive UI with TailwindCSS
src/models/category.model.js- Category schema with single imagesrc/models/image.model.js- Image schema with category reference
src/controller/categoryController.js- CRUD operations for categoriessrc/controller/imageController.js- CRUD operations for images
src/middleware/uploadMiddleware.js- Cloudinary configuration & multer setupsrc/middleware/adminMiddleware.js- Authentication & authorization
src/routes/adminRoutes.js- All admin API endpoints
BackEnd/.env.example- Environment variables template.env- Your actual environment variables (you'll create this)
src/api/adminAPI.js- API service for all admin operations
src/Components/Admin/AdminDashboard.jsx- Main admin dashboard with tabssrc/Components/Admin/AdminCategories.jsx- Category management componentsrc/Components/Admin/AdminImages.jsx- Image management component
src/pages/Gallery.jsx- Public gallery page
src/routes/ProtectedAdminRoute.jsx- Admin-only route protection
ADMIN_SETUP.md- Complete setup & usage guideQUICK_START.md- Quick start reference guideIMPLEMENTATION_SUMMARY.md- This file
┌─────────────────────────────────────────────────────┐
│ User-Facing Gallery (/gallery) │
│ - Browse all categories │
│ - Click category → View all images │
│ - View image in modal │
└─────────────────────────────────────────────────────┘
↑
┌─────────────┴─────────────┐
↓ ↓
┌──────────────┐ ┌──────────────────┐
│ Frontend │ │ Backend API │
│ (React) │ │ (Express.js) │
└──────────────┘ └──────────────────┘
↓ ↓
Components: Services:
- AdminDashboard - categoryRoutes
- AdminCategories - imageRoutes
- AdminImages - uploadMiddleware
- Gallery - Cloudinary
↑ ↓
└─────────────┬─────────────┘
↓
┌───────────────────────┐
│ Cloudinary Cloud │
│ (Image Storage) │
└───────────────────────┘
{
_id: ObjectId,
name: "String (unique)",
description: "String (optional)",
categoryImage: "URL from Cloudinary",
categoryImagePublicId: "For deletion",
isActive: Boolean,
createdAt: Date,
updatedAt: Date
}{
_id: ObjectId,
categoryId: ObjectId (reference to Category),
title: "String (required)",
description: "String (optional)",
imageUrl: "URL from Cloudinary",
publicId: "For deletion",
isActive: Boolean,
createdAt: Date,
updatedAt: Date
}| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| GET | /api/admin/categories |
No | Get all categories |
| POST | /api/admin/categories |
Admin | Create category |
| GET | /api/admin/categories/:id |
No | Get category by ID |
| PUT | /api/admin/categories/:id |
Admin | Update category |
| DELETE | /api/admin/categories/:id |
Admin | Delete category |
| PATCH | /api/admin/categories/:id/deactivate |
Admin | Soft delete |
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| GET | /api/admin/images |
No | Get all images |
| POST | /api/admin/images |
Admin | Upload image |
| GET | /api/admin/images/:id |
No | Get image by ID |
| GET | /api/admin/images/category/:categoryId |
No | Get images by category |
| PUT | /api/admin/images/:id |
Admin | Update image |
| DELETE | /api/admin/images/:id |
Admin | Delete image |
| PATCH | /api/admin/images/:id/deactivate |
Admin | Soft delete |
- Requires JWT token (from existing login system)
- Checks if user email matches
ADMIN_EMAILin.env - All admin routes protected with
isAuthenticatedandisAdminmiddleware
- Gallery page accessible to all users
- Can view categories and images
- No login required for viewing
- Tabbed Interface: Categories & Images tabs
- Create Operations: Add new categories & images
- Read Operations: View all entries in grid layout
- Update Operations: Edit existing entries
- Delete Operations: Delete with confirmation
- File Upload: Image upload with preview
- Filtering: Filter images by category
- Responsive Design: Works on mobile, tablet, desktop
- Category Selection: Browse all categories
- Image Grid: View images in category
- Modal View: Click image to view fullscreen
- Category Images: Each category has featured image
- Descriptions: Show descriptions for both categories and images
- Responsive: Mobile-first design with Tailwind CSS
- Node.js - JavaScript runtime
- Express.js - Web framework
- Mongoose - MongoDB ODM
- Multer - File upload handling
- Cloudinary - Cloud image storage
- JWT - Authentication
- React 19 - UI library
- Vite - Build tool
- Tailwind CSS - Styling
- React Router - Navigation
- Axios - HTTP client
- Lucide Icons - Icon library
- Cloudinary - Image storage & optimization
- MongoDB Atlas - Database (existing)
- Admin logs in → redirected to dashboard
- Choose Categories or Images tab
- Click "Add Category/Image" button
- Fill form & upload file
- Multer intercepts file → sends to Cloudinary
- Cloudinary returns URL & public_id
- Save to MongoDB with Cloudinary URL
- Admin sees success message
- User visits
/gallery - Fetches all categories from API
- Shows category cards with images
- User clicks category
- Fetches category images from API
- Shows image grid
- Click image → modal view
- Can navigate back to categories
- Admin clicks delete button
- Confirmation dialog appears
- Delete request sent to backend
- Backend deletes from MongoDB
- Backend deletes from Cloudinary (using public_id)
- Frontend refreshes list
-
Backend:
npm installin BackEnd folder- Add Cloudinary credentials to
.env npm start
-
Frontend:
npm installin frontend foldernpm run dev
-
Add Data:
- Login with admin email
- Go to
/admin - Create categories & upload images
- Detailed step-by-step instructions
- Environment variable explanations
- Troubleshooting guide
- Database schema details
- Security considerations
✅ Cloud Storage: Images stored securely on Cloudinary ✅ Category Hierarchy: Categories contain multiple images ✅ Admin Interface: Clean, intuitive dashboard ✅ User Gallery: Beautiful gallery browsing experience ✅ Responsive Design: Works on all devices ✅ Image Optimization: Cloudinary auto-optimizes ✅ Soft Delete: Deactivate instead of hard delete ✅ Error Handling: User-friendly error messages ✅ Loading States: Smooth loading indicators ✅ Image Preview: Preview before upload ✅ Category Filtering: Filter images by category ✅ Modal View: Fullscreen image viewing
/gallery- Public gallery page/admin- Admin dashboard (protected)/admin/categories- Category management (via tab)/admin/images- Image management (via tab)
- Added "Gallery" to navbar
- Gallery accessible from main navigation
- Admin link accessible after login (if admin)
✅ JWT Authentication on admin routes ✅ Email-based admin verification ✅ File upload validation ✅ File size limits (10MB) ✅ CORS protection with whitelisted origins ✅ Secure Cloudinary integration ✅ Protected routes with middleware