feat: initial import — ClickerZ formation project (Express + React/Vite)

This commit is contained in:
2026-03-15 14:29:33 +01:00
commit 4e93753250
118 changed files with 71039 additions and 0 deletions

36
Backend/database/client.js Executable file
View File

@@ -0,0 +1,36 @@
// Get variables from .env file for database connection
const { DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME } = process.env;
// Create a connection pool to the database
const mysql = require("mysql2/promise");
const client = mysql.createPool({
host: DB_HOST,
port: DB_PORT,
user: DB_USER,
password: DB_PASSWORD,
database: DB_NAME,
});
// Try to get a connection to the database
client
.getConnection()
.then((connection) => {
console.info(`Using database ${DB_NAME}`);
connection.release();
})
.catch((error) => {
console.warn(
"Warning:",
"Failed to establish a database connection.",
"Please check your database credentials in the .env file if you need a database access."
);
console.error("Error message:", error.message);
});
// Store database name into client for further uses
client.databaseName = DB_NAME;
// Ready to export
module.exports = client;

9
Backend/database/schema.sql Executable file
View File

@@ -0,0 +1,9 @@
DROP TABLE IF EXISTS users;
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
nickname VARCHAR(30) NOT NULL,
mail VARCHAR(90) NOT NULL,
password VARCHAR(200) NOT NULL,
tetardcoin INT default 0
);