A full-stack application for managing medical consultation sessions across devices.
| Layer | Technology |
|---|---|
| Backend | NestJS 11, TypeORM, SQLite (better-sqlite3) |
| Frontend | Next.js 16 (App Router), Tailwind CSS, next-intl |
| Testing | Jest, React Testing Library |
- Node.js ≥ 18
- npm ≥ 9
git clone <repo-url>
cd consult-session-managercd backend
npm installCreate a .env file in backend/:
API_KEY=your-secret-api-key
PORT=3001
DATABASE_PATH=database.sqlite
FRONTEND_URL=http://localhost:3000Start the development server:
npm run start:devThe API will be available at http://localhost:3001.
npm run seedThis creates 5 medical devices and 3 sessions per device (idempotent — safe to run multiple times).
cd frontend
npm installCreate a .env.local file in frontend/:
NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_API_KEY=your-secret-api-keyThe
API_KEYvalue must match the one set in the backend.env.
Start the development server:
npm run devThe app will be available at http://localhost:3000.
cd backend
npm test # run all tests
npm run test:watch # watch mode
npm run test:cov # with coverage reportcd frontend
npm test # run all tests
npm run test:watch # watch modeAll requests require the x-api-key header.
| Method | Endpoint | Description |
|---|---|---|
GET |
/devices |
List all devices |
POST |
/devices |
Create a new device |
GET |
/devices/:token |
Get device with its sessions |
GET |
/sessions |
List all sessions |
GET |
/sessions/:token |
Get session detail |
POST |
/sessions |
Create a new session |
PATCH |
/sessions/:token |
Update session status |
{
"name": "Estetoscopio Digital"
}{
"patientName": "John Doe",
"deviceId": 1,
"notes": "Optional notes"
}{
"status": "in_progress"
}Valid statuses: pending · in_progress · completed · failed
- Devices list: responsive table / card layout, pagination, create new devices inline
- Device detail: sessions with status filter (All / Pending / In progress / Completed / Failed), pagination, and create session form
- Sessions list: all sessions across devices with status filter, pagination, and create session form
- Session detail: patient info, device name, notes, and status update form
- Pagination: dynamic items-per-page selector (5 / 10 / 25) on all index pages
- Status filter: filter sessions by status (All / Pending / In progress / Completed / Failed)
- Breadcrumb navigation: context-aware — session detail shows device path when reached from a device
- Loading states: skeleton loaders per route via
loading.tsx - Error states: retry-able error boundary per route via
error.tsx - Internationalization: Spanish (default) and English, toggled from the sidebar
consult-session-manager/
├── backend/
│ ├── src/
│ │ ├── database/ # Seed script
│ │ ├── devise/ # Devices module (entity, service, controller, DTOs)
│ │ ├── guards/ # API key guard
│ │ └── session/ # Sessions module (entity, service, controller, DTOs)
│ └── .env # Backend environment variables
└── frontend/
├── messages/ # i18n translations (en, es)
├── src/
│ ├── app/ # Next.js App Router pages + loading/error boundaries
│ ├── components/ # UI components (sessions, devices, layout, ui)
│ ├── hooks/ # usePagination, useSessionFilter
│ ├── i18n/ # next-intl routing and navigation
│ ├── lib/ # API client and fetch helpers
│ └── types/ # Shared TypeScript types
└── .env.local # Frontend environment variables
The app supports Spanish (default) and English. Switch languages using the ES / EN toggle in the sidebar. Translation files are located in frontend/messages/.