A modern React application with Progressive Web App (PWA) capabilities built with Vite.
- ⚡ Vite - Fast build tool and development server
- ⚛️ React 18 - Latest React with modern hooks
- 🎨 React Bootstrap - Styling framework
- 🛣️ React Router - Client-side routing
- 📱 PWA Ready - Installable, offline-capable app
- 🔄 Auto-updates - Service worker with auto-update functionality
- 📊 Caching Strategy - Smart caching for better performance
- 📦 Additional Packages: axios, react-icons, react-hook-form, yup, formik, moment
- Node.js (v16 or higher)
- npm or yarn
-
Navigate to the project directory:
cd StudySpot -
Install dependencies:
npm install
npm run devThe app will be available at http://localhost:5173
npm run buildnpm run preview- Desktop: Look for the install icon in the address bar or use the "Install App" button
- Mobile: Use "Add to Home Screen" option in your browser menu
This app works offline thanks to service worker caching:
- Static assets are cached automatically
- API responses are cached with NetworkFirst strategy
- Fallback pages for offline scenarios
-
Install Prompt Testing:
# Serve the built app locally npm run build npm run preview -
Service Worker Testing:
- Open DevTools → Application → Service Workers
- Check if SW is registered and active
-
Offline Testing:
- Build and serve the app
- Open DevTools → Network → check "Offline"
- Refresh the page - it should still work
-
Replace these files in
public/folder:pwa-192x192.svg→pwa-192x192.pngpwa-512x512.svg→pwa-512x512.pngapple-touch-icon.svg→apple-touch-icon.pngfavicon.svg→favicon.ico
-
Use tools like:
- ✅ Web App Manifest configured
- ✅ Service Worker registered
- ✅ HTTPS ready (required for PWA)
- ✅ Responsive design
⚠️ Replace placeholder icons with real ones⚠️ Test on actual devices⚠️ Test offline functionality
StudySpot/
├── public/
│ ├── pwa-192x192.svg # Replace with PNG
│ ├── pwa-512x512.svg # Replace with PNG
│ └── apple-touch-icon.svg # Replace with PNG
├── src/
│ ├── components/ # Reusable components
│ ├── pages/ # Page components
│ ├── hooks/ # Custom React hooks
│ │ └── usePWA.js # PWA functionality hook
│ ├── store/ # State management
│ ├── utils/ # Utility functions
│ │ └── axiosInstance.js # Axios configuration
│ ├── assets/ # Static assets
│ ├── App.jsx # Main App component
│ └── main.jsx # Entry point
├── vite.config.js # Vite configuration
└── package.json
This project uses React Bootstrap for styling:
- React Bootstrap components installed
- Import components:
import { Button, Container } from 'react-bootstrap' - Bootstrap CSS included automatically
Axios is pre-configured in src/utils/axiosInstance.js:
import { api } from './utils/axiosInstance';
// GET request
const data = await api.get('/users');
// POST request
const response = await api.post('/users', { name: 'John' });Create a .env file:
VITE_API_URL=https://your-api-url.com
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint (if configured)
npm install -g vercel
vercel --prodnpm run build
# Upload dist/ folder to Netlify- ✅ Build with
npm run build - ✅ Serve over HTTPS
- ✅ Test service worker registration
- ✅ Verify manifest.json is accessible
- ✅ Test install prompt on mobile/desktop
- ✅ Replace placeholder icons with real ones
- Replace PWA Icons: Replace SVG placeholders with proper PNG icons
- Test PWA Features: Test installation and offline functionality
- Customize Caching: Modify caching strategy in vite.config.js
- Add Components: Start building your app components
- Configure API: Set up your API endpoints
- Deploy: Deploy to a PWA-compatible hosting service
Built using React + Vite + PWA