Technology Stack
Relevant source files
The following files were used as context for generating this wiki page:
- package.json
- CONTRIBUTING.md
- DEPLOYMENT.md
- PROJECT_SUMMARY.md
- README.md
- src/app/layout.tsx
- [src/i18n/translations.ts](httpshttps://github ziffmafiya/medical-calculators/blob/main/src/i18n/translations.ts)
- src/calculators/PediatricDoseCalculator.tsx
- src/calculators/BloodGasAnalysisCalculator.tsx
The medical-calculators project is a web application built on a modern technology stack, emphasizing type safety, a streamlined development experience, and a responsive user interface. The core of the application is built with Next.js and React, written in TypeScript, and styled with Tailwind CSS. This combination provides a robust foundation for developing and maintaining the various medical calculator components.
The project is configured for easy local development and is optimized for deployment on modern hosting platforms like Vercel. The codebase includes clear guidelines for contributions, a structured approach to component development, and built-in support for internationalization.
Sources: PROJECT_SUMMARY.md, README.md, CONTRIBUTING.md
Core Technologies
This section outlines the primary frameworks, languages, and libraries that form the foundation of the application.
Frontend Frameworks
The application utilizes Next.js and React to build the user interface.
- Next.js: The application is built with Next.js version 15.4.5. It uses the App Router for routing and page structure, as indicated by the project's file layout (
src/app/). The development environment is accelerated with Turbopack, enabled via thedevscript.
Sources: package.json:5,13, README.md:20,26, PROJECT_SUMMARY.md:19 - React: React version 19.1.0 is used for creating the UI. All calculator components, such as
PediatricDoseCalculator, are functional React components that use hooks likeuseStatefor state management.
Sources: package.json:11, src/calculators/PediatricDoseCalculator.tsx:5,10
The diagram below shows the relationship between the core frontend technologies.
Language
TypeScript is used throughout the project to ensure type safety.
- Version:
^5 - Usage: TypeScript is used to define strict types for component props, state, and function signatures. For example, interfaces like
BloodGasDataandBloodGasResultare defined to model the inputs and outputs of the calculators. A dedicatedsrc/types/directory is intended for shared type definitions. - Type Checking: The command
npx tsc --noEmitis used to perform type-checking without compiling.
Sources: package.json:15, CONTRIBUTING.md:5,123, src/calculators/BloodGasAnalysisCalculator.tsx:6-30
Styling
The project uses Tailwind CSS for styling, along with custom fonts.
-
Tailwind CSS: Version
^4is used for utility-first styling. The project defines a set of custom CSS variables for its color palette, which provides a consistent dark theme.
Sources: package.json:18, CONTRIBUTING.md:73-86, README.md:22The following table lists the custom CSS color variables.
| Variable | Hex Code | Description |
|---|---|---|
--background | #0a0a0a | Main page background |
--foreground | #ffffff | Main text color |
--card | #1a1a1a | Card component background |
--card-foreground | #ffffff | Card text color |
--border | #2a2a2a | Border color for elements |
--input | #2a2a2a | Input field background |
--primary | #3b82f6 | Primary action color (buttons) |
--primary-foreground | #ffffff | Text on primary elements |
--secondary | #374151 | Secondary element color |
--secondary-foreground | #ffffff | Text on secondary elements |
--accent | #1f2937 | Accent background color |
--accent-foreground | #ffffff | Text on accent backgrounds |
--muted | #374151 | Muted element color |
--muted-foreground | #9ca3af | Muted text color |
*Sources: [CONTRIBUTING.md:75-86](https://github.com/ziffmafiya/medical-calculators/blob/HEAD/CONTRIBUTING.md#L75-L86)*
-
Fonts: The application uses the
GeistandGeist_Monofonts, loaded vianext/font/google. These are configured in the root layout to apply globally.// src/app/layout.tsx:2 import { Geist, Geist_Mono } from "next/font/google"; const geistSans = Geist({ variable: "--font-geist-sans", subsets: ["latin"], }); const geistMono = Geist_Mono({ variable: "--font-geist-mono", subsets: ["latin"], });Sources: src/app/layout.tsx:2-14
Development and Build Tools
The project is equipped with scripts and tools to facilitate development, linting, and building.
Package Dependencies
The dependencies are managed via npm and defined in package.json.
Production Dependencies
| Package | Version | Description |
|---|---|---|
react | 19.1.0 | A JavaScript library for building user interfaces. |
react-dom | 19.1.0 | Serves as the entry point to the DOM and server renderers for React. |
next | 15.4.5 | The React framework for production. |
| Sources: package.json:10-13 |
Development Dependencies
| Package | Version | Description |
|---|---|---|
typescript | ^5 | A typed superset of JavaScript that compiles to plain JavaScript. |
@types/node | ^20 | TypeScript definitions for Node.js. |
@types/react | ^19 | TypeScript definitions for React. |
@types/react-dom | ^19 | TypeScript definitions for React DOM. |
@tailwindcss/postcss | ^4 | A PostCSS plugin for Tailwind CSS. |
tailwindcss | ^4 | A utility-first CSS framework. |
eslint | ^9 | A tool for identifying and reporting on patterns in JavaScript. |
eslint-config-next | 15.4.5 | ESLint configuration for Next.js. |
@eslint/eslintrc | ^3 | ESLint configuration file parser. |
| Sources: package.json:15-23 |
NPM Scripts
The package.json file defines scripts for common development tasks.
| Script | Command | Description |
|---|---|---|
dev | next dev --turbopack | Starts the development server with Turbopack. |
build | next build | Creates a production-ready build of the application. |
start | next start | Starts the production server. |
lint | next lint | Runs ESLint to check for code quality and style issues. |
| Sources: package.json:4-8 |
Internationalization (i18n)
The application is designed to support multiple languages.
- Implementation: Internationalization is managed via a custom
LanguageProviderand atranslations.tsfile. TheLanguageProvideris wrapped around the application's children in the root layout. - Supported Languages: The
translations.tsfile contains translation strings for English (en), Russian (ru), and Ukrainian (uk). - Structure: Translations are stored in a nested object, where keys represent different parts of the UI.
This diagram shows the i18n structure.
Deployment
The project is configured for deployment on various platforms, with a primary recommendation for Vercel.
Deployment Flow
The general deployment process involves building the Next.js application and serving the output.
Sources: DEPLOYMENT.md
Platform Options
-
Vercel: The recommended platform, as it automatically detects and optimizes Next.js projects. Deployment is triggered by pushing to the connected Git repository.
-
Netlify: Can be configured to run the
npm run buildcommand and publish the.nextdirectory. -
Docker: A
Dockerfileis provided to containerize the application. It uses a multi-stage build to create a production-optimized image.# DEPLOYMENT.md:36 FROM node:18-alpine WORKDIR /app COPY package*.json ./ RUN npm ci --only=production COPY . . RUN npm run build EXPOSE 3000 CMD ["npm", "start"]Sources: DEPLOYMENT.md:19-45