# Overview

MediFlash SOS+ is a modern full-stack web application for emergency medication delivery services. Built with React/TypeScript frontend, Node.js/Express backend, and PostgreSQL database via Drizzle ORM, the platform connects clients needing urgent medications with nearby pharmacies and delivery couriers. The system features real-time order tracking, geolocation-based matching, wallet management, and role-based dashboards for clients, pharmacies, couriers, and administrators.

# User Preferences

Preferred communication style: Simple, everyday language.

# System Architecture

## Frontend Architecture
- **Framework**: React 18 with TypeScript using Vite for development and building
- **Styling**: Tailwind CSS with custom medical/professional color palette and Shadcn/ui component library
- **State Management**: TanStack React Query for server state management with custom query client
- **Routing**: Wouter for lightweight client-side routing
- **Forms**: React Hook Form with Zod schema validation for type-safe form handling
- **UI Components**: Comprehensive Radix UI primitives wrapped in custom components for accessibility

## Backend Architecture
- **Runtime**: Node.js with Express.js web framework
- **Language**: TypeScript with ESM modules
- **Database ORM**: Drizzle ORM with Neon serverless PostgreSQL
- **Authentication**: Session-based auth with bcrypt password hashing
- **API Design**: RESTful endpoints with consistent error handling and logging middleware
- **File Structure**: Organized with separate routes, storage layer, and database connection modules

## Data Storage
- **Database**: PostgreSQL via Neon serverless with connection pooling
- **ORM**: Drizzle ORM with schema-first approach and TypeScript integration
- **Schema Design**: 
  - User roles (client, pharmacy, courier, admin) with role-based access
  - Order lifecycle management with status tracking
  - Geolocation support for proximity-based matching
  - Wallet/ledger system for financial transactions
  - Medicine catalog and pharmacy stock management
- **Migrations**: Drizzle Kit for schema migrations and database management

## External Dependencies

- **Database**: Neon serverless PostgreSQL for production database hosting
- **Maps/Geolocation**: Browser Geolocation API with Leaflet.js for interactive maps
- **Real-time Features**: WebSocket support via Neon for live order tracking
- **UI Framework**: Shadcn/ui component library built on Radix UI primitives
- **Development Tools**: Vite for fast development builds and Replit integration
- **Authentication**: Native session management without third-party auth providers
- **Payment Processing**: Internal wallet system without external payment gateways
- **Deployment**: Configured for Replit hosting with development and production environments