Skip to content

A backend system for an online medicine store, built with love, Go and PostgreSQL

License

Notifications You must be signed in to change notification settings

Dhar01/MediTrust

Repository files navigation

πŸ₯ 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

    go version
  2. Install PostgreSQL

    psql --version

πŸ” Environment Variables

Create a .env file in the root directory with the following variables:

DB_URL="postgres://<username>:<password>@<host>:<port>/<database_name>"
SECRET_KEY="Your Secret Key here"
PLATFORM="<environment>"

SMTP_HOST="<SMTP server host>"
SMTP_PORT="<SMTP server port>"
SMTP_USER="<SMTP username>"
SMTP_PASS="<SMTP password>"

EMAIL_FROM="example.localhost.com"
DOMAIN="localhost"
PORT="<preferred-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

  • User Signup
  • User Login
  • Email verification
  • User Logout
  • Token Refresh
  • Token Revoke
  • Password Reset (via email)
  • Role-based Access control (User/Admin)

Product Management (Medicines)

  • Create medicine (admin)
  • Get all medicine
  • Get medicine by ID
  • Update medicine by ID (admin)
  • Delete medicine by ID (admin)
  • Medicine categories & Tags
  • Search & Filter medicines
  • Pagination for large medicine lists

User Profile & Management

  • Get user by ID (admin)
  • Update user profile
  • Delete user
  • View order history

Cart & Wishlist

  • Add medicine to cart
  • Remove medicine from cart
  • Save medicine to wishlist
  • Remove medicine from wishlist

Checkout & Payment

  • Order placement (store order details)
  • Integrate Payment Gateway
  • Discounts & Promo codes

Order Management

  • Order Tracking
  • Cancel Orders
  • Return & Refund System

Admin Panel

  • Manage users (Get, Delete)
  • Manage medicines (CRUD)
  • Manage orders (CRUD)
  • Generate Reports & Statistics

Security & Compliance

  • implement Rate Limiting & Throttling
  • implement Logging & Monitoring
  • Ensure GDPR & Data Protection Compliance

General

  • Reset DB (DEV environment only)

πŸ“– Documentation

Experimental

Run the project and see the documentation at http://localhost:8080/api/v1/swagger/index.html.

πŸš€ Status

code coverage badge

About

A backend system for an online medicine store, built with love, Go and PostgreSQL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published