Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JReyna217/PharmaVault/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through everything needed to run PharmaVault on your local development machine — from creating the PostgreSQL database and applying the schema to wiring up your connection string with .NET User Secrets and launching the Blazor application. By the end you will have a fully functional instance of PharmaVault accessible at http://localhost:5136.

Prerequisites

Before you begin, make sure the following are installed and available on your machine:
  • .NET 10 SDK or higher
  • PostgreSQL — running locally or via Docker
  • An IDE — Visual Studio, VS Code, or JetBrains Rider
1

Clone the Repository

Open a terminal and clone the PharmaVault source code to your local machine.
git clone https://github.com/JReyna217/PharmaVault.git
cd PharmaVault
2

Create the Database

Connect to your PostgreSQL instance and run the database creation script. This creates the pharmavault_db database that all subsequent scripts and the application will target.
sql/00-CreateDataBase.sql
CREATE DATABASE pharmavault_db;
psql -U postgres -f sql/00-CreateDataBase.sql
3

Initialize the Schema

With the database created, connect to pharmavault_db and execute the schema initialization script. This creates all five tables the application depends on.
sql/01-InitSchema.sql
CREATE TABLE users (
    user_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    email VARCHAR(255) UNIQUE NOT NULL,
    password_hash VARCHAR(255) NOT NULL,
    full_name VARCHAR(100) NOT NULL,
    registration_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE medicine_catalog (
    catalog_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    name VARCHAR(250) NOT NULL,
    pharmaceutical_form VARCHAR(50) NOT NULL,
    dosage VARCHAR(50),
    is_active BOOLEAN DEFAULT TRUE
);

CREATE TABLE inventory (
    inventory_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    user_id INT NOT NULL REFERENCES users(user_id) ON DELETE CASCADE,
    catalog_id INT NOT NULL REFERENCES medicine_catalog(catalog_id),
    quantity INT NOT NULL DEFAULT 0,
    purchase_date DATE,
    expiration_date DATE NOT NULL,
    prescription_notes TEXT,
    date_added TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE system_responses (
    code VARCHAR(6) PRIMARY KEY,
    message_es TEXT NOT NULL,
    message_en TEXT NOT NULL
);

CREATE TABLE error_logs (
    log_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    origin_layer VARCHAR(15) NOT NULL,
    main_object VARCHAR(50) NOT NULL,
    method_name VARCHAR(50) NOT NULL,
    description VARCHAR(4000),
    error_message VARCHAR(4000) NOT NULL,
    error_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    user_id INT REFERENCES users(user_id) ON DELETE SET NULL,
    incident_number UUID DEFAULT gen_random_uuid() NOT NULL
);
psql -U postgres -d pharmavault_db -f sql/01-InitSchema.sql
The script creates the following tables:
TablePurpose
usersRegistered user accounts with hashed passwords
medicine_catalogMaster catalog of drug names, forms, and dosages
inventoryPer-user medication stock with quantities and expiration dates
system_responsesBilingual response codes for application messages
error_logsStructured error records with UUID-based incident tracking
4

Configure User Secrets

The connection string is intentionally excluded from source control. PharmaVault reads it at runtime from .NET’s Secret Manager. Run these two commands from the repository root:
# Initialize user secrets for the Web project
dotnet user-secrets init --project src/PharmaVault.Web

# Set your PostgreSQL connection string
dotnet user-secrets set "ConnectionStrings:DefaultConnection" \
  "Host=localhost;Database=pharmavault_db;Username=your_user;Password=your_password" \
  --project src/PharmaVault.Web
Replace your_user and your_password with your actual PostgreSQL credentials. The database name must match the one you created in Step 2 (pharmavault_db).
The secret is stored in your OS user profile and never written to the project directory, so it cannot be accidentally committed to version control.
5

Build and Run

From the repository root, build the solution and then start the web application.
dotnet build
You should see output similar to:
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5136
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
6

Open the App

Open your browser and navigate to the application. The default URLs defined in launchSettings.json are:
ProfileURL
httphttp://localhost:5136
httpshttps://localhost:7120
The application will launch to the login page. Register a new account to get started.
Hot Reload — For a faster development loop with automatic browser refresh on file saves, use dotnet watch instead of dotnet run:
dotnet watch --project src/PharmaVault.Web
Docker PostgreSQL alternative — If you prefer not to install PostgreSQL natively, you can spin up a container in seconds:
docker run -d \
  --name pharmavault-postgres \
  -e POSTGRES_USER=your_user \
  -e POSTGRES_PASSWORD=your_password \
  -e POSTGRES_DB=pharmavault_db \
  -p 5432:5432 \
  postgres:latest
Then use Host=localhost;Port=5432 in your user secret connection string and proceed with Steps 3 and 4 as normal.

Build docs developers (and LLMs) love