Files
exams/.github/copilot-instructions.md
Space-Banane ead561d10b first commit
2026-02-09 19:26:40 +01:00

2.3 KiB

Copilot Instructions for Exam Manager

Architecture Overview

  • Backend: TypeScript (Node.js) located in /backend. Uses rjweb-server for the web server and mongodb for the database.
  • Frontend: React (Vite) located in /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.
  • Models & Types: Defined in 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 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 in sync with backend types.
  • Routing: Managed in 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:
    cd backend
    npm install
    npm run dev
    
  • Local Frontend Dev:
    cd frontend
    npm install
    npm run dev
    

Important Files