Skip to content

BMunozKlerman/consult-session-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Consult Session Manager

A full-stack application for managing medical consultation sessions across devices.

Tech Stack

Layer Technology
Backend NestJS 11, TypeORM, SQLite (better-sqlite3)
Frontend Next.js 16 (App Router), Tailwind CSS, next-intl
Testing Jest, React Testing Library

Prerequisites

  • Node.js ≥ 18
  • npm ≥ 9

Getting Started

1. Clone the repository

git clone <repo-url>
cd consult-session-manager

2. Backend setup

cd backend
npm install

Create a .env file in backend/:

API_KEY=your-secret-api-key
PORT=3001
DATABASE_PATH=database.sqlite
FRONTEND_URL=http://localhost:3000

Start the development server:

npm run start:dev

The API will be available at http://localhost:3001.

Seed the database

npm run seed

This creates 5 medical devices and 3 sessions per device (idempotent — safe to run multiple times).

3. Frontend setup

cd frontend
npm install

Create a .env.local file in frontend/:

NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_API_KEY=your-secret-api-key

The API_KEY value must match the one set in the backend .env.

Start the development server:

npm run dev

The app will be available at http://localhost:3000.


Running Tests

Backend

cd backend
npm test              # run all tests
npm run test:watch    # watch mode
npm run test:cov      # with coverage report

Frontend

cd frontend
npm test              # run all tests
npm run test:watch    # watch mode

Available API Endpoints

All 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

POST /devices — request body

{
  "name": "Estetoscopio Digital"
}

POST /sessions — request body

{
  "patientName": "John Doe",
  "deviceId": 1,
  "notes": "Optional notes"
}

PATCH /sessions/:token — request body

{
  "status": "in_progress"
}

Valid statuses: pending · in_progress · completed · failed


Features

  • 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

Project Structure

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

Internationalization

The app supports Spanish (default) and English. Switch languages using the ES / EN toggle in the sidebar. Translation files are located in frontend/messages/.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors