Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Student Database Management System


This was also made for a University Course of Mine. Just a basic simple project of my old self!

Overview

This is a comprehensive Student Database Management System implemented in C with multi-service architecture, background tasks, and advanced security features. The system provides robust student record management with department-based access control and automatic backups.

Highlights:

  • Thread-safe implementation using POSIX mutexes
  • Modular design with clear separation of concerns
  • Comprehensive error handling and logging
  • Production-ready security measures

Features

Multi-Service Architecture

Four independent background services running concurrently:

  • Auto-save service (30-second intervals) - Prevents data loss during unexpected shutdowns
  • Backup rotation service (5-minute intervals) - Maintains data recovery points with automatic cleanup
  • Statistics monitoring service (1-minute intervals) - Real-time system performance tracking
  • REST API service (port 8080) - Web interface for remote access (placeholder,just had the idea but not really interested to fully implement at the time)

Mandatory Security Framework

  • Department-based access control - Users can only access their assigned departments
  • Multi-role authentication - Administrator and department-specific user roles
  • Comprehensive audit logging - All security-sensitive operations are logged
  • Input sanitization - Protection against SQL injection and command injection attacks
  • Thread-safe operations - Mutex protection for concurrent access

Data Management Capabilities

  • CSV import/export with complete metadata preservation (timestamps, departments)
  • Timestamp tracking - Creation and modification times for all records
  • Automatic backup rotation - Configurable retention policies to manage disk space
  • Binary data storage - Efficient storage format with full data integrity

Necessary Search Features

  • Exact name matching - Case-insensitive search by first name
  • Department-specific searches - Filter students by academic department
  • Regex-based pattern matching - Advanced search using regular expressions
  • Partial name matching - Find students with incomplete name information
  • Academic ID (AM) lookup - Fast exact match search by student identifier

Monitoring & Maintenance

  • Real-time statistics dashboard - Live system performance metrics
  • Memory usage monitoring - Automatic alerts for high memory consumption
  • Service status reporting - Health checks for all background services
  • Graceful shutdown handling - Clean termination with data preservation
  • Comprehensive logging - Structured logging with severity levels

Project Overview

student_db_system/
├── include/           # Header files
│   └── student_db.h   # Main header with declarations, constants, and function prototypes
├── src/               # Source code files
│   ├── main.c         # Application entry point and main menu system
│   ├── database.c     # Core database operations (CRUD operations, search functions)
│   ├── persistence.c  # Data persistence functions (save/load, backup management, CSV I/O)
│   ├── services.c     # Background services implementation (auto-save, backup, stats, API)
│   ├── security.c     # Security and logging functions (authentication, access control, audit)
│   └── utils.c        # Utility functions (input validation, string formatting, system utilities)
├── backups/           # Backup storage directory (automatically created)
├── obj/               # Compiled object files (generated during build)
├── bin/               # Executable output directory (generated during build)
├── Makefile           # Build automation with multiple targets
└── README.md          # Project documentation

Instructions

Prerequisites

  • Linux/Unix environment with POSIX threads library (pthread) installed on local system.
  • GCC or compatible C compiler(Clang etc.)
  • Approximately 10MB disk space for backups and build artifacts

Quick Start

# Clone the repository
git clone https://github.com/Je0Dev/cli_student_database_system
cd cli_student_database_system

# Create required directories
mkdir -p backups obj bin

# Build the project
make

# Run the application
make run

# Clean build artifacts
make clean

# Complete cleanup (removes all generated files and directories)
make distclean

Makefile

  • make - Compile the project and create executable
  • make run - Build and execute the application
  • make clean - Remove object files and executable
  • make distclean - Remove all generated files and directories

Credentials

The system includes predefined user accounts with different permission levels:

Administrator Account

  • Username: admin
  • Password: securepass
  • Permissions: Full system access - can add students from ANY department (AM starting with 11, 12, or 13)

Department-Specific User Accounts

  • Mechanical Engineering User

    • Username: mech_user
    • Password: mechpass
    • Permissions: Can ONLY add students with AM starting with 11 (Mechanical Engineering)
  • Electrical Engineering User

    • Username: elec_user
    • Password: elecpass
    • Permissions: Can ONLY add students with AM starting with 12 (Electrical Engineering)
  • Civil Engineering User

    • Username: civil_user
    • Password: civilpass
    • Permissions: Can ONLY add students with AM starting with 13 (Civil Engineering)

Note: All users can perform read operations (search, view, list) across all departments, but write operations (add, edit, delete) are restricted by department access.

Academic ID Format

The system enforces a strict Academic ID format:

  • Format: 5 digits in pattern 1[1-3][001-999]
  • Examples: 11001, 12045, 13999
  • Structure:
    • First digit: University code (always 1)
    • Second digit: Department code (1=Mechanical, 2=Electrical, 3=Civil)
    • Last three digits: Student number (001-999)

Security Features

Access Control

  • Role-based permissions prevent unauthorized operations
  • Department isolation ensures data privacy
  • Audit trail logs all sensitive operations

Input Validation

  • Academic ID format validation
  • Name format validation with regex patterns
  • Input sanitization to prevent injection attacks
  • Buffer overflow protection

Data Protection

  • Thread-safe operations with mutex protection
  • Automatic backup creation and rotation
  • Graceful error handling without data corruption

System Requirements

Minimum Requirements

  • Operating System: Linux/Unix with POSIX support
  • Compiler: GCC 4.8+ or compatible C compiler
  • Memory: 64MB RAM (recommended 256MB for optimal performance)
  • Disk Space: 10MB (for application and backup storage)
  • Libraries: pthread (POSIX threads), regex (for pattern matching)

Development Dependencies

  • Build System: GNU Make
  • Debugging: GDB (optional, for development)
  • Code Analysis: Valgrind (optional, for memory leak detection)

License

  • This project is licensed under the MIT License

Copyright © 2026 Je0Dev

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributing

  • Use meaningful variable and function names
  • Include explanatory comments for complex logic
  • Implement proper error handling and logging
  • Maintain thread safety in all database operations

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages