No description
  • JavaScript 58.5%
  • CSS 23.5%
  • HTML 16.1%
  • Rust 1.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-17 13:44:07 +02:00
.idea first backend setup 2024-08-20 19:36:54 +02:00
db Moved db init script in a separate db folder 2026-07-17 13:44:07 +02:00
node_modules first backend setup 2024-08-20 19:36:54 +02:00
src Merge branch 'main' of https://codeberg.org/cieldeb/fablab 2026-07-17 11:02:39 +02:00
.gitignore updated gitignore with node_modules/ 2024-08-20 23:52:34 +02:00
package-lock.json first backend setup 2024-08-20 19:36:54 +02:00
package-lock.json.prev Added files for proper login logic 2026-07-17 10:06:01 +02:00
package.json logging in works, unexistant users added to db 2024-08-26 13:00:06 +02:00
package.json.prev Added files for proper login logic 2026-07-17 10:06:01 +02:00
README.md Added files for proper login logic 2026-07-17 10:06:01 +02:00

Plateforme Fablab – Garage ISEP

A web platform for submitting and managing 3D-printing orders at the Garage ISEP fablab. Students upload a model file and order details; fablab staff track and update each order's status (pending, sliced, printing, finished, etc.) from an admin dashboard, with a chat thread per order for back-and-forth questions.

Features

  • Account system – local registration and login (no external SSO dependency), with hashed passwords.
  • Order submission – students upload a 3D model file along with material, color, quantity, and notes.
  • Order tracking – students can follow their order's status and message the fablab team about it.
  • Admin dashboard – staff view all orders, update their state, and reply to student messages.
  • Real-time updates – the client and server communicate over a single WebSocket connection.

Tech stack

  • Backend: Node.js, ws for WebSocket communication, pg for PostgreSQL, bcryptjs for password hashing.
  • Frontend: plain HTML/CSS/JavaScript (ES modules), no build step required.
  • Database: PostgreSQL.

Project structure

.
├── src/
│   ├── back/                # Node.js server
│   │   ├── server.js        # HTTP + WebSocket server, static file serving, message routing
│   │   ├── db_handler.js    # PostgreSQL queries
│   │   └── login_handler.js # Registration / authentication logic
│   └── front/                # Static client
│       ├── HTML/
│       ├── CSS/
│       ├── JS/
│       └── Assets/
├── db/
│   └── init.sql              # Database schema, auto-applied by the Postgres container
├── Dockerfile
├── docker-compose.yml
├── .env.example
└── package.json

This spins up the app and a PostgreSQL database together; the schema in db/init.sql is applied automatically on first run.

  1. Copy the environment template and set a real database password:
    cp .env.example .env
    
  2. Build and start the stack:
    docker compose up --build
    
  3. The app is available at http://localhost:8080 (or whatever PORT you set in .env).

Uploaded order files and database data persist in Docker volumes (uploads, db_data) across restarts. To reset everything, including the database, run docker compose down -v.

Running locally without Docker

Requirements: Node.js 20+, a running PostgreSQL instance.

  1. Install dependencies:
    npm install
    
  2. Create the database and apply the schema:
    psql -U <user> -d <database> -f db/init.sql
    
  3. Set the environment variables listed below (e.g. via a .env file loaded by your shell, or exported directly).
  4. Start the server:
    npm start
    
  5. The app is available at http://localhost:8080 by default.

Environment variables

Variable Description Default
PORT Port the server listens on 8080
DB_HOST PostgreSQL host localhost
DB_PORT PostgreSQL port 5432
DB_USER PostgreSQL user postgres
DB_PASSWORD PostgreSQL password (required, no default)
DB_NAME PostgreSQL database name plateforme_fablab
UPLOADS_DIR Directory where uploaded order files are stored ./uploads

See .env.example for a ready-to-copy template.

Database schema

db/init.sql defines three tables:

  • user – accounts (student code, hashed password, privilege level, name, chat).
  • cookie – active session tokens linked to a user.
  • order – submitted orders (details, state, uploaded files, chat thread).

Security notes

  • Passwords are hashed with bcrypt before being stored; plaintext passwords are never persisted.
  • Session tokens are generated with crypto.randomBytes and stored server-side in the cookie table.
  • There is currently no admin-approval step for new accounts and no password-reset flow — anyone who can reach the server can self-register. Add an invitation/approval step if that's a concern for your deployment.

Author