Fast and reliable backend for an online pharmacy, powered by Go and PostgreSQL.
This project uses Go and PostgresSQL. Please ensure to set them up before proceeding.
-
Install Go
- Download and install Go from the official Go website.
- Verify installation:
go version
-
Install PostgreSQL
- Install PostgreSQL from the official PostgreSQL website.
- Verify Installation:
psql --version
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.
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 |
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 |
name | method | route | note |
---|---|---|---|
reset DB | POST | /api/v1/reset | dev environment only |
Goal is to achieve MVP
- User Signup
- User Login
- Email verification
- User Logout
- Token Refresh
- Token Revoke
- Password Reset (via email)
- Role-based Access control (User/Admin)
- 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
- Get user by ID (admin)
- Update user profile
- Delete user
- View order history
- Add medicine to cart
- Remove medicine from cart
- Save medicine to wishlist
- Remove medicine from wishlist
- Order placement (store order details)
- Integrate Payment Gateway
- Discounts & Promo codes
- Order Tracking
- Cancel Orders
- Return & Refund System
- Manage users (Get, Delete)
- Manage medicines (CRUD)
- Manage orders (CRUD)
- Generate Reports & Statistics
- implement Rate Limiting & Throttling
- implement Logging & Monitoring
- Ensure GDPR & Data Protection Compliance
- Reset DB (DEV environment only)
Experimental
Run the project and see the documentation at http://localhost:8080/api/v1/swagger/index.html
.