A secure PDF viewing platform built with the MERN stack, featuring role-based access control, Google OAuth integration, and Google Drive storage. Now with Capacitor integration for Android apps.
This project uses PNPM workspaces for monorepo management. The main workspace folders are:
ignite-new/
βββ admin/ # React admin dashboard for PDF management
βββ backend/ # Express.js API server
βββ client/ # Public React client for PDF viewing
βββ docs/ # Project and API documentation
βββ setup.js # Setup script for environment files
βββ generate-docs.js # Internal documentation generator
βββ pnpm-workspace.yaml
- Node.js: v22.13.0 or higher
- PNPM: v10.12.1 or higher (preferred package manager)
- MongoDB: Local installation or MongoDB Atlas account
- Google Drive Account: For PDF storage
- Android Studio: For building Android apps
git clone https://github.com/ritaban06/ignite-new
cd ignite-new
# Install all workspace dependencies
pnpm i
Option A: Start All Services (Recommended)
pnpm dev:all
Option B: Start Services Individually
# Terminal 1 - Backend API (Port 5000)
pnpm dev:backend
# Terminal 2 - Admin Dashboard (Port 3001)
pnpm dev:admin
# Terminal 3 - Client App (Port 3000)
pnpm dev:client
- Client App: http://localhost:3000 (Public PDF viewer)
- Admin Dashboard: http://localhost:3001 (PDF management)
- Backend API: http://localhost:5000 (REST API)
- JWT-based authentication with refresh tokens
- Google OAuth 2.0 integration
- Role-based access control (Admin/Client)
- Signed URLs with short TTL (Time To Live)
- PDF viewing without download capability
- Comprehensive access logging and analytics
- Request validation
- Secure headers with Helmet.js
- Secure admin login dashboard
- PDF metadata management (department/year/category) in admin panel; actual PDF upload handled separately
- Bulk PDF management operations
- User management
- Real-time analytics and access logs
- System configuration and settings
- Google OAuth and email-based authentication
- Department and year-based PDF filtering
- Advanced search functionality
- Secure PDF viewing (no download/share/print/dev tools)
- Mobile-responsive design
- Clean, intuitive user interface
- Access history tracking
- Capacitor integration for Android apps
- Offline PDF viewing support
- Push notifications for updates
- Screenshot & screenrecorder protection
- Framework: React 18 with Vite (Vite JS)
- Styling: Tailwind CSS
- State Management: Context API
- PDF Rendering: Primary -
react-pdf-viewer
Backup -PDF.js
- HTTP Client: Axios
- Build Tool: Vite
- Runtime: Node.js (v22+)
- Framework: Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: JWT + Google OAuth 2.0
- Security: Helmet.js, CORS
- Validation: Express-validator
- Storage: Google Drive
- Package Manager: PNPM Workspaces
- Google Cloud: Google Sheets API
- Deployment: Vercel (frontend), Vercel/DigitalOcean (backend)
- The project includes an internal documentation generator:
generate-docs.js
. - Running this script will scan the
admin
,backend
, andclient
folders and output a structured JSON toadmin/docs/docs.json
. - The admin dashboard includes a Docs page that renders this documentation for contributors.
- Node.js: v22.13.0 or higher
- PNPM: v10.12.0 or higher
- MongoDB: Local or Atlas
-
MongoDB:
- Local installation OR
- MongoDB Atlas (cloud) - Free tier available
-
Google Account (Free tier sufficient):
- Google Drive storage
- Easy management for admins
-
Google Cloud Console (Optional, for OAuth):
- OAuth 2.0 client credentials
- Enable Google+ API
-
Android Studio:
- Required for building Android apps
- VS Code: With ESLint and Prettier extensions
- MongoDB Compass: GUI for database management
- Postman/Insomnia: API testing
- Git: Version control
This project uses PNPM workspaces for efficient monorepo management. Each package has its own:
package.json
with specific dependencies- Development and build scripts
- Independent deployment configuration
# Development
pnpm dev:all # Start all services concurrently
pnpm dev:backend # Start backend only
pnpm dev:admin # Start admin dashboard only
pnpm dev:client # Start client app only
# Building
pnpm build:all # Build admin and client for production
pnpm build:android # Build Android app
# Maintenance
pnpm clean # Clean all node_modules
pnpm lint # Run ESLint on all packages
Create .env
files in each package directory:
Backend (.env)
NODE_ENV=development or production
PORT=5000
MONGODB_URI=mongodb://localhost:27017/ignite
JWT_SECRET=your-super-secret-jwt-key
APPROVED_USERS_SHEET_URL=your-google-sheets-url-here
APPROVED_USERS_SHEET_GID=your-google-sheets-gid-here
ADMIN_URL=http://localhost:3001
CLIENT_URL=http://localhost:3000
SESSION_SECRET=your-session-secret-key
ADMIN_USERNAME=your-admin-username-here
ADMIN_PASSWORD=your-secure-admin-password-here
GOOGLE_CLIENT_ID=your-google-oauth-client-id
GOOGLE_CLIENT_SECRET=your-google-oauth-client-secret
GDRIVE_BASE_FOLDER_ID=your-google-drive-base-folder-id-here
GDRIVE_CREDENTIALS=your-google-drive-credentials-json-content-here
Client (.env)
VITE_API_URL=http://localhost:5000/api
VITE_GOOGLE_CLIENT_ID=your-google-oauth-web-client-id-here
VITE_SECURE_GLOBAL_DISABLE=true
Admin (.env)
VITE_API_URL=http://localhost:5000/api
VITE_GDRIVE_BASE_FOLDER_ID=your-gdrive-base-folder-id
# Build and deploy admin dashboard
cd admin
pnpm build
vercel --prod
# Build and deploy client app
cd client
pnpm build
vercel --prod
The backend can be deployed to various platforms:
Vercel:
cd backend
vercel --prod
Digital Ocean:
# Use PM2 for production process management
npm install -g pm2
pm2 start server.js --name "ignite-backend"
pm2 startup
pm2 save
cd client
pnpm build:android
POST /api/auth/login
- Admin/user loginPOST /api/auth/google
- Google OAuth loginPOST /api/auth/refresh
- Refresh JWT tokenPOST /api/auth/logout
- Logout user
GET /api/pdfs
- List PDFs (with filters)POST /api/pdfs/upload
- Upload PDF (admin only)GET /api/pdfs/:id
- Get PDF detailsGET /api/pdfs/:id/view
- Get signed viewing URLDELETE /api/pdfs/:id
- Delete PDF (admin only)
GET /api/users
- List users (admin only)PUT /api/users/:id
- Update user (admin only)DELETE /api/users/:id
- Delete user (admin only)
GET /api/admin/analytics
- Access analytics (admin only)GET /api/admin/logs
- Access logs (admin only)
MongoDB Connection Issues:
# Check if MongoDB is running
mongosh --host localhost:27017
# For MongoDB Atlas, verify connection string in .env
PNPM Installation Issues:
# Clear PNPM cache
pnpm store prune
# Reinstall dependencies
rm -rf node_modules pnpm-lock.yaml
pnpm install
PDF Upload/Viewing Issues:
- Ensure signed URLs are not expired
Google OAuth Issues:
- Verify Google Client ID in both backend and frontend
.env
- Check authorized origins in Google Cloud Console
- Ensure Google+ API is enabled
Android Build Issues:
- Ensure Android Studio is installed and configured
- Verify Capacitor dependencies are installed
- Use
pnpm dev:all
for concurrent development - Check browser console for frontend errors
- Monitor backend logs for API issues
- Use MongoDB Compass to inspect database state
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow ESLint configuration
- Write meaningful commit messages
- Test your changes thoroughly
- Update documentation when needed
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the Troubleshooting section
- Search existing Issues
- Create a new issue with detailed information
Built with β€οΈ for secure educational content delivery