Prerequisites
Before you begin, ensure you have the following installed:Node.js
Version 16.x or higher
Package Manager
npm, yarn, or pnpm
Git
For version control
Code Editor
VS Code recommended
Installation
Install Dependencies
Install all required packages using your preferred package manager:This will install all dependencies from
package.json, including:- React 18.2.0
- Firebase 10.5.2
- Stripe 14.3.0
- React Router 6.17.0
- And more…
Environment Configuration
Create a Add the following variables (see Firebase Config and Stripe Integration for values):
.env file in the root directory and configure your environment variables:Project Structure
Backend Configuration
The frontend connects to a Railway-hosted backend API. The base URL is configured inmain.jsx:8:
If you’re running a local backend, update this URL to
http://localhost:YOUR_PORTDevelopment Workflow
Running the Application
- Development Mode
- Production Build
- Preview Build
- Linting
Start the dev server with hot module replacement:
- Fast refresh on file changes
- Source maps for debugging
- Runs on
http://localhost:5173
Environment Variables
EducaStream uses Vite’s environment variable system. Variables must be prefixed withVITE_ to be exposed to the client:
Troubleshooting
Port already in use
Port already in use
If port 5173 is already in use, Vite will automatically try the next available port. You can also specify a custom port:
vite.config.js
Module not found errors
Module not found errors
Delete
node_modules and reinstall:Firebase initialization fails
Firebase initialization fails
Ensure all Firebase environment variables are set correctly in
.env:- Check for typos in variable names
- Verify all values from Firebase Console
- Restart dev server after changing
.env
Axios network errors
Axios network errors
If API calls fail:
- Check backend is running
- Verify the
axios.defaults.baseURLinmain.jsx - Check CORS settings on backend
- Inspect network tab in browser DevTools
Verification
After setup, verify everything works:Next Steps
Configure Firebase
Set up Firebase Storage and Authentication
Configure Stripe
Set up payment processing
Architecture
Learn about the application architecture
Additional Resources
Vite Documentation
Official Vite documentation for build configuration
React Documentation
Official React documentation and guides