A modern, full-stack web application for students to track their academic performance, calculate CGPA, and manage semester grades efficiently.
- CGPA Calculation: Real-time calculation of cumulative grade point average
- Semester Management: Track multiple semesters with courses, credits, and grades
- Academic Progress: Visualize your performance across different academic periods
- Data Export: Download your academic records as PDF or CSV
- Email/Password Authentication: Secure registration and login system
- Google OAuth 2.0: Quick sign-in with your Google account
- JWT-based Sessions: HTTP-only cookie authentication for enhanced security
- Profile Management: Complete your profile with college information
- Responsive Design: Optimized for mobile, tablet, and desktop devices
- Clean Interface: Modern, intuitive UI built with Tailwind CSS
- Real-time Updates: Instant feedback on grade calculations
- Empty States: Helpful guidance when starting out
- Current CGPA display
- Total semesters tracked
- Credit hours earned
- Courses completed count
- Quick access to add semesters, view reports, and export data
- React 18 - UI library with hooks
- Vite 7.1.14 - Next-generation frontend build tool
- React Router DOM v6 - Client-side routing
- Tailwind CSS - Utility-first CSS framework
- Node.js - JavaScript runtime
- Express 5.1.0 - Web application framework
- Prisma 6.18.0 - Modern ORM for database management
- PostgreSQL - Relational database
- Passport.js - Authentication middleware
- Bcrypt - Password hashing
- JWT - JSON Web Tokens for authentication
- CORS - Cross-origin resource sharing
- Cookie Parser - Parse HTTP cookies
- Morgan - HTTP request logger
CGPA-Analyzer/
├── client/ # Frontend application
│ ├── public/
│ │ └── assets/ # Static assets
│ ├── src/
│ │ ├── assets/ # Images, GIFs, logos
│ │ ├── features/
│ │ │ └── semesters/
│ │ │ └── calculator.js # CGPA calculation logic
│ │ ├── pages/
│ │ │ ├── Auth/
│ │ │ │ ├── CompleteProfile.jsx
│ │ │ │ ├── Login.jsx
│ │ │ │ └── Signup.jsx
│ │ │ ├── Dashboard/
│ │ │ │ └── Dashboard.jsx
│ │ │ └── Landing/
│ │ │ ├── Body1.jsx
│ │ │ ├── FooterLanding.jsx
│ │ │ ├── Landing.jsx
│ │ │ └── NavbarLanding.jsx
│ │ ├── App.css
│ │ ├── App.jsx # Main app component
│ │ ├── index.css # Global styles
│ │ └── main.jsx # Entry point
│ ├── eslint.config.js
│ ├── index.html
│ ├── package.json
│ ├── postcss.config.js
│ ├── tailwind.config.js
│ └── vite.config.js # Vite configuration
│
├── server/ # Backend application
│ ├── prisma/
│ │ ├── migrations/ # Database migrations
│ │ └── schema.prisma # Database schema
│ ├── src/
│ │ ├── config/
│ │ │ ├── index.js # App configuration
│ │ │ └── passportGoogle.js # Google OAuth setup
│ │ ├── controllers/
│ │ │ ├── auth.controller.js # Authentication logic
│ │ │ ├── college.controller.js
│ │ │ └── user.controller.js
│ │ ├── middlewares/
│ │ │ ├── auth.middleware.js # JWT verification
│ │ │ └── error.middleware.js
│ │ ├── repositories/
│ │ │ └── semester.repo.js
│ │ ├── routes/
│ │ │ ├── auth.routes.js # Auth endpoints
│ │ │ ├── college.routes.js
│ │ │ ├── index.js # Route aggregator
│ │ │ └── user.routes.js
│ │ ├── services/
│ │ │ └── semester.service.js
│ │ ├── tests/
│ │ │ └── test.js
│ │ ├── utils/
│ │ │ ├── generateToken.js # JWT token generation
│ │ │ ├── logger.js
│ │ │ └── validators/
│ │ │ └── validator.js
│ │ └── server.js # Express app entry
│ ├── db.config.js # Prisma client setup
│ └── package.json
│
├── LICENSE
└── README.md
Make sure you have the following installed:
- Node.js (v18 or higher)
- npm or yarn
- PostgreSQL (v14 or higher)
- Git
git clone https://github.com/Sorcerers-NST/CGPA-Analyzer.git
cd CGPA-Analyzercd server
npm installCreate a `.env` file in the `server` directory:
DATABASE_URL="postgresql://username:password@localhost:5432/cgpa_calculator"
JWT_SECRET="your-super-secret-jwt-key-change-this-in-production"
NODE_ENV="development"
CLIENT_URL="http://localhost:5175"
GOOGLE_CLIENT_ID="your-google-oauth-client-id"
GOOGLE_CLIENT_SECRET="your-google-oauth-client-secret"
GOOGLE_CALLBACK_URL="http://localhost:3000/api/auth/google/callback"Setup Database:
npx prisma migrate dev
npx prisma db seedStart Backend Server:
npm run devThe server will run on `http://localhost:3000\`
Open a new terminal:
cd client
npm installCreate a `.env` file in the `client` directory (optional):
VITE_API_URL=http://localhost:3000Start Frontend Development Server:
npm run devThe client will run on `http://localhost:5175\`
- Navigate to `http://localhost:5175\` in your browser
- Click Sign Up to create an account
- Select your college during registration
- Login and start tracking your grades!
The application uses PostgreSQL with Prisma ORM. Key models include:
- User: Student accounts with authentication details
- College: Educational institutions with grading scales
- Semester: Academic periods with courses
- Course: Individual subjects with grades and credits
Run migrations to set up the database:
cd server
npx prisma migrate devView your database with Prisma Studio:
npx prisma studio- Go to Google Cloud Console
- Create a new project or select existing one
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URI: `http://localhost:3000/api/auth/google/callback\`
- Copy Client ID and Client Secret to your `.env` file
| Variable | Description | Required |
|---|---|---|
| `DATABASE_URL` | PostgreSQL connection string | Yes |
| `JWT_SECRET` | Secret key for JWT signing | Yes |
| `NODE_ENV` | Environment (development/production) | Yes |
| `CLIENT_URL` | Frontend application URL | Yes |
| `GOOGLE_CLIENT_ID` | Google OAuth Client ID | No |
| `GOOGLE_CLIENT_SECRET` | Google OAuth Client Secret | No |
| `GOOGLE_CALLBACK_URL` | OAuth callback URL | No |
| Variable | Description | Required |
|---|---|---|
| `VITE_API_URL` | Backend API URL | No |
- `POST /api/auth/register` - Register new user
- `POST /api/auth/login` - Login user
- `POST /api/auth/logout` - Logout user
- `GET /api/auth/google` - Initiate Google OAuth
- `GET /api/auth/google/callback` - Google OAuth callback
- `GET /api/users/me` - Get current user profile
- `PATCH /api/users/me/college` - Update user college
- `GET /api/colleges` - List all colleges
- Semester creation and management
- Course tracking within semesters
- CGPA calculation engine
- Progress reports and analytics
- Data visualization charts
- PDF/CSV export functionality
- Grade prediction tools
Frontend:
cd client
npm run buildBackend:
cd server
npm startcd server
npm testThe project uses ESLint for code quality. Run linting:
cd client
npm run lint- Build the frontend: `npm run build`
- Deploy the `dist` folder to your hosting service
- Set environment variable: `VITE_API_URL=your-backend-url`
- Set all required environment variables
- Run database migrations: `npx prisma migrate deploy`
- Start the server: `npm start`
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (`git checkout -b feature/AmazingFeature`)
- Commit your changes (`git commit -m 'Add some AmazingFeature'`)
- Push to the branch (`git push origin feature/AmazingFeature`)
- Open a Pull Request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Sorcerers-NST - GitHub Profile
- React and Vite communities for excellent documentation
- Prisma for the amazing database toolkit
- Tailwind CSS for the utility-first CSS framework
- All contributors who help improve this project
Made with ❤️ by NSTstudents, for students