Worksync: Digitalizing the Classroom Assignment

·

5 min read

Worksync: Digitalizing the Classroom Assignment

Being an Engineer, we are born with that bug of curiosity. I mixed that bug of curiosity with my knowledge of today's technologies. Using the reference of the typical classroom setup of the assignment submission and grading lifecycle, I created a project to modify this flow.

Having more inclination for Back-end engineering, I kept things minimal and ready to use for any front-end application developer. I am trying to briefly explain the functionality of the project and share my learning curve in this blog.

The tech-stack that I used in Worksync encircles:

Programming Language: `Javascript`
Runtime Environment: `NodeJS`
Framework: `ExpressJS`
Database: `PostgreSQL`
API testing tool: `Postman`
Authentication: `bcrypt, JWT`
Node libraries: `multer, nodemailer, body-parser`
Containerization: `Docker, Dockerhub`
Reverse Proxy + Webserver: `Caddy`
Cloud Platform: `Google Cloud Platform`  
Version Control: `Git, GitHub`

Database Structuring

I preferred SQL-based databases to have better programming experience and brush up my SQL query knowledge. The entities that would interact with each other in the project environment were my first step in structuring the database.

Teacher would assign the Assignments to the Students. Students would submit their Submissions to the Teacher.

This was the statement that I kept in my mind while creating database Schema. Although I didn't want to have multiple Sign in logic, so I preferred to wrap Student & Teacher in a single table named User. The database schema carried 3 tables Users, Assignments & Submissions.

API routes

Similar to the database schema, APIs had 3 base routes and 1 route for health check of the port.

  • /health-check/ - to check the health of the server and ports

  • /api/v1/auth/ - handles authentication of the users (Register & Login)

  • /api/v1/assignment/ - route to interact with Assignments.

  • /api/v1/submission/ - route that interacts with Submissions to the Assignments.

Authentication /auth

The users who would interact with Worksync could have roles from Teacher or Student.

I used bcrypt library of NodeJS to encrypt the password while registering the users. The Registration would require ROLE of the user.

The Login and usage of the service were one the key features of my project. I implemented JWT (JSON Web Token) for the Login functionality of Worksync. The major task in this phase was to figure out how to handle the header using Postman. Header and Cookie fetch and reset are automatically handled in Browser but we need to configure these while testing our APIs using Postman and similar tools.

Assignments

  • /createAssignment - This endpoint had a middleware that uses the JWT for authenticated users accessing it. Also, role is needed to be a Teacher for the creation of the assignments.

    For user convenience, I appended another middleware that would send the mail notification to the student when the Teacher creates any new Assignments.

  • /readAssignments - Returns all the assignments if not appended with any params. If the params carry any sort or filter parameters then a dynamic query string is generated and it triggers the database for the getting output accordingly.

    For a better frontend experience, Pagination is a convenient feature is also implemented in Worksync.

  • /updateAssignment & /deleteAssignment - This endpoint is only accessible by the Teacher whose Teacher_id matches the user trying to make the request. The teacher has the authority to create and delete the assignment but updating the settings and features of the assignments should only lie with the same teacher.

Submissions

  • /submitAssignment - This endpoint is used by the Student role to submit their work for the assignments. This function implements multer dependency of NodeJS to let the student submit in various file formats. As of the current version the path of storing the files is in the project folder but it could be scaled up with cloud bucket storage as well.

  • /readSubmission - This endpoint is used by both Teacher and Student to view the submission to analyze the submission counts and also review individual submissions.

  • /updateSubmission &/deleteSubmission - This endpoint uses the same middleware logic as in the Assignments section for Teachers to make it accessible for the creator of Submission.

  • /gradingSubmission - The teacher role is verified in this endpoint and it is used to grade the submission for individual submissions by the students for Assignment. Here the Teacher_id is verified in the Assignment table to allow only the authorized Teacher to grade the submission of Student.

Packaging and Containerising

To make the package ready to use and deploy, I tried my hands on Docker for containerizing the project into a single package. To enable better CPU and memory utilization I used Alpine flavour of Linux while creating images.

The contents of the Dockerfile is as follows

FROM node:alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json .
RUN npm install
COPY . . 
EXPOSE $PORT
CMD node app.js

According to this, while deploying it using the docker image separate volume for PostgreSQL is required. It could be wrapped in docker-compose in the server.


My overall learning curve in making this project was quite dynamic and challenging. Creating features for the project pushed me to re-imagine the flows of control, data, and security. Also, I was able to explore PostgreSQL as an industry-grade database, Postman's utilities and the way it makes any task handy, containerization concept of Docker. My learning didn't stop here but it pushed past the server where I tried to deploy Worksync. I tested deployment in an N2D machine in GCP and created a reverse proxy server using Caddy.

Note: I am open to any and every suggestions to enhance this project and my knowledge as a Backend Developer.