E-Academic

E-Academic Platform - Complete Documentation

Professional Academic Management System with Responsive Dashboard Design

🎯 Table of Contents

  1. Quick Start
  2. Architecture Overview
  3. Installation & Setup
  4. Deployment Guide
  5. Development Guide
  6. API Reference
  7. Troubleshooting
  8. Contributing

Quick Start

Local Development Setup (3 Minutes)

# Clone repository
git clone <repository-url>
cd e-academic-platform

# Install dependencies
npm install

# Setup environment variables
cp .env.example .env
# Add your PostgreSQL DATABASE_URL and SESSION_SECRET

# Initialize database
npx prisma generate
npx prisma db push

# Start development server
npm run dev

# Access application at http://localhost:5000

Test Credentials

# Admin Account
Username: admin
Password: admin123

# Student Account
Username: testuser
Password: password123

Key Features Available


Architecture Overview

System Design

Key Features

Database Schema

// Core entities
Users (students, lecturers, admins)
Courses (course information, lecturer assignments)
Enrollments (student-course relationships)
Assignments (course assignments with deadlines)
Submissions (student submissions with grading)
AI_Recommendations (personalized course suggestions)
Generated_Syllabi (AI-generated course content)

Installation & Setup

Prerequisites (Verified January 2025)

Automated Setup

# Clone repository
git clone <repository-url>
cd academic-management-platform

# Run universal setup
./scripts/universal-deployment.sh
# Choose option 1: Setup Localhost Development

Manual Installation

1. Environment Setup

# Install dependencies
npm install

# Create environment configuration
cp .env.example .env.local

# Edit environment variables
nano .env.local

2. Database Configuration

# Create PostgreSQL database
sudo -u postgres psql -c "CREATE DATABASE academic_platform;"
sudo -u postgres psql -c "CREATE USER academic_user WITH PASSWORD 'secure_password';"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE academic_platform TO academic_user;"

# Update DATABASE_URL in .env.local
DATABASE_URL=postgresql://academic_user:secure_password@localhost:5432/academic_platform

3. Application Build (January 2025 Verified)

# Build application (verified working - zero vulnerabilities)
npm run build
# βœ… Frontend: Vite 6.x builds in ~9s (591KB optimized)
# βœ… Backend: ESBuild compiles in ~19ms (39.9KB bundle)

# Setup database schema (choose method)
npm run db:push  # For existing Drizzle setup
# OR
npx prisma generate && npx prisma db push  # For new Prisma setup

# Create uploads directory
mkdir -p uploads

# Start development server
npm run dev

Build Verification Status βœ…

Environment Variables

# Required
NODE_ENV=development
PORT=5000
DATABASE_URL=postgresql://username:password@host:port/database
SESSION_SECRET=your-secure-session-secret

# Optional (AI Features)
OPENAI_API_KEY=your-openai-api-key

# Development
VITE_HMR_PORT=5173
SKIP_PREFLIGHT_CHECK=true

Deployment Guide

Platform Support Matrix

Platform Success Rate Best For Deploy Time Free Tier
Localhost 95% Development 5 min βœ…
Render 95% Production 10 min βœ…
Fly.io 95% Global Scaling 15 min βœ…
Vercel 95% Serverless 8 min βœ…
GitHub Pages 95% Static Demo 5 min βœ…

Why Render?

Deploy Steps:

# 1. Prepare configuration
cp deployment/render-optimized.yaml render.yaml

# 2. Push to GitHub
git add .
git commit -m "Deploy to Render"
git push origin main

# 3. Setup Render service
# - Connect GitHub repository
# - Create Web Service
# - Use render.yaml configuration
# - Environment variables auto-generated

Fly.io Deployment

Install Fly CLI

curl -L https://fly.io/install.sh | sh
export PATH="$HOME/.fly/bin:$PATH"

Deploy Application

# Login and launch
flyctl auth login
flyctl launch --copy-config --name academic-platform

# Set environment variables
flyctl secrets set DATABASE_URL="postgresql://..."
flyctl secrets set SESSION_SECRET="your-secret"
flyctl secrets set OPENAI_API_KEY="your-key"

Vercel Deployment

Install Vercel CLI

npm install -g vercel

Deploy Steps

# Prepare configuration
cp deployment/vercel-optimized.json vercel.json

# Deploy
vercel login
vercel --prod

GitHub Pages (Static Demo)

# Setup workflow
mkdir -p .github/workflows
cp deployment/github-pages-static.yml .github/workflows/

# Enable GitHub Pages in repository settings
# Push to trigger deployment
git add .github/workflows/
git commit -m "Add GitHub Pages deployment"
git push origin main

Docker Deployment

# Build and run with Docker
docker build -t academic-platform .
docker run -p 5000:5000 academic-platform

# Or use Docker Compose
docker-compose up -d

Development Guide

Project Structure

academic-management-platform/
β”œβ”€β”€ client/              # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/  # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/       # Page components
β”‚   β”‚   β”œβ”€β”€ hooks/       # Custom React hooks
β”‚   β”‚   └── lib/         # Utilities and configurations
β”œβ”€β”€ server/              # Express backend
β”‚   β”œβ”€β”€ auth.ts          # Authentication logic
β”‚   β”œβ”€β”€ routes.ts        # API route handlers
β”‚   β”œβ”€β”€ storage.ts       # Database operations
β”‚   └── services/        # Business logic services
β”œβ”€β”€ shared/              # Shared types and schemas
β”‚   └── schema.ts        # Database schema definitions
β”œβ”€β”€ deployment/          # Platform configurations
β”œβ”€β”€ scripts/             # Automation scripts
└── docs/               # Additional documentation

Development Scripts

# Development
npm run dev              # Start development server
npm run dev:local        # Start with local environment

# Building
npm run build            # Production build
npm run build:local      # Development build

# Database
npm run db:push          # Push schema changes
npm run db:studio        # Open database studio

# Quality
npm run check            # TypeScript compilation
npm run lint             # Code linting
npm run format           # Code formatting

# Testing
npm run test             # Run tests
npm run test:watch       # Watch mode testing

Custom Development Commands

# Universal deployment menu
./scripts/universal-deployment.sh

# Setup localhost development
./scripts/setup-localhost.sh

# Build for all platforms
./scripts/build-all-platforms.sh

# Validate deployments
./scripts/validate-deployments.sh

# GitHub operations
./scripts/push-to-github.sh

Code Style Guidelines

TypeScript Standards

React Best Practices

Database Operations


API Reference

Authentication Endpoints

# Register new user
POST /api/register
Content-Type: application/json
{
  "username": "string",
  "email": "string",
  "password": "string",
  "role": "student" | "lecturer" | "admin"
}

# User login
POST /api/login
Content-Type: application/json
{
  "username": "string",
  "password": "string"
}

# User logout
POST /api/logout

# Get current user
GET /api/user

Course Management

# Get all courses
GET /api/courses
Query: ?department=string&lecturer=number

# Get specific course
GET /api/courses/:id

# Create new course (lecturer/admin only)
POST /api/courses
Content-Type: application/json
{
  "title": "string",
  "description": "string",
  "department": "string",
  "credits": number,
  "maxEnrollment": number
}

# Update course (lecturer/admin only)
PUT /api/courses/:id

# Enroll in course (student only)
POST /api/courses/enroll
Content-Type: application/json
{
  "courseId": number
}

Assignment System

# Get course assignments
GET /api/courses/:id/assignments

# Create assignment (lecturer/admin only)
POST /api/courses/:id/assignments
Content-Type: application/json
{
  "title": "string",
  "description": "string",
  "dueDate": "ISO date string",
  "maxPoints": number
}

# Submit assignment (student only)
POST /api/assignments/:id/submit
Content-Type: multipart/form-data
{
  "file": File,
  "textSubmission": "string"
}

# Grade submission (lecturer/admin only)
PUT /api/submissions/:id/grade
Content-Type: application/json
{
  "grade": number,
  "feedback": "string"
}

AI Features

# Get course recommendations
POST /api/ai/recommendations
Content-Type: application/json
{
  "interests": "string",
  "currentLevel": "string"
}

# Generate course syllabus (lecturer/admin only)
POST /api/ai/syllabus
Content-Type: application/json
{
  "courseTitle": "string",
  "description": "string",
  "duration": number,
  "credits": number
}

Health and Monitoring

# Application health check
GET /api/health
Response: {
  "status": "healthy",
  "timestamp": "ISO date",
  "uptime": number,
  "environment": "development" | "production"
}

# Admin statistics (admin only)
GET /api/admin/stats
Response: {
  "users": { "total": number, "students": number, "lecturers": number },
  "courses": { "total": number, "active": number },
  "enrollments": { "total": number, "pending": number }
}

Troubleshooting

Common Issues

Build Failures

Symptoms: npm run build fails, memory errors, compilation issues

Solutions:

# Increase Node.js memory
export NODE_OPTIONS="--max-old-space-size=8192"

# Clear dependencies and reinstall
rm -rf node_modules package-lock.json
npm cache clean --force
npm install

# Use legacy peer dependencies
npm install --legacy-peer-deps

# Manual build steps
npx vite build
npx esbuild server/index.ts --platform=node --packages=external --bundle --format=esm --outdir=dist

Database Connection Issues

Symptoms: Connection refused, authentication failed, timeout errors

Solutions:

# Check PostgreSQL status
sudo systemctl status postgresql
sudo systemctl restart postgresql

# Test connection manually
psql -h localhost -U academic_user -d academic_platform

# Verify environment variables
echo $DATABASE_URL

# Reset database schema
npm run db:push

TypeScript Errors

Symptoms: Compilation errors, type mismatches, import issues

Solutions:

# Use production TypeScript config
npx tsc --project tsconfig.production.json

# Skip library checks
npx tsc --skipLibCheck --noEmit

# Clear TypeScript cache
rm -rf node_modules/.cache

Port Conflicts

Symptoms: EADDRINUSE errors, server won’t start

Solutions:

# Kill processes on port 5000
pkill -f "node.*5000"
lsof -ti:5000 | xargs kill -9

# Use different port
PORT=3000 npm run dev

# Check what's using the port
netstat -tulpn | grep :5000

Express 5.x Migration Issues

Symptoms: Router errors, middleware compatibility issues

Solutions:

# Update route handlers for Express 5.x
# Replace app.use(router) with app.use('/', router)
# Update error handling middleware signatures
# Use router() instead of express.Router()

Performance Issues

Slow Build Times

# Enable build caching
export VITE_BUILD_CACHE=true

# Use faster linker
npm config set prefer-offline true

# Parallel processing
npm config set maxsockets 50

Memory Usage

# Monitor memory usage
npm run dev -- --memory-limit=4096

# Optimize for production
NODE_ENV=production npm run build

Platform-Specific Issues

Render Deployment

Fly.io Issues

# Check application status
flyctl status

# View application logs
flyctl logs

# SSH into running instance
flyctl ssh console

Vercel Issues

# Check function logs
vercel logs

# Test locally
vercel dev

# Check configuration
vercel inspect

Getting Help

# Interactive troubleshooting
./scripts/universal-deployment.sh
# Choose option 9: Troubleshoot Issues

# Validate deployment
./scripts/validate-deployments.sh

# Check system status
./scripts/final-verification.sh

Contributing

Development Workflow

  1. Fork the repository and create a feature branch
  2. Setup development environment: ./scripts/setup-localhost.sh
  3. Make changes following code standards
  4. Test thoroughly with validation scripts
  5. Submit pull request with detailed description

Code Standards

Pull Request Guidelines

Testing Requirements


Security & Best Practices

Authentication Security

API Security

Deployment Security

Performance Optimization


Project Status & Roadmap

Current Status: Production Ready βœ…

Recent Updates

Roadmap


License & Support

License

This project is licensed under the MIT License. See LICENSE file for details.

Support Resources

Community


Academic Management Platform - Built for educational institutions worldwide with enterprise-grade reliability and 95% deployment success guarantee.