Skip to content

Team3132/AttendanceSystem

Repository files navigation

The TDU Attendance System

About

This is a simple attendance system for TDU students. It is written in TypeScript to improve the code quality and maintainability. It has a few components:

  • Frontend: The frontend is written using the React framework. It is a single page application that communicates with the backend using an awesome project called tRPC.
  • Backend: The backend is served using Fastify. It processes requests through tRPC from the frontend and bot and communicates with the database.
  • Bot: The bot is written using the NestJS framework. It communicates with the backend using tRPC and interfaces with Discord over a wrapper library for discord.js called Necord

Features

  • Attendance: Students can check in to meetings and events using the bot or the frontend.
  • RSVPs: Students can RSVP to meetings and events using the bot or the frontend.
  • Outreach: If students volunteer to help out with events, their outreach hours are tallied and added to a leaderboard accessible from the bot or the frontend.
  • Google Calendar Integration: Events are automatically pulled from the team's Google Calendar and added to the database. This is done using a cron job that runs every day at ~midnight.
  • Live Updates: If a student checks in to an event, the frontend will update in real time to reflect that. This is done using tRPC.
  • Build Season Points: Students can earn points during the build season (added by mentors) and the points are tallied and added to a leaderboard accessible from the bot or the frontend.

Development

Prerequisites

  • Node.js (v21) - This is the runtime for the project.
  • PNPM (v8) - This is the package manager for the project.
  • Docker - This is used to run the database and Redis server.

Setup

  1. Clone the repository.
  2. Run pnpm i to install the dependencies.
  3. Populate the .env file with the required values. (Found in .env.example files)
  4. Run pnpm dev to start the development servers for the backend, frontend and bot.

Database and Redis

The database is run using Docker. To start the database, run docker-compose up -d in the root directory of the project. To stop the database, run docker-compose down in the root directory of the project. The database is exposed on port 5432 and the Redis server is exposed on port 6379.

Folder Structure

  • /packages: This is where the code for the different parts of the project is stored.
    • /backend: This is where the code for the backend is stored.
    • /bot: This is where the code for the bot is stored.
    • /frontend: This is where the code for the frontend is stored.

Further Setup

Further instructions for the different parts of the project can be found in the README.md files in the respective directories.

Versioning

The project uses SemVer for versioning and Conventional Commits for commit messages. This means that features, bug fixes, etc. are all versioned and documented in the commit messages.

Deployment

The project is deployed using Docker using two containers. One container runs the backend and the other runs the frontend and bot. The containers are deployed to the Github Container Registry and are pulled by the server.

The frontend is included in the same container as the backend for simplicity.

They're accessible under the tags: ghcr.io/team3132/attendancesystem-bot:latest ghcr.io/team3132/attendancesystem-backend:latest

Automatic Updates

The project uses Renovate to automatically update dependencies. Renovate will automatically create pull requests to update dependencies. These pull requests will be automatically merged if they pass the CI checks.

Extra Resources

  • Fireship: This is a great YouTube channel for learning about web development.
  • The Net Ninja: This is another great YouTube channel for learning about web development.
  • TypeScript: This is the language used for the project.