Skip to content

Waaahx/greenit-emargement-audit

 
 

Repository files navigation

📗 Green IT Project – Audit of the Attendance Application

🎯 Project Context

This project is part of a Green IT audit exercise.

You will work on an old attendance (emargement) application that was previously used in a real educational context.

👉 Your mission is NOT to develop new features.
The goal is to:

  • audit an existing application
  • understand how it works
  • analyze its technical and organizational choices
  • identify potential environmental and technical issues
  • propose Green IT–oriented improvements

🕵️ Pedagogical Objective

Through this project, you are expected to:

  • understand an existing application (backend + database)
  • analyze:
    • the overall architecture
    • the database structure
    • the server and deployment configuration
  • identify:
    • inefficient or outdated practices
    • potential overconsumption of resources
    • optimization opportunities
  • produce a structured and well-argued audit

⚠️ This project intentionally reflects real-world legacy constraints.
The setup is not fully automated, and this is part of the exercise.

🧰 Technical Prerequisites

Before starting, make sure you have:

  • Docker
  • MySQL client (mysql)
  • Node.js and npm (or equivalent)
  • Git
  • Linux / macOS environment (or WSL on Windows)

📦 Project Setup

Clone only the branch used for the audit:

git clone -b main --single-branch https://github.com/Zone01Rouen/greenit-emargement-audit.git

🗄️ 1. MySQL Database Setup

The application relies on a MySQL database.

1️⃣ Start MySQL using Docker

docker run \
  -e MYSQL_ROOT_PASSWORD=password \
  -e MYSQL_DATABASE=emargement \
  -p 3306:3306 \
  -d mysql

🔍 Explanation

  • MYSQL_ROOT_PASSWORD: root password for MySQL
  • MYSQL_DATABASE: database automatically created
  • 3306: MySQL port exposed on the host machine

Check that the container is running:

docker ps

🧱 2. Import the Database Schema

A SQL migration file is provided in the project:

sign_db_june_2025.sql

👉 This file contains only the database structure, without any data.

Import the schema

mysql -h 127.0.0.1 -u root -p -D emargement < /path/to/sign_db_june_2025.sql
  • Password when prompted: password

👤 3. Create a Test User

To be able to log into the application, a test user must be created manually.

Connect to MySQL

mysql -h 127.0.0.1 -u root -p

Select the database

USE emargement;

Insert the test user

INSERT INTO `students` (pseudo, password)
VALUES (
  'test',
  '$2a$12$lbO9/tiSuzSX..YVKBspiOZIlFXaWThefIXfT/8KvID02xm8MPJya'
);

🔐 Test credentials

  • Username: test
  • Password: test

💡 The password is stored as a bcrypt hash.

⚙️ 4. Application Configuration

Create a .env file at the root of the project.

.env file content

DB_HOST=127.0.0.1:3306
DB_USER=root
DB_PASS=password
DB_NAME=emargement
JWT_SECRET=changeme

⚠️ Important

  • JWT_SECRET is used to sign authentication tokens
  • It must be replaced with a secure random value

You can generate one using:

openssl rand -hex 32

▶️ 5. Install and Run the Application

Install dependencies:

npm install

Start the application:

npm start

(or the equivalent command depending on the project setup)

✅ Expected Result

At this stage:

  • the MySQL database is running
  • the schema is imported
  • the test user exists
  • the application starts correctly
  • login with the test user is possible

🧠 Expected Student Work

You are required to produce a Green IT audit, focusing for example on:

  • overall architecture
  • database usage
  • Docker and infrastructure choices
  • server and configuration management
  • technical and organizational decisions
  • environmental and sustainability impacts

👉 The objective is not to immediately refactor the code, but to:

  • understand
  • analyze
  • justify
  • propose relevant improvement paths

📌 Final Note

This project is based on a real legacy application, intentionally restored in its original state to serve as an audit support.

Some technical choices may appear questionable. 👉 This is intentional and part of the learning objectives.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • PHP 56.7%
  • JavaScript 28.1%
  • Hack 8.3%
  • HTML 4.0%
  • CSS 2.9%