This repo contains:
backend-ci4/– CodeIgniter 4 API with JWT auth (register, login, teachers list)frontend-react-vite/– React app (Register, Login, Teachers datatable)db/intern_task_mysql_dump.sql– MySQL schema dump
Requirements: PHP >= 8.0, Composer, MySQL (or MariaDB)
cd backend-ci4
cp .env.example .env
# edit .env with your DB credentials and JWT secret
composer install
# Create database using the SQL dump first:
mysql -u root -p < ../db/intern_task_mysql_dump.sql
# Start API
php spark serveEndpoints:
POST /api/register– creates auth_user and teachers in one request, returns JWT{ "email": "a@b.com", "password": "Pass@123", "first_name": "Ada", "last_name": "Lovelace", "university_name": "Babbage Univ", "gender": "Female", "year_joined": 2020 }POST /api/login– returns JWTGET /api/teachers– protected,Authorization: Bearer <token>
Requirements: Node 18+
cd frontend-react-vite
cp .env.example .env
npm install
npm run dev- Passwords are hashed with
password_hash(bcrypt). - JWT via
firebase/php-jwt. - One-to-one relation is enforced by
teachers.user_id UNIQUE+ FK. - Change
VITE_API_BASEto point to your backend base URL.