Documentation Index
Fetch the complete documentation index at: https://mintlify.com/praveenarya123/sps-backend/llms.txt
Use this file to discover all available pages before exploring further.
Data models
SPS School Backend uses Mongoose to define schemas for MongoDB. There are seven collections, each documented below with its fields, constraints, and an example document.Relationships overview
The diagram below shows how collections reference each other viaObjectId fields.
Models
User
User
Stores credentials and role information for every person who can log in to the system. Each email address must be unique.
Fields
Full name of the user.
Email address. Must be unique across all users. Used as the login identifier.
Bcrypt-hashed password. Never returned in API responses.
One of seven allowed values:
SUPER_ADMIN, ACADEMIC_ADMIN, STUDENT_ADMIN, FINANCE_ADMIN, OPERATIONS_ADMIN, TEACHER, STUDENT. Enforced by a Mongoose enum constraint. See Roles for details.Schema source
models/User.js
Example document
MongoDB document
Student
Student
Represents a student enrolled at the school. Distinct from the
User model — a student record holds academic identity (class, section, roll number) rather than login credentials.Fields
Full name of the student.
Email address for the student. Not required to be unique at the schema level.
Class or grade the student belongs to (e.g.,
"10A", "Grade 5").Section within the class (e.g.,
"A", "B").Numeric roll number assigned to the student within their class and section.
Schema source
models/Student.js
Example document
MongoDB document
Student._id is the primary foreign key referenced by Attendance, Submission, Application, and Fee documents.Attendance
Attendance
Records a single attendance event for one student on one date.
Fields
Reference to the
Student._id this record belongs to.The calendar date of the attendance event.
Attendance status for the day. Typical values are
"PRESENT" and "ABSENT", but the schema does not enforce an enum.Schema source
models/Attendance.js
Example document
MongoDB document
Relationships
| Field | References | Description |
|---|---|---|
studentId | Student._id | The student this record is for |
Assignment
Assignment
Represents a task or assessment created by a teacher for a class.
Fields
Numeric identifier of the class the assignment is for.
Title or name of the assignment.
Deadline by which students must submit their work.
Reference to the
User._id of the teacher who created the assignment.Schema source
models/Assignment.js
Example document
MongoDB document
Relationships
| Field | References | Description |
|---|---|---|
teacherId | User._id | The teacher who created this assignment |
Assignment._id is referenced by Submission.assignmentId to link student submissions back to the original task.Submission
Submission
Records a student’s submitted work for a specific assignment.
Fields
Reference to the
Assignment._id this submission is for.Reference to the
Student._id of the student who submitted.URL pointing to the uploaded submission file (e.g., a cloud storage URL).
Timestamp of when the submission was received.
Schema source
models/Submission.js
Example document
MongoDB document
Relationships
| Field | References | Description |
|---|---|---|
assignmentId | Assignment._id | The assignment being submitted |
studentId | Student._id | The student who submitted |
Application
Application
Represents a formal request sent from a student to a teacher — for example, a leave request, an extension, or any other workflow requiring teacher approval.
Fields
Reference to the
Student._id of the applicant.Reference to the
User._id of the teacher the application is addressed to.Category of the application (e.g.,
"LEAVE", "EXTENSION", "OTHER").The body of the application — the student’s written request.
Current state of the application. Defaults to
"PENDING". Updated by the teacher to "APPROVED" or "REJECTED".Schema source
models/Application.js
Example document
MongoDB document
Relationships
| Field | References | Description |
|---|---|---|
studentId | Student._id | The student making the request |
teacherId | User._id | The teacher who reviews and acts on the request |
status defaults to "PENDING" when a new application is created. The teacher updates it to "APPROVED" or "REJECTED" via PUT /api/application/:id.Fee
Fee
Represents a fee record assigned to a student, tracking the amount owed and its payment status.
Fields
Reference to the
Student._id this fee is charged to.The fee amount in the school’s base currency unit.
Payment status. Typical values are
"PAID" and "UNPAID", but the schema does not enforce an enum.Schema source
models/Fee.js
Example document
MongoDB document
Relationships
| Field | References | Description |
|---|---|---|
studentId | Student._id | The student who owes this fee |
Field constraints summary
The table below consolidates all schema-level constraints across every model.| Model | Field | Constraint |
|---|---|---|
| User | email | unique: true |
| User | role | enum — must be one of the seven defined role strings |
| Application | status | default: "PENDING" |
All other fields use Mongoose’s loose defaults — they are optional unless your application-level validation enforces them. Consider adding
required: true to critical foreign-key fields like studentId and teacherId in production.