https://github.com/dhar01/meditrust
A backend system for an online pharmacy, built with love, Go and PostgreSQL
https://github.com/dhar01/meditrust
backend-api ecommerce gin-gonic go postgresql sqlc swagger
Last synced: 2 months ago
JSON representation
A backend system for an online pharmacy, built with love, Go and PostgreSQL
- Host: GitHub
- URL: https://github.com/dhar01/meditrust
- Owner: Dhar01
- License: gpl-3.0
- Created: 2024-11-17T16:31:46.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-20T19:22:49.000Z (10 months ago)
- Last Synced: 2025-03-20T20:49:43.851Z (10 months ago)
- Topics: backend-api, ecommerce, gin-gonic, go, postgresql, sqlc, swagger
- Language: Go
- Homepage: https://dhar01.github.io/MediTrust/
- Size: 331 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🏥 MediTrust
Fast and reliable backend for an online pharmacy, powered by Go and PostgreSQL.
## ⚙️ SetUp
This project uses Go and PostgresSQL. Please ensure to set them up before proceeding.
1. Install Go
- Download and install Go from the [official Go website](https://go.dev/dl/).
- Verify installation:
```bash
go version
```
2. Install PostgreSQL
- Install PostgreSQL from the [official PostgreSQL website](https://www.postgresql.org/download/).
- Verify Installation:
```bash
psql --version
````
## 🔐 Environment Variables
Create a `.env` file in the root directory with the following variables:
```env
DB_URL="postgres://:@:/"
SECRET_KEY="Your Secret Key here"
PLATFORM=""
SMTP_HOST=""
SMTP_PORT=""
SMTP_USER=""
SMTP_PASS=""
EMAIL_FROM="example.localhost.com"
DOMAIN="localhost"
PORT=""
```
- Replace the `DB_URL` values with your database connection string.
- Currently available platform is `"deb"`.
Find `db_migration.sh` in the `scripts` to automate DB migration.
# 📌 API-endpoints
### 💊 Medicine
| name | method | route | note |
| :-------------------- | :----: | :----------------------- | ------------ |
| create medicine | POST | /api/v1/medicines | *admin only* |
| get all medicine | GET | /api/v1/medicines |
| get medicine by ID | GET | /api/v1/medicines/:medID |
| update medicine by ID | PUT | /api/v1/medicines/:medID | *admin only* |
| delete medicine by ID | DELETE | /api/v1/medicines/:medID | *admin only* |
### 👤 Users
| name | method | route | note |
| :------------- | :----: | -------------------------- | ---------------- |
| get user by ID | GET | /api/v1/users/:userID | *admin only* |
| signup user | POST | /api/v1/signup |
| login user | POST | /api/v1/login |
| verify user | GET | /api/v1/verify?token=token | *auto-generated* |
| update user | PUT | /api/v1/users |
| logout user | POST | /api/v1/logout |
| delete user | DELETE | /api/v1/users |
| refresh token | POST | /api/v1/refresh |
| revoke token | POST | /api/v1/revoke |
### 🔄 General
| name | method | route | note |
| -------- | ------ | ------------- | ---------------------- |
| reset DB | POST | /api/v1/reset | *dev* environment only |
# ✅ To-Do
> Goal is to achieve MVP
### Authentication & Authorization
- [x] User Signup
- [x] User Login
- [x] Email verification
- [x] User Logout
- [x] Token Refresh
- [x] Token Revoke
- [x] Password Reset (*via email*)
- [ ] Role-based Access control (*User/Admin*)
### Product Management (Medicines)
- [x] Create medicine (*admin*)
- [x] Get all medicine
- [x] Get medicine by ID
- [x] Update medicine by ID (*admin*)
- [x] Delete medicine by ID (*admin*)
- [ ] Medicine categories & Tags
- [ ] Search & Filter medicines
- [ ] Pagination for large medicine lists
### User Profile & Management
- [x] Get user by ID (*admin*)
- [x] Update user profile
- [x] Delete user
- [ ] View order history
### Cart & Wishlist
- [x] Add medicine to cart
- [x] Get/Fetch cart
- [x] Remove medicine from cart
- [x] Remove/Delete the Cart
### Checkout & Payment
- [ ] Order placement (*store order details*)
- [ ] Integrate Payment Gateway
- [ ] Discounts & Promo codes
### Order Management
- [ ] Order Tracking
- [ ] Cancel Orders
- [ ] Return & Refund System
### Admin Panel
- [x] Manage users (*Get, Delete*)
- [x] Manage medicines (CRUD)
- [ ] Manage orders (CRUD)
- [ ] Generate Reports & Statistics
### Security & Compliance
- [ ] implement Rate Limiting & Throttling
- [ ] implement Logging & Monitoring
- [ ] Ensure GDPR & Data Protection Compliance
### General
- [x] Reset DB (*DEV environment only*)
# 📖 Documentation
> Experimental
Run the project and see the documentation at `http://localhost:8080/api/v1/swagger/index.html`.
Live version of github pages hosted [here](https://dhar01.github.io/MediTrust/)
# Entity-Relationship Diagram

# 🚀 Status
