Skip to content

AmitXShukla/Online-School-Management-App-Angular-Firebase

Repository files navigation

- If you like this project, please consider giving it a star (*) and follow me at GitHub & YouTube.

Online School Management App

This repository is updated to Angular 11.0.0

Please don't forget to upgrade your Angular CLI to V11 and update tsconfig.json as well.

Tools: 

front-end: Angular 11.0.0
back-end: Google Firestore / Firebase
Pro Version: AI, Machine Learning Algorithm supported Advance features

send an email to info@elishconsulting.com for Pro version enquiries.

Objective

  1. Manage Small, Medium, Large Schools / Colleges online for free
  2. Role based Online App access for Student, Parents, Teacher and School Management
  3. Instant password/role reset for all users
  4. Complete Online School Management App for storing Students Records, Grades, Fee, Attendance, Staff and a lot more.
  5. Live School - Student/Parent Notifications (Marks, Fees, Online Homework posting etc)
  6. Paperless Online App based Education features
  7. Social Authentication
  8. Online and/or Offline (delayed capture) App
  9. One App for multiple platforms (iOS, Android, Desktop, Cloud etc.)
  10. Store and Access millions of records instantly
  11. Paperless and Mobile on-premise/private cloud App deployement
  12. Instant access to ALL historical records at anytime
  13. iOS/Android app (notification enabled) / Advance Custom features (Pro version only)
  14. Unlimited Storage (only limited to server/database hosting)

Let's get started :-

// Before we start, Please make sure you have latest version of node js installed.
// head out to https://nodejs.org/en/ and grab latest nodejs.
// Once you have nodejs installed, open command prompt/terminal window.

$ node -v // make sure, this command comes back with a node version
$ npm -v // make sure, this command comes back with a npm version

// How to Install NodeJS on Windows, Mac, Linux & ChromeOS
// First run
$ sudo apt-get update
// and then if needed
$ sudo apt-get install curl gnupg -y
// for nodejs version 14
$ curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
$ sudo apt-get install -y nodejs

// Install Angular CLI
$ npm install -g @angular/cli
$ ng -v // make sure, this command comes back with a npm version
$ mkdir app
$ cd app
$ mkdir client
$ cd client
$ ng new SMA
$ cd SMS
$ ng serve

Setup Google Firestore / Firebase Database & Role / Rules

service cloud.firestore {
  match /databases/{database}/documents {
// SMS App Rules START
  match /SMS_ROLES/{document} {
   allow read, write: if false;
   }
   match /SMS_USERS/{document} {
	 allow create: if exists(/databases/$(database)/documents/SMS_ROLES/$(request.resource.data.secretKey))
   && get(/databases/$(database)/documents/SMS_ROLES/$(request.resource.data.secretKey)).data.role == request.resource.data.role;
   allow update: if exists(/databases/$(database)/documents/SMS_ROLES/$(request.resource.data.secretKey))
   && get(/databases/$(database)/documents/SMS_ROLES/$(request.resource.data.secretKey)).data.role == request.resource.data.role
   && isDocOwner();
   allow read: if isSignedIn() && isDocOwner();
   }
   match /SMS_CONFIG_ENROLL_CD/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff() || isSMSTeacher();
   }
   match /SMS_CONFIG_FEE_CD/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff() || isSMSTeacher();
   }
   match /SMS_CONFIG_MARKS_CD/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff() || isSMSTeacher();
   }
   match /SMS_STUDENTS/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff() || isSMSTeacher();
   }
   match /SMS_STUDENTS/{document}/notifications/{doc} {
   allow read: if isSignedIn();
   }
   match /SMS_FEE/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff() || isSMSTeacher();
   }
   match /SMS_MARKS/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff() || isSMSTeacher();
   }
   match /SMS_EMPLOYEE/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff();
   }
   match /SMS_SALARY/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff();
   }
   match /SMS_SALARY_CD/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff();
   }
   match /SMS_VOUCHER/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff();
   }
   match /SMS_EXPENSES/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff();
   }
   match /SMS_ASSIGNMENT/{document} {
   allow read, delete: if isSMSAdmin() || isSMSStaff() || isSMSTeacher();
   allow write: if true;
   }
   match /SMS_CLASSES/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff() || isSMSTeacher();
   }
   match /SMS_HOMEWORK/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff() || isSMSTeacher();
   }
   match /SMS_TUTORIALS/{document} {
   allow read, write, delete: if isSMSAdmin() || isSMSStaff() || isSMSTeacher();
   }
   function isSMSAdmin() {
    return get(/databases/$(database)/documents/SMS_USERS/$(request.auth.uid)).data.role == 'admin';
    }
    function isSMSStaff() {
    return get(/databases/$(database)/documents/SMS_USERS/$(request.auth.uid)).data.role == 'staff';
    }
    function isSMSParent() {
    return get(/databases/$(database)/documents/SMS_USERS/$(request.auth.uid)).data.role == 'parent';
    }
    function isSMSTeacher() {
    return get(/databases/$(database)/documents/SMS_USERS/$(request.auth.uid)).data.role == 'teacher';
    }
    function isSMSStudent() {
    return get(/databases/$(database)/documents/SMS_USERS/$(request.auth.uid)).data.role == 'student';
    }
    function isDocOwner(){
    // assuming document has a field author which is uid
    // Only the authenticated user who authored the document can read or write
    	return request.auth.uid == resource.data.author;
      // This above read query will fail
    // The query fails even if the current user actually is the author of every story document.
    //  The reason for this behavior is that when Cloud Firestore applies your security rules, 
    //  it evaluates the query against its potential result set,
    //   not against the actual properties of documents in your database. 
    //   If a query could potentially include documents that violate your security rules, 
    //   the query will fail.
    //   on your client app, make sure to include following
    //   .where("author", "==", this.afAuth.auth.currentUser.uid)
    }
    function isSignedIn() {
    // check if user is signed in
          return request.auth.uid != null;
    }
  // SMS App Rules END
}
}