Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/
.env
*.log
.DS_Store
87 changes: 84 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,85 @@
# LAB
# Virtual Science Lab 🔬

This repository is initialized for the LAB project.
# labbbb
A full-stack web platform for interactive virtual science experiments for Algerian students (primary, middle, and high school).

## Features

- 🧪 **3D Virtual Experiments** — Interactive React Three Fiber simulations (electric circuit, free fall, chemistry tests, and more)
- 🎓 **Role-based Access** — Separate student and teacher dashboards
- �� **Progress Tracking** — Quiz scores and experiment completion saved per student
- 🏫 **Teacher Analytics** — Filter students by wilaya, commune, school, and level
- 🔐 **JWT Authentication** — Secure login with bcrypt-hashed passwords

## Tech Stack

- **Frontend:** React 18, Vite, Tailwind CSS v4, React Three Fiber (Three.js), React Router v6
- **Backend:** Node.js, Express 4
- **Database:** MongoDB with Mongoose 7
- **Auth:** JWT + bcryptjs

## Quick Start

### Prerequisites
- Node.js 18+
- MongoDB (local or Atlas)

### Installation

```bash
# Clone and install
git clone <repo-url>
cd virtual-science-lab

# Install server dependencies
cd server && npm install

# Install client dependencies
cd ../client && npm install

# Configure environment
cp server/.env.example server/.env
# Edit server/.env — set MONGO_URI and JWT_SECRET
```

### Running in Development

```bash
# Terminal 1 — Backend
cd server && npm run dev

# Terminal 2 — Frontend
cd client && npm run dev
```

### Seed Experiments

After starting the server with a MongoDB connection:

```bash
curl -X POST http://localhost:5000/api/experiments/seed
```

## Project Structure

```
virtual-science-lab/
├── client/ # React frontend
│ └── src/
│ ├── api/axios.js # Axios instance
│ ├── contexts/ # AuthContext
│ ├── components/ # Layout (sidebar)
│ └── pages/ # Login, Register, StudentDashboard, VirtualLab, TeacherDashboard
├── server/ # Express API
│ ├── models/ # User, Student, Experiment, Result
│ ├── routes/ # auth, students, experiments, results, teacher
│ └── middleware/auth.js # JWT verification
└── docs/ # Platform overview & prompt engineering guide
```

## API

See [docs/PLATFORM_OVERVIEW.md](docs/PLATFORM_OVERVIEW.md) for full API documentation.

## License

MIT
24 changes: 24 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
16 changes: 16 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)

## React Compiler

The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).

## Expanding the ESLint configuration

If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
29 changes: 29 additions & 0 deletions client/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import { defineConfig, globalIgnores } from 'eslint/config'

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{js,jsx}'],
extends: [
js.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
rules: {
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
},
},
])
13 changes: 13 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>client</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading