University of Kenya

Campus Management System - CockroachDB NewSQL Implementation

CockroachDB React Node.js NewSQL

Academic Project Disclaimer

This is a fictional scenario created for academic purposes. This documentation represents a theoretical campus management system prototype developed as part of coursework for Advanced Database Systems at Meru University. All user stories, statistics, testimonials, and implementation claims are simulated for educational demonstration purposes only. This is not a production system and does not represent any real university's actual infrastructure.

Project Overview

A comprehensive web-based campus management system designed to digitize university operations using CockroachDB NewSQL technology. This project demonstrates the implementation of a distributed, scalable database solution for enterprise-level applications.

Student Services

Centralized portal for academic information, course enrollment, library services, and application tracking.

Staff Services

Course management, student oversight, administrative tools, and content management capabilities.

Public Services

Academic calendar, program information, e-learning platform, and campus information access.

University of Kenya Campus Management System Landing Page

Live System Interface

University of Kenya Campus Management System

CockroachDB v25.4

Database Technology Implementation

Course Project: Database Technology Implementation

Project Details

Course: Advanced Database Systems

Institution: Meru University of Science & Technology

Program: Bachelor of Science in Computer Technology (BCT)

Group: Group A

Database: CockroachDB v25.4

Implementation Scope

• Single-node CockroachDB deployment

• Local development environment

• Campus management system prototype

• Full-stack web application

• Sample data for demonstration

Our Implementation Approach

Local Development Setup

Configuration: Single-node deployment
Version: CockroachDB v25.4 (Latest)
Data Storage: cockroach-data directory
Repository: Data saved to GitHub

Startup Command

# Single-node CockroachDB startup
cockroach start-single-node
--insecure
--listen-addr=localhost:26257
--http-addr=localhost:8080
--store=cockroach-data

This command initializes a local CockroachDB instance suitable for development and coursework demonstration.

Database Concepts Applied

NewSQL Characteristics

ACID transaction compliance
SQL interface compatibility
Horizontal scalability design
Distributed architecture principles

Implementation Milestones

Database setup and configuration
Schema design and implementation
Application integration
Testing and validation

Our Implementation Details

Local Development Environment

Setup: Single-node CockroachDB instance

Data Persistence: cockroach-data folder in project directory

Version Control: Data folder committed to GitHub repository

Access: Web UI available at localhost:8080

Key Features Utilized

PostgreSQL-compatible SQL interface
ACID transaction guarantees
Built-in web administration interface
Automatic schema management

Project Outcomes & Learning

The Magic of Distribution

Think of CockroachDB like a team of librarians working together. Instead of having one librarian handling all the books (which would be slow and risky), you have multiple librarians, each responsible for different sections, but they all communicate and help each other out.

// How data flows in our system
Student submits enrollment → CockroachDB receives request
Database automatically chooses best server → Processes transaction
Creates backup copies on other servers → Confirms success
Student sees confirmation → Data is safe across multiple locations

ACID Compliance: The Foundation of Trust

ACID isn't just a chemistry term – it's what makes our database trustworthy. Every transaction in our campus system follows these principles:

Atomicity

When a student enrolls in a course, either everything happens (enrollment recorded, payment processed, seat reserved) or nothing happens. No half-completed transactions.

Consistency

The database always follows our rules. If a course has 50 seats, the 51st student can't enroll, even if thousands are trying simultaneously.

Isolation

Multiple students can use the system at once without interfering with each other. Your grade update doesn't affect someone else's enrollment.

Durability

Once we confirm your transaction, it's permanent. Even if the power goes out immediately after, your data is safe.

What This Means for Our Campus System

Always Available

Students can access their portals during exam periods when traffic spikes. The system automatically handles the load without slowing down.

Grows With Us

As the university expands to new campuses, we can add database servers in those locations. Students get faster access, and data stays synchronized.

Bulletproof Security

Student data is encrypted and replicated across multiple secure locations. Even if disaster strikes one server, everything continues working.

Under the Hood: Technical Excellence

Consensus Algorithm: The Brain of the Operation

CockroachDB uses the Raft consensus algorithm – think of it as a democratic voting system for computers. When data needs to be written, multiple servers vote on it. Only when a majority agrees does the change become permanent. This ensures consistency even when servers are in different countries.

In Our Campus System:

When a student submits their final exam, the grade isn't just saved on one server. Multiple servers confirm the transaction before the student sees "Grade Submitted Successfully." This prevents any possibility of lost grades or corrupted data.

Multi-Version Concurrency Control (MVCC)

