Skip to content

arvtia/BackendServices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pharmacy Management System API 💊

A robust, secure, and scalable backend API for managing a pharmacy's inventory, sales, and users. Built with Go and the Gin framework.

🚀 Features

  • Authentication & Authorization: Role-based access control (Admin, Pharmacist, Customer) using JWT.
  • Inventory Management: Full CRUD operations for medicines, including batch tracking and expiry dates.
  • Advanced Search: Fuzzy search functionality to find medicines by name, category, or manufacturer.
  • Sales & Orders: Automated stock deduction upon purchase with transaction history.
  • Smart Reporting: Low-stock alerts and sales performance tracking.
  • Data Integrity: Auto-migrating SQLite database schema.

🛠️ Tech Stack

  • Language: Go (Golang)
  • Framework: Gin Gonic (HTTP Web Framework)
  • Database: SQLite (with GORM-ready structure)
  • Security: JWT (JSON Web Tokens) & Bcrypt password hashing

📂 Project Structure

├── cmd/
│   └── api/            # Application entry point (main.go)
├── internal/
│   ├── auth/           # JWT and Password logic
│   ├── database/       # DB connection and migrations
│   ├── handlers/       # Request controllers
│   ├── middleware/     # Role-based protection
│   └── models/         # Database schemas
├── pharma.db           # SQLite database (ignored by git)
└── .env                # Configuration (ignored by git)

⚙️ Installation & Setup

  1. Clone the repository:
git clone [https://github.com/arvtia/BackendServices.git](https://github.com/arvtia/BackendServices.git)
cd BackendServices
  1. Install dependencies:
go mod tidy
  1. Configure Environment Variables: Create a .env file in the root directory:
PORT=8080
JWT_SECRET=your_super_secret_key
DB_PATH=pharma.db
  1. Run the application:
go run cmd/api/main.go

🔌 API Endpoints (Quick Reference)

Method Endpoint Access Description
POST /api/v1/auth/register Public Create a new account
POST /api/v1/auth/login Public Get JWT Token
GET /api/v1/medicines/search All Roles Search inventory
POST /api/v1/orders Customer Place a new order
GET /api/admin/reports/low-stock Admin Check inventory alerts
PATCH /api/admin/medicines/:id Admin Partial update of medicine

Developed by arvtia




### How to push this to your GitHub:

Since this is a new file, you need to tell Git to upload it:

1.  **Stage the file**:
    ```bash
    git add README.md
    ```
2.  **Commit it**:
    ```bash
    git commit -m "Docs: Added professional README with setup instructions"
    ```
3.  **Push it**:
    ```bash
    git push
    ```


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages