- A Streamlit + MySQL app for managing student records, grades, enrollments, attendance, and academic reporting.
- Features a dark glassmorphism UI with full CRUD across all schema tables.
- Features
- Tech stack
- Project structure
- Quick start
- Database setup
- Database schema
- SQL views (reporting)
- Application modules
- UI / UX
- Security
- Development & testing
- Contributing
- License
- Contact
- Dashboard — real-time system statistics (student, teacher, course, enrollment, grade counts); recent enrollments and grades feed
- Student management — full CRUD; ID range 110000–199999; DOB validation; search by ID, name, email, or phone
- Teacher management — full CRUD; ID range 310000–399999; hire date validation; search by ID, name, email, or phone
- Course management — full CRUD; units 1–6; semester 1st/2nd/3rd; dynamic teacher dropdown; search by ID, code, name, or semester
- Enrollment management — full CRUD; status: Enrolled/Completed/Dropped/On hold; dynamic student and course dropdowns
- Grade management — full CRUD; letter grades A–F; percentage 50.0–99.9; dynamic enrollment dropdown
- Attendance tracking — full CRUD; status: Present/Absent/Late/Excused; dynamic enrollment dropdown
- User management — dedicated page for system users; roles: Student/Teacher/Admin; auto-incrementing ID 210000–299999
- Report cards — two-tab detail + summary views; powered by MySQL views; filterable by student
- 3 MySQL views —
report_card_details,report_card_summary,final_report_card_summaryconsumed by the Report Cards page - Generic CRUD engine —
crud()incomponents.pyhandles all standard tables with parameterized queries, auto-ID, field validation
| Component | Technology |
|---|---|
| Language | Python 3.10+ |
| Web framework | Streamlit 1.31.1 |
| Data manipulation | pandas 2.2.0 |
| DB connector | mysql-connector-python 8.2.0 |
| Database server | MySQL 8.0+ |
| UI styling | Custom CSS (glassmorphism dark theme) |
See requirements.txt for pinned versions.
Student Grade Management System/
├─ .gitignore # Ignores secrets, cache, venvs, IDE files
├─ .streamlit/
│ └─ secrets.toml # MySQL credentials (git-ignored)
├─ Data Dictionary/
│ ├─ Data Dictionary (PDF ver.).pdf # Schema reference (PDF)
│ └─ Data Dictionary (Sheet ver.).xlsx # Schema reference (Excel)
├─ Database & ERD/
│ ├─ ERD_student_db.mwb # MySQL Workbench model
│ ├─ ERD_student_db.pdf # ERD diagram (PDF)
│ ├─ sample_student_management_entries.sql # 50 sample records per table
│ ├─ student_grade_management_sys (updated).sql # DB + tables DDL
│ └─ student_grade_report_cards (updated).sql # 3 reporting views
├─ attendance.py # Attendance CRUD
├─ components.py # Generic CRUD engine + UI helpers
├─ courses.py # Course CRUD
├─ database.py # Cached DB connection + query helpers
├─ enrollments.py # Enrollment CRUD
├─ grades.py # Grade CRUD
├─ main.py # App entry, CSS theme, routing
├─ README.md # This file
├─ requirements.txt # Python dependencies
├─ students.py # Student CRUD
├─ teachers.py # Teacher CRUD
└─ users.py # User account CRUD
-
Clone the repo:
git clone https://github.com/Miko-Explorer/MySQL-Based-Projects.git cd "MySQL-Based-Projects/Student Grade Management System"
-
Set up a virtual environment and install deps:
python -m venv .venv source .venv/bin/activate # Linux/macOS .venv\Scripts\activate # Windows pip install -r requirements.txt
-
Configure
.streamlit/secrets.tomlwith MySQL credentials:db_host = "localhost" db_user = "root" db_password = "your_mysql_password" db_name = "student_db"
Never commit this file — it's in
.gitignore. -
Run database scripts (see Database setup).
-
Launch the app:
streamlit run main.py
Open
http://localhost:8501.
-
Scripts live in
Database & ERD/. -
Run in order:
-
Create database and tables:
mysql -u root -p < "Database & ERD/student_grade_management_sys (updated).sql"
Creates
student_db, all 7 tables (users,students,teachers,courses,enrollments,grades,attendance) with FKs and CHECK constraints. -
Create reporting views:
mysql -u root -p student_db < "Database & ERD/student_grade_report_cards (updated).sql"
Creates 3 views consumed by the Report Cards page.
-
(Optional) Insert sample data:
mysql -u root -p student_db < "Database & ERD/sample_student_management_entries.sql"
Adds 50 entries per table (users, students, teachers, courses, enrollments, grades, attendance) for testing.
-
-
Alternatively, execute the SQL files in MySQL Workbench or any MySQL client.
| Column | Type | Constraints |
|---|---|---|
user_id |
INT |
PRIMARY KEY, range 210000–299999 |
username |
VARCHAR(100) |
NOT NULL, UNIQUE |
passwords |
VARCHAR(255) |
NOT NULL |
roles |
ENUM('Student','Teacher','Admin') |
| Column | Type | Constraints |
|---|---|---|
student_id |
INT |
PRIMARY KEY, range 110000–199999 |
user_id |
INT |
NOT NULL, FK → users(user_id) |
first_name |
VARCHAR(100) |
|
last_name |
VARCHAR(100) |
|
email |
VARCHAR(255) |
UNIQUE |
phone |
VARCHAR(20) |
|
date_of_birth |
DATE |
range 1956–2010 |
| Column | Type | Constraints |
|---|---|---|
teacher_id |
INT |
PRIMARY KEY, range 310000–399999 |
user_id |
INT |
NOT NULL, FK → users(user_id) |
first_name |
VARCHAR(100) |
|
last_name |
VARCHAR(100) |
|
email |
VARCHAR(255) |
UNIQUE |
phone |
VARCHAR(20) |
|
hire_date |
DATE |
>= 1970-01-01 |
| Column | Type | Constraints |
|---|---|---|
course_id |
INT |
PRIMARY KEY, range 410000–499999 |
course_code |
VARCHAR(20) |
UNIQUE |
course_name |
VARCHAR(255) |
|
units |
INT |
range 1–6 |
teacher_id |
INT |
FK → teachers(teacher_id) |
semester |
ENUM('1st','2nd','3rd') |
| Column | Type | Constraints |
|---|---|---|
enrollment_id |
INT |
PRIMARY KEY, range 510000–599999 |
student_id |
INT |
FK → students(student_id) |
course_id |
INT |
FK → courses(course_id) |
enrollment_date |
DATE |
|
enrollment_status |
ENUM('Enrolled','Completed','Dropped','On hold') |
| Column | Type | Constraints |
|---|---|---|
grade_id |
INT |
PRIMARY KEY, range 610000–699999 |
enrollment_id |
INT |
FK → enrollments(enrollment_id) |
grade_letter |
ENUM('A','B','C','D','F') |
|
grade_percentage |
DECIMAL(5,1) |
range 50.0–99.9 |
grade_date |
DATE |
| Column | Type | Constraints |
|---|---|---|
attendance_id |
INT |
PRIMARY KEY, range 710000–799999 |
enrollment_id |
INT |
FK → enrollments(enrollment_id) |
attendance_date |
DATE |
|
attendance_status |
ENUM('Present','Absent','Late','Excused') |
student_grade_report_cards (updated).sql creates 3 views:
| View name | Description |
|---|---|
report_card_details |
Per-student, per-course breakdown — grade, letter, passed/failed remarks, units, semester |
report_card_summary |
Aggregated per-student/semester totals — units enrolled/passed, GWA, attendance counts |
final_report_card_summary |
Combined detail + summary — primary view used in the Report Cards page |
- All views are consumed by
reports.pyon the Report Cards page.
| Module | File | Role |
|---|---|---|
| Entry point | main.py |
Page config, glassmorphism CSS, sidebar radio nav, page routing |
| Database layer | database.py |
get_db_connection() (cached) + query helpers |
| Generic CRUD engine | components.py |
crud() — parameterized queries, auto-ID, field validation, search, edit, delete |
| Student management | students.py |
show_students() — full CRUD with validation |
| Teacher management | teachers.py |
show_teachers() — full CRUD with validation |
| Course management | courses.py |
show_courses() — full CRUD with dynamic teacher dropdown |
| Enrollment management | enrollments.py |
show_enrollments() — full CRUD with student/course dropdowns |
| Grade management | grades.py |
show_grades() — full CRUD with enrollment dropdown |
| Attendance tracking | attendance.py |
show_attendance() — full CRUD with enrollment dropdown |
| User management | users.py |
show_users() — dedicated CRUD with password field handling |
- Dark glassmorphism theme — #121212–#222222 backgrounds with subtle dark blue radial gradient glows
- Animated background — gradients drift diagonally (30s ease-in-out loop)
- Frosted-glass panels —
backdrop-filter: bluron sidebar, stat cards, buttons, and form fields - Custom styling — rounded inputs (10px), styled scrollbars, soft glow hover effects, hidden Streamlit chrome (menu, footer)
- Responsive layout —
widemode with two-column forms and adaptive components - Inter font — clean sans-serif typography via Google Fonts
- Sidebar — radio menu with 9 pages (Dashboard, Students, Teachers, Courses, Enrollments, Grades, Attendance, Users, Report Cards)
- SQL injection prevention — all queries use parameterized statements (
%splaceholders) viamysql.connector - Credential protection — database credentials in
.streamlit/secrets.toml(excluded via.gitignore) - Input validation — field types, ranges, and constraints enforced at UI level before any query
- Error handling — connection and query errors caught without exposing system internals
- Role-based structure — user roles (Student/Teacher/Admin) stored in schema for future access control
- Run locally: ensure MySQL is running with
student_dbcreated, thenstreamlit run main.py - Schema changes: update
components.pyfield definitions if altering table columns or constraints - Testing: no test suite yet. Consider:
- Unit tests for CRUD operations with a mock DB connection
- Integration tests with a dedicated test database
streamlit.testingfor UI component tests
- Fork the repo, create a feature branch (
feat/your-feature), make changes, and open a PR. - Avoid committing secrets or large binaries.
Maintained by Miko-Explorer — open an issue on GitHub.