This is like having a time machine for your data. CockroachDB keeps multiple versions of each piece of information, so readers never block writers, and writers never block readers. Everyone can work simultaneously without stepping on each other's toes.

Real Campus Example:

While a professor is updating grades for 200 students, other students can still view their current grades, enroll in new courses, and access library resources. Nobody has to wait, and nobody sees incomplete or inconsistent data.

Automatic Rebalancing: Self-Healing Infrastructure

CockroachDB is like having a system administrator that never sleeps. It constantly monitors the health of all servers, automatically moving data away from overloaded or failing servers to healthy ones. It even predicts problems before they happen.

Campus Resilience:

During registration periods when thousands of students are enrolling simultaneously, the database automatically shifts resources to handle the load. When the rush is over, it rebalances everything for optimal performance.

Performance That Scales With Success

Linear Scalability

Most databases hit a wall as they grow. CockroachDB breaks through that wall. Need to handle twice the load? Add another server, and you get roughly twice the performance. It's that simple.

Current Campus Load:
• 8,000+ active students
• 500+ staff members
• 50,000+ daily transactions
• Sub-second response times

Geographic Distribution

Our university has students accessing the system from across Kenya and beyond. CockroachDB can place data closer to users automatically, reducing latency and improving the user experience.

Global Accessibility:
• Nairobi campus: <50ms response
• Mombasa students: <100ms
• International: <200ms
• 99.99% uptime achieved

Why Developers Love CockroachDB

Familiar Yet Powerful

As computer science students, we didn't want to learn a completely new query language. CockroachDB speaks PostgreSQL, which means all our SQL knowledge transferred directly. We could focus on building features instead of fighting the database.

Standard SQL that just works:
SELECT s.name, c.title, g.grade
FROM students s
JOIN enrollments e ON s.id = e.student_id
JOIN courses c ON e.course_id = c.id
JOIN grades g ON e.id = g.enrollment_id;

Built-in Observability

CockroachDB comes with an amazing web interface that shows us exactly what's happening in real-time. We can see which queries are slow, how data is distributed, and even get suggestions for optimization.

What we can monitor:
• Query performance in real-time
• Database health across all nodes
• Automatic performance recommendations
• Resource usage and optimization tips

Technical Achievements

✓ Successfully deployed CockroachDB v25.4 locally
✓ Implemented complete campus management schema
✓ Integrated with Node.js backend using SQL drivers
✓ Demonstrated ACID transaction handling
✓ Utilized built-in web administration interface

Learning Outcomes

• Understanding of NewSQL database concepts
• Experience with distributed database principles
• Practical application of modern database technology
• Integration skills with full-stack applications
• Database administration and monitoring

Project Summary

We successfully implemented CockroachDB v25.4 as the database foundation for our Campus Management System as part of our Advanced Database Systems coursework at Meru University of Science & Technology. This Group A project demonstrates our understanding of NewSQL database technologies and their practical application in real-world scenarios. The single-node setup provided an excellent learning environment while showcasing the capabilities of modern distributed database systems.

System Architecture & Implementation

We implemented a 3-tier architecture pattern for our campus management system prototype, demonstrating proper separation of concerns and modern software engineering principles learned in our Advanced Database Systems course.

High-Level Architecture Overview

Client Layer (Frontend)

Port 5174

React App

Modern UI Library

Tailwind CSS

Utility-First Styling

Font Awesome

Icon Library

HTTP Requests / JSON Responses

Application Layer (Backend)

Port 3001

Express.js Server

Web Framework

REST API

API Endpoints

JWT Auth

Security Middleware

SQL Queries / Database Results

Data Layer (Database)

Port 26257

CockroachDB

NewSQL Database

Admin UI

Port 8080

How Everything Works Together

The Journey of a Student Request

Let's follow what happens when a student checks their grades. This simple action triggers a carefully orchestrated dance between multiple systems, each playing their part to deliver a seamless experience.

// Complete Request-Response Cycle
1. User Browser → Student clicks "View Grades" button
2. React App → Sends authenticated HTTP GET request
3. Express API → Route handler receives request (/api/grades)
4. Authentication → JWT token validation & student ID extraction
5. Authorization → Verify student can access their own grades
6. Business Logic → Format query parameters & validate input
7. CockroachDB → Execute SQL query with proper joins
8. Database → Return grade records with course details
9. API Response → Format JSON response & calculate GPA
10. React Update → Update component state & trigger re-render
11. User Interface → Display grades with smooth animations

Real-Time Example: Course Enrollment

// Student enrolls in "Database Systems"
POST /api/enrollments
→ Check course capacity (45/50 students)
→ Verify prerequisites completed
→ Begin database transaction
→ Reserve seat atomically
→ Update student record
→ Send confirmation email
→ Commit transaction
→ Return success (46/50 students)

Error Handling in Action

// What happens when things go wrong
POST /api/enrollments
→ Course is full (50/50 students)
→ Validation fails at business layer
→ No database transaction started
→ Return 409 Conflict status
→ Frontend shows "Course Full" message
→ Suggest waitlist option
→ Log attempt for analytics

Performance Optimization in Practice

We learned early that a beautiful interface means nothing if it's slow. Here's how we optimized the most common user journey – the student dashboard loading process:

Frontend Optimization
  • • Lazy loading of course materials
  • • Cached user preferences
  • • Optimistic UI updates
  • • Component memoization
Backend Optimization
  • • Connection pooling
  • • Query result caching
  • • Batch API requests
  • • Compression middleware
Database Optimization
  • • Strategic indexing
  • • Query optimization
  • • Read replicas
  • • Automatic rebalancing

Database Schema & Relationships

STUDENTS

id, student_id, name, email, program_id, year, gpa

UNITS

id, code, name, credits, school, program_id

PROGRAMS

id, name, code, degree_type, department

STAFF

id, staff_id, name, email, department

// Key Relationships Implemented
STUDENTS ←→ PROGRAMS (Many-to-One: Students belong to Programs)
STUDENTS ←→ ENROLLMENTS (One-to-Many: Students enroll in multiple Units)
UNITS ←→ ENROLLMENTS (One-to-Many: Units have multiple Students)
PROGRAMS ←→ UNITS (One-to-Many: Programs offer multiple Units)
STAFF ←→ STAFF_UNITS (Many-to-Many: Staff teach multiple Units)
STUDENTS ←→ BORROWINGS (One-to-Many: Students borrow multiple Books)

Implementation Achievements

Academic Project Context

As Group A students in the Advanced Database Systems course at Meru University of Science & Technology, we undertook this campus management system project to demonstrate our understanding of NewSQL database technologies, specifically CockroachDB v25.4.

This coursework project showcases our ability to implement modern database concepts learned in class, including distributed systems principles, ACID transactions, and full-stack integration with contemporary web technologies.

Course Learning Objectives Achieved

NewSQL Database Implementation

Successfully implemented CockroachDB v25.4 in a single-node configuration to demonstrate understanding of NewSQL database concepts as required by our Advanced Database Systems curriculum.

Course Concepts Demonstrated:
  • • ACID transaction properties in distributed systems
  • • SQL compatibility with modern scalability features
  • • Database administration using web-based tools
  • • Integration with application development frameworks

Full-Stack Database Integration

Developed a complete web application demonstrating proper database integration patterns, from frontend data presentation to backend API design and database schema implementation.

The Challenge We Overcame:

Limited documentation, fewer Stack Overflow answers, and the need to understand distributed systems concepts that weren't covered in our database course.

The Reward:

We now understand concepts like consensus algorithms, distributed transactions, and horizontal scaling that most of our peers won't encounter until they're working at major tech companies.

Enterprise Architecture Thinking

Our first attempt was a mess – everything in one file, no separation of concerns, and code that only the person who wrote it could understand. We learned the hard way why architecture matters.

Before (The Mess):
  • • Database queries in React components
  • • Business logic scattered everywhere
  • • No consistent error handling
  • • Impossible to test or maintain
After (Clean Architecture):
  • • Clear separation of presentation, business, and data layers
  • • Reusable components and services
  • • Consistent patterns across the codebase
  • • Easy to test, debug, and extend

Mobile-First Responsive Design

In Kenya, many students access the internet primarily through their phones. We couldn't build a system that only worked well on laptops. This constraint forced us to think mobile-first from day one.

Real Usage Statistics:
68%
Mobile Users
24%
Desktop Users
8%
Tablet Users

Our mobile-first approach wasn't just good design – it was essential for our users.

Prototype Features Implemented

Academic Project Scope

Our campus management system prototype demonstrates key database concepts and full-stack development skills as required for our Advanced Database Systems coursework at Meru University.

Implemented Features for Demonstration
Student portal with authentication
Course enrollment system
Library management interface
Staff dashboard functionality
Database CRUD operations
Responsive web design
RESTful API implementation
Sample data integration

Student Portal Module

Core functionality designed for student academic management and information access within the campus management system prototype.

Technical Features Implemented:
  • • Real-time grade calculation with GPA tracking algorithms
  • • Course enrollment system with prerequisite validation logic
  • • Academic calendar integration with deadline management
  • • Transcript generation using PDF libraries
  • • Fee management with payment tracking capabilities

Library Management System

Digital library system prototype designed for resource management and tracking operations with automated notification capabilities.

System Capabilities:
  • • Book inventory management with search functionality
  • • Reservation system with queue management
  • • Automated notification system for due dates
  • • Fine calculation algorithms
  • • Book recommendation engine using collaborative filtering

Staff Management Dashboard

Administrative interface prototype for faculty and staff operations management with integrated communication and reporting capabilities.

Administrative Functions:
  • • Grade management with batch upload capabilities
  • • Attendance tracking with statistical analysis
  • • Report generation with data visualization
  • • Communication system with notification routing
  • • Performance analytics dashboard

Security Implementation

Enterprise-level security measures implemented for data protection and system integrity in the campus management system prototype.

Security Architecture:
  • • JWT token-based authentication with expiration handling
  • • Role-based access control (RBAC) implementation
  • • Input validation and SQL injection prevention mechanisms
  • • HTTPS encryption for data transmission
  • • Comprehensive audit logging system

The Numbers Don't Lie: Impact Measurement

15 min
Average enrollment time (was 2 hours)
94%
User satisfaction rate
60%
Reduction in administrative workload
24/7
System availability

Learning Outcomes & Skills Demonstrated

Database Design

Designed normalized database schema with proper relationships, constraints, and indexes for optimal performance.

Modern Development

Utilized modern JavaScript frameworks, build tools, and development practices including ES6+, React Hooks, and REST APIs.

Scalable Solutions

Implemented horizontally scalable database solution capable of handling enterprise-level data and user loads.

User Experience

Created intuitive user interfaces with proper UX principles, accessibility considerations, and responsive design.

System Features & Functionality

Comprehensive functionality covering all aspects of university operations with real-world application:

Student Services

Student Portal

Centralized dashboard for academic information and services

Unit Catalog

Course browsing and enrollment management

Library Portal

Book search, borrowing, and renewal system

Application System

Program application and status tracking

Staff Services

Staff Portal

Course management and student enrollment oversight

Administrative Tools

Application processing, library management, and system administration

Content Management

News, announcements, and system content updates

Public Services

Academic Calendar

University-wide event and deadline management

Program Information

Comprehensive academic program details

E-Learning Platform

Online learning resources and tools

Campus Information

University services and campus life details

Technology Stack

Modern, scalable technologies powering the campus management system:

Frontend

  • React 18
  • Tailwind CSS
  • Vite
  • Font Awesome

Backend

  • Node.js
  • Express.js
  • JWT Authentication
  • CORS

Database

  • CockroachDB
  • PostgreSQL Compatible
  • Horizontally Scalable
  • ACID Transactions

Development

  • ESLint
  • Git
  • npm
  • VS Code

Installation & Setup

Prerequisites

Node.js

Version 18 or higher required

CockroachDB

Latest stable version

Git

Version control system

Installation Steps

# Clone repository
git clone https://github.com/kiprutobeauttah/UOK.git
cd manage-campus
# Install frontend dependencies
npm install
# Install backend dependencies
cd server
npm install
cd ..

System Startup

1. Start CockroachDB

cockroach start-single-node --insecure --listen-addr=localhost:26257 --http-addr=localhost:8080 --store=cockroach-data

2. Start Backend Server

cd server
npm start

3. Start Frontend Application

npm run dev

Service Ports

Frontend

5174

React Application UI

Backend API

3001

REST API Endpoints

Database

26257

CockroachDB Server

Admin UI

8080

Database Admin Panel

Development Team

Course Information

Institution: Meru University of Science & Technology

Course: Advanced Database Systems

Program: Bachelor of Science in Computer Technology (BCT)

Group: Group A

Project Overview

This campus management system was developed as our Advanced Database Systems coursework, demonstrating practical implementation of NewSQL database technology using CockroachDB.

MACLAN OMONDI MACLAYNE

BCT Student

Team Member

ORDIT KAGWIRA

BCT Student

Team Member

ELIJAH OWINO

BCT Student

Team Member

BEAUTTAH KIPRUTO

BCT Student

Team Member

FAITH ANJIKO

BCT Student

Team Member

DANCUN CHEGE

BCT Student

Team Member

Advanced Database Systems Project

NewSQL Implementation

Practical implementation of CockroachDB v25.4 for campus management system

Group Collaboration

Group A collaborative development using modern software engineering practices

BCT Program

Bachelor of Science in Computer Technology coursework at Meru University