Skip to content

Sparkyyy45/campus-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

50 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ“ CampusCore β€” Premium Academic Resource Portal

Next.js TailwindCSS Supabase Cloudinary License

A premium, high-fidelity academic resources and study roadmaps portal specifically engineered for Sir Padampat Singhania University (SPSU). Standardized for GSOC/Open-Source communities.

Key Features β€’ Quick Start β€’ System Workflows β€’ Architectural Decisions β€’ Contributing


πŸ“– Introduction

CampusCore is an advanced open-source student portal that streamlines access to academic materials like Previous Year Questions (PYQs), lecture notes, and curriculum syllabus, while offering a robust management suite for administrators.

Unlike traditional file-sharing hubs, CampusCore is built around privacy-first CDN delivery, zero-trust link-sharing security, and a fully responsive, dark-mode-first visual experience that guarantees zero clutter and maximum speed.


πŸš€ Key Features

  • Student Resources Panel: Search, filter, and discover files by academic branch (CS, IT, ME, EC, CE, EE) and semester (1-8).
  • Secure Inline PDF Viewer: Custom sandboxed iframe that securely streams application/pdf streams directly inside the application, disabling raw links to prevent downloads.
  • Non-Blocking Background Downloads: Triggered via native HTML target="_blank" anchor tags to fetch attachment headers in background threads, keeping the dashboard's active state undisturbed.
  • Role-Based Auth Console: Fine-grained access control separating student dashboards from administrative database CRUD tables (users, announcements, roadmaps, and subjects).
  • Double-Barrier Privacy Indexing: Double protection matching strict edge-level metadata (noindex/nofollow layouts) with a localized robots.txt configuration, ensuring auth dashboards are shielded from crawlers while maintaining high SEO rankings for landing portals.

πŸ“ Core Architecture & System Topology

The diagram below details the operational boundaries and secure network integrations between the Next.js edge runtime, Supabase databases, Cloudinary secure asset storage, and monitoring layers:

graph TD
    Client[Student/Admin Browser] <-->|HTTPS / Dynamic Routes| Vercel[Vercel Serverless Edge]
    Vercel <-->|Auth Session & RLS Checks| Supabase[Supabase PostgreSQL]
    Vercel <-->|Signed Attachment Tokens| Cloudinary[Cloudinary Secure Bucket]
    Vercel -.->|Error Instrumentation| Sentry[Sentry Tracking]
    Vercel -.->|Real-User Metrics| VerAn[Vercel Web Analytics]

    subgraph Supabase Security Boundary
        Supabase -.->|Row-Level Security RLS| AuthUsers[auth.users]
        Supabase -.->|Cascaded Profile Purge| Profiles[public.profiles]
        Supabase -.->|Relation Schemas| DataTables[resources, roadmaps, announcements, subjects]
    end
    
    subgraph Cloudinary Asset CDN
        Cloudinary -.->|Raw PDF Isolation| PDF[Study Handouts & PYQ Files]
    end
Loading

βš™οΈ Quick Start

1. Installation

Clone the repository and install dependencies:

git clone https://github.com/Sparkyyy45/campus-core.git
cd campus-core
npm install

2. Configure Environment

Create a .env.local in the project root. The project's .gitignore is pre-configured to keep your variables private and secure:

# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-public-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-secret-key

# Cloudinary Configuration
CLOUDINARY_CLOUD_NAME=your-cloud-name
CLOUDINARY_API_KEY=your-api-key
CLOUDINARY_API_SECRET=your-api-secret
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=your-cloud-name

# App Configuration
NEXT_PUBLIC_APP_URL=http://localhost:3000

3. Database Initialization

Copy the SQL scripts in supabase/schema.sql and run them inside your Supabase SQL Editor to configure all tables, relational links, and Row-Level Security (RLS) policies.

4. Run Development Server

npm run dev

Open http://localhost:3000 in your browser.


πŸ—οΈ System Workflows

πŸ” 1. Authentication & Role Routing (RBAC)

When a user requests a route, Next.js Middleware intercepts the request, validates the Supabase session, and handles role authorization before serving any content.

graph TD
    User([Student or Admin]) -->|Request /admin/resources| Mid{Next.js Middleware}
    Mid -->|Invalid Session| Login[Redirect to /login]
    Mid -->|Valid Session| DB[(Verify Role in DB)]
    DB -->|Role is STUDENT| Denied[Redirect to /dashboard]
    DB -->|Role is ADMIN| Allow[Serve Admin Portal - 200 OK]
Loading

πŸ“‚ 2. Secure Private PDF Access (View vs. Download)

To prevent hotlinking, direct public URLs are strictly blocked (401 Unauthorized). The system generates time-limited signed URLs that expire after exactly 1 hour in two different modes.

graph TD
    Click[Student Clicks Resource Card] --> Action{Action Type}
    
    Action -->|View| SignView[API signs URL without Attachment parameter]
    SignView -->|Serve 200 OK| Iframe[Browser Iframe streams PDF Inline]
    
    Action -->|Get| SignGet[API signs URL with attachment: true]
    SignGet -->|Redirect| Download[New Tab downloads file directly to PC]
Loading

πŸ’‘ Architectural Decisions

πŸ—οΈ 1. Credentials-Only Authentication

  • Decision: We completely removed external Google OAuth buttons and routes to provide an localized authentication wall.
  • Implementation: Login, signup, and reset forms were migrated to client components inside static server layouts. This lets us export server-rendered SEO metadata while keeping form interactions highly responsive.

πŸ“ 2. Schema-Resilient Subject Codes

  • Decision: The subjects table lacks a code column. Instead of performing complex database alterations, we dynamically derive codes on-the-fly.
  • Implementation: We query only the name column and use a fast string parser to generate abbreviations (e.g. "Data Structures" -> "DS", "C Programming" -> "CP") directly inside Next.js Server Components. This keeps the database lightweight and ensures zero query faults.

πŸ›‘οΈ 3. Safe Background PDF Downloads

  • Decision: Next.js client-side <Link> tags intercept file-download redirects, which forces the active browser tab to navigate to the Cloudinary URL.
  • Implementation: We wrapped download buttons in standard HTML <a> tags with target="_blank" and rel="noopener noreferrer". This triggers downloads in independent browser threads, leaving the active student dashboard open and completely undisturbed.

🀝 Contributing

We welcome open-source contributions from the global developer community and GSoC candidates!

  1. Fork the Project.
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature).
  3. Commit your Changes (git commit -m 'feat: add amazing feature').
  4. Push to the Branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

πŸ“„ License

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


Made with ❀️ by the open-source community for SPSU.

About

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors