A collaborative platform for students to upload study materials, share resources, and connect with peers for academic support.
- Features
- Architecture
- Prerequisites
- Installation
- Configuration
- Usage
- Project Structure
- Technologies Used
- Contributing
- License
- Upload and organize study materials
- Real-time collaboration with peers
- User authentication via Firebase Auth
- Cloud storage for documents and resources
- Responsive Material-UI interface
- Load-balanced backend with Docker Swarm
The application uses a microservices architecture with:
- Frontend: React application served via Nginx (3 replicas)
- Backend: Node.js/Express API (4 replicas)
- Load Balancer: Nginx reverse proxy
- Database: Firebase Realtime Database
- Storage: Firebase Cloud Storage
- Authentication: Firebase Authentication
Before you begin, ensure you have the following installed:
- Node.js (v14.0.0 or higher)
- npm (v6.0.0 or higher)
- Docker (v20.10 or higher) - for Docker deployment
- Docker Compose (v1.29 or higher) - for Docker deployment
- Git
git clone https://github.com/dheerajram13/CourseCompanion
cd CourseCompanion- Create a new Firebase project at Firebase Console
- Enable the following services:
- Firebase Authentication (Email/Password and Google providers)
- Cloud Firestore
- Realtime Database
- Cloud Storage
- Generate a service account key:
- Go to Project Settings > Service Accounts
- Click "Generate New Private Key"
- Save the JSON file as
firebase-config.jsonin the project root - Also save it as
firebase-adminsdk.jsonin thebackend/directory
- Get your Realtime Database URL from Firebase Console
# Install prerequisites
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
# Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Add Docker repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# Install Docker
sudo apt update
sudo apt install docker-ce -y
# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose# Initialize Docker Swarm
sudo docker swarm init
# Build images
sudo docker build -t coursecompanion_frontend:latest ./frontend
sudo docker build -t coursecompanion_backend:latest ./backend
# Deploy the stack
sudo docker stack deploy --compose-file docker-compose.yml coursecompanion
# Check deployment status
sudo docker stack ps coursecompanion
# View service logs
sudo docker service logs coursecompanion_frontend
sudo docker service logs coursecompanion_backendThe application will be accessible at http://localhost
# List running services
sudo docker stack services coursecompanion
# Scale a service
sudo docker service scale coursecompanion_backend=6
# Remove the stack
sudo docker stack rm coursecompanion
# Leave swarm mode
sudo docker swarm leave --force# Navigate to backend directory
cd backend
# Install dependencies
npm install
# Create .env file
cat > .env << EOF
FIREBASE_DB_URL=your_firebase_database_url_here
PORT=81
EOF
# Start the backend server
npm startThe backend will run on http://localhost:81
Open a new terminal:
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Create .env file (optional, for custom API URL)
cat > .env << EOF
REACT_APP_API_BASE_URL=http://localhost:81/api
EOF
# Start the development server
npm startThe frontend will run on http://localhost:3000
FIREBASE_DB_URL=https://your-project-id.firebaseio.com/
PORT=81REACT_APP_API_BASE_URL=http://localhost:81/apifirebase-config.json- Root directory (for Docker deployment)firebase-adminsdk.json- Backend directory (for local development)
Important: Never commit these files to version control. They are already in .gitignore.
- Open your browser and navigate to:
- Local development:
http://localhost:3000 - Docker deployment:
http://localhost
- Local development:
- Create an account or sign in
- Upload study materials
- Browse and search for resources
- Collaborate with other students
CourseCompanion/
├── backend/ # Node.js/Express backend
│ ├── routes/ # API routes
│ ├── firebaseAdmin.js # Firebase initialization
│ ├── server.js # Express server entry point
│ ├── package.json
│ └── dockerfile
├── frontend/ # React frontend
│ ├── public/ # Static files
│ ├── src/ # React components and logic
│ ├── package.json
│ └── dockerfile
├── images/ # Documentation images
├── docker-compose.yml # Docker Swarm configuration
├── nginx.conf # Nginx load balancer config
└── Readme.md
- React 18.3.1 - UI library
- Material-UI (MUI) 6.1.3 - Component library
- React Router 6.27.0 - Client-side routing
- Firebase SDK 10.14.1 - Authentication and storage
- Emotion - CSS-in-JS styling
- Node.js - Runtime environment
- Express 4.21.0 - Web framework
- Firebase Admin SDK 12.6.0 - Backend Firebase integration
- Multer 1.4.5 - File upload handling
- CORS 2.8.5 - Cross-origin resource sharing
- Docker - Containerization
- Docker Swarm - Orchestration
- Nginx - Load balancing and reverse proxy
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the ISC License.
Note: This project is part of an academic initiative to improve student collaboration and resource sharing.
