first commit

This commit is contained in:
Space-Banane
2026-02-09 19:26:40 +01:00
commit ead561d10b
42 changed files with 2364 additions and 0 deletions

44
.github/copilot-instructions.md vendored Normal file
View File

@@ -0,0 +1,44 @@
# Copilot Instructions for Exam Manager
## Architecture Overview
- **Backend**: TypeScript (Node.js) located in [/backend](/backend). Uses `rjweb-server` for the web server and `mongodb` for the database.
- **Frontend**: React (Vite) located in [/frontend](/frontend). Uses Tailwind CSS for styling and React Router for navigation.
- **Database**: MongoDB. Database connection string is managed via `.env` file.
- **Deployment**: Backend serves the frontend's built files from `/frontend/dist`. API routes are prefixed with `/api`.
## Core Patterns & Conventions
### Backend (Node.js/TypeScript)
- **Server Framework**: `rjweb-server`. Routes are defined using `fileRouter.Path`.
- **Database Access**: Use the exported `db` object from [backend/src/index.ts](backend/src/index.ts).
- **Models & Types**: Defined in [backend/src/types.ts](backend/src/types.ts).
- **Authentication**: Session-based using a cookie named `exams_session` or an `api-authentication` header. Use `authCheck` from [backend/src/lib/Auth.ts](backend/src/lib/Auth.ts) to protect routes.
- **Static Files**: The backend serves the frontend's built files from `/frontend/dist`. API routes are prefixed with `/api`.
### Frontend (React)
- **API Calls**: Axios-based. Authentication is handled automatically via cookies. API paths start with `/api/`.
- **Types**: Always keep [frontend/src/types.ts](frontend/src/types.ts) in sync with backend types.
- **Routing**: Managed in [frontend/src/App.tsx](frontend/src/App.tsx). Protected routes should verify authentication with the backend.
- **Icons**: Use `lucide-react` for iconography.
## Developer Workflows
- **Running with Docker**: Use `docker-compose up --build` to build both stacks and the DB.
- **Local Backend Dev**:
```bash
cd backend
npm install
npm run dev
```
- **Local Frontend Dev**:
```bash
cd frontend
npm install
npm run dev
```
## Important Files
- [backend/src/index.ts](backend/src/index.ts): Entry point and server configuration.
- [backend/src/routes/](backend/src/routes/): Directory containing all API endpoints.
- [backend/src/types.ts](backend/src/types.ts): Shared TypeScript interfaces for models.
- [frontend/src/App.tsx](frontend/src/App.tsx): Frontend routing and auth state.
- [frontend/src/types.ts](frontend/src/types.ts): Type definitions for the frontend.