# Gradhire – Student Internship Platform

> Built the authentication, role model and PostgreSQL schema of a university internship platform, taking offers from posting through approval to a tracked internship.

- Author: Daniil Hirchyts
- Published: February 1, 2024
- URL: https://hirchyts-daniil.me/projects/gradhire
- Link: https://github.com/GradHire/GradHire-website

Gradhire is an internship and apprenticeship platform for computer science students, built by a team of four during my Bachelor of Engineering (BEng) in Computer Science and Technology at the Montpellier University Institute of Technology. Companies post offers, students apply, and academic staff approve, assign tutors and follow each internship to its evaluation. Gradhire replaced several disconnected systems with one.

I owned authentication, access control and the database, and built parts of the offer and application modules.

[![Gradhire walkthrough: the dashboard, the internship offers list and the detail page of one offer](https://hirchyts-daniil.me/projects/gradhire/gradhire.mp4)](https://github.com/GradHire/GradHire-website)

## Two Kinds of Users, One Login

Students and staff already had university accounts, so they sign in through the university's LDAP server and never create a password for Gradhire. Companies and external tutors have no university account, so they register with an email address, confirm it, and get password recovery. Their passwords are stored salted and peppered, with the pepper kept outside the database.

After sign-in, the role decides what a person can do. Students browse offers, apply and follow their internship. Staff validate internships, assign tutors and grade. Department heads also change other users' roles. Companies post offers, review applicants and manage their own tutors. Roles are a PostgreSQL enum, so an invalid one can't reach the database.

## A Database That Keeps the Rules

The schema has 29 tables, and I pushed as much of the process into PostgreSQL as it would take:

- Internships and apprenticeships inherit from one offer table, so a query over all offers needs no union, and each type keeps its own columns.
- 23 functions and 18 stored procedures cover operations like creating a user or reading a role, so the PHP code calls one procedure instead of repeating several queries.
- A trigger refuses to give a tutor more students than their limit, whichever screen the assignment comes from.
- The dashboard reads from seven materialized views, and seven triggers refresh them when the underlying data changes. Statistics stay current without recomputing them on every page load.

Every query is a prepared statement, user content is encoded before display, and accounts and offers are archived rather than deleted.

## From Offer to Internship

<iframe width="560" height="315" loading="lazy" src="https://www.youtube-nocookie.com/embed/RH32wtf2-sI?si=q2iSrOmgc4XLJd5e" title="Gradhire demo: offer management (YouTube)" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerPolicy="strict-origin-when-cross-origin"
        allowFullScreen></iframe>

A company writes an offer as a draft and submits it. Staff approve it before students can see it. Students filter offers by type, theme, duration, location and pay, and can subscribe to a theme to get an email when a matching offer is published.

An application then moves through fixed steps: the student applies with a CV and cover letter, the company accepts or rejects, the student confirms, and staff assign an academic tutor while the company names its own. Everyone sees the same status, each from their own view. After that, the platform generates the internship agreement as a PDF for approval, schedules the academic tutor's visit to the company, and collects both tutors' evaluations.

## Two Small Frameworks

<iframe width="560" height="315" loading="lazy" src="https://www.youtube-nocookie.com/embed/03-LobQ90b8?si=IlLJlYUYuFP2IUGG" title="Gradhire demo: advanced features (YouTube)" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerPolicy="strict-origin-when-cross-origin"
        allowFullScreen></iframe>

The app is plain PHP with an MVC structure, so we wrote the two pieces a framework would normally provide. The router, modeled on Express and Laravel, maps HTTP verbs and paths like `/gererNote/modifier/{id}` to controllers and hands them a request object with the body and cookies. The form builder generates 13 input types with their validation on both client and server, so every form validates and reports errors the same way.

The project ran on GitHub with a Kanban board, three short stand-ups a week and features shipped as they were finished. It was deployed in Docker containers on AWS EC2.

## What Carries Over

When several applications or screens touch the same data, rules like a tutor's student limit belong in the database, where no code path can skip them. And if the users already have an identity provider, connect to it before inventing accounts: the students never had to remember another password.
