DevoCode is a modern web platform that enables LPU (Lovely Professional University) students to share and access study resources in an organized and secure manner. Built with Next.js and MongoDB, it provides a centralized hub where students can collaborate, share study materials, and access educational resources across different subjects.
The platform features a robust authentication system, resource management capabilities, and an intuitive user interface. Users can upload various types of resources including notes, assignments, MCQs, and reference materials. The platform also includes features like CGPA calculation, user profiles, and administrative controls to ensure content quality and security. With real-time logging, secure file storage using AWS S3, and comprehensive user management, DevoCode creates an efficient and reliable educational resource sharing ecosystem.
.
├── app/ # Next.js application pages and routing
│ ├── auth/ # Authentication related pages
│ ├── dashboard/ # User dashboard views
│ ├── resources/ # Resource management pages
│ └── settings/ # User settings and configuration
├── components/ # Reusable React components
│ ├── common/ # Shared UI components (navbar, sidebar, etc.)
│ ├── Dashboard/ # Dashboard-specific components
│ ├── landingpage/ # Landing page sections
│ └── resources/ # Resource management components
├── middleware/ # Authentication and authorization middleware
├── models/ # MongoDB schema definitions
├── pages/ # API routes and endpoints
│ └── api/ # REST API implementations
├── utils/ # Utility functions and configurations
└── assets/ # Static assets and icons
- Node.js 16.x or higher
- MongoDB database
- AWS S3 bucket for file storage
- Gmail account for email notifications
# Clone the repository
git clone <repository-url>
cd devocode
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.local
# Configure environment variables in .env.local:
NEXT_PUBLIC_MONGO_URL=<your-mongodb-url>
NEXT_PUBLIC_GMAIL=<your-gmail>
NEXT_PUBLIC_GMAIL_PASSWORD=<your-gmail-app-password>
NEXT_PUBLIC_AWS_ACCESS_KEY=<your-aws-access-key>
NEXT_PUBLIC_AWS_SECRET_KEY=<your-aws-secret-key>
NEXT_PUBLIC_S3_BUCKET_NAME=<your-s3-bucket-name>
# Start development server
npm run dev
- Register an account or log in to access the platform
// Example login request
const response = await fetch('/api/auth/login', {
method: 'POST',
body: JSON.stringify({
username: '[email protected]',
password: 'password123'
})
});
- Navigate to the Resources section to browse or upload materials
// Example resource upload
const formData = new FormData();
formData.append('file', fileObject);
formData.append('title', 'Resource Title');
formData.append('type', 'notes');
await fetch('/api/resources/resources', {
method: 'POST',
body: formData
});
- Creating a new subject:
const response = await fetch('/api/resources/subjects', {
method: 'POST',
body: JSON.stringify({
code: 'CSE101',
title: 'Introduction to Computer Science',
description: 'Fundamental concepts of programming'
})
});
- Updating user profile:
const response = await fetch('/api/user', {
method: 'PUT',
body: JSON.stringify({
name: 'John Doe',
email: '[email protected]',
phone: '1234567890'
})
});
- Authentication Issues
- Error: "Invalid token"
- Clear browser local storage
- Re-login to the application
- Check if JWT_SECRET_KEY is properly set
- File Upload Problems
- Error: "File size exceeds limit"
- Ensure file size is under 4MB
- Check AWS S3 bucket permissions
- Verify AWS credentials in environment variables
- Database Connection Issues
- Error: "MongoDB connection failed"
- Verify MONGO_URL in environment variables
- Check network connectivity
- Ensure MongoDB instance is running
DevoCode follows a client-server architecture where the Next.js frontend communicates with the API endpoints to manage resources and user data. All data is stored in MongoDB with files being stored in AWS S3.
Client (Next.js) --> API Routes (/api/*) --> MongoDB/S3
↑ |
| v
User Authentication <-- JWT Token
Key component interactions:
- Authentication flow uses JWT tokens for secure access
- Resource uploads are processed through S3 for storage
- User actions are logged using Winston logger
- Real-time updates use client-side state management
- API routes handle data validation and processing
- MongoDB stores user data, subjects, and resource metadata
- Email notifications use nodemailer with Gmail SMTP
- MongoDB Database: Stores user data, subjects, resources metadata, and logs
- AWS S3 Bucket: Stores uploaded resource files
- Vercel Analytics: Tracks application performance
- Speed Insights: Monitors page load times
- Axiom Web Vitals: Collects core web vitals metrics
- Winston Logger: Handles application logging
- MongoDB Transport: Stores logs in production
- File Transport: Stores error and combined logs
- Console Transport: Development environment logging