{"id":49801522,"url":"https://github.com/md8-habibullah/medistore_server","last_synced_at":"2026-05-12T14:43:16.115Z","repository":{"id":336684445,"uuid":"1149113793","full_name":"md8-habibullah/medistore_server","owner":"md8-habibullah","description":"A modern, robust backend API for the mediStore e-commerce platform. Built with Node.js, Express, TypeScript, Prisma, and PostgreSQL.","archived":false,"fork":false,"pushed_at":"2026-04-21T06:03:05.000Z","size":304,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-21T08:11:31.808Z","etag":null,"topics":["backend-development","better-auth","ecommerce-backend","expressjs","medistore","nodejs","postgresql","prisma-orm","rbac","rest-api","typescript"],"latest_commit_sha":null,"homepage":"https://medi-server.habibullah.dev/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/md8-habibullah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-03T18:30:17.000Z","updated_at":"2026-04-21T06:03:08.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/md8-habibullah/medistore_server","commit_stats":null,"previous_names":["md8-habibullah/medistore_server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/md8-habibullah/medistore_server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/md8-habibullah%2Fmedistore_server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/md8-habibullah%2Fmedistore_server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/md8-habibullah%2Fmedistore_server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/md8-habibullah%2Fmedistore_server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/md8-habibullah","download_url":"https://codeload.github.com/md8-habibullah/medistore_server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/md8-habibullah%2Fmedistore_server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32944276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T09:19:52.626Z","status":"ssl_error","status_checked_at":"2026-05-12T09:17:33.438Z","response_time":102,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend-development","better-auth","ecommerce-backend","expressjs","medistore","nodejs","postgresql","prisma-orm","rbac","rest-api","typescript"],"created_at":"2026-05-12T14:43:15.249Z","updated_at":"2026-05-12T14:43:16.100Z","avatar_url":"https://github.com/md8-habibullah.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mediStore Server\n\nA modern and smart backend application built for the **mediStore** e-commerce platform. This robust server handles everything from inventory management to user authentication and order processing, providing a seamless data layer for the frontend client.\n\n## Tech Stack\n\nThis project utilizes a modern web development stack to ensure scalability, type safety, and efficient data handling:\n\n- **Runtime:** Node.js\n- **Framework:** Express.js\n- **Language:** TypeScript\n- **Database:** PostgreSQL (Advanced open-source relational DBMS - Database Management System)\n- **ORM (Object-Relational Mapping):** Prisma\n- **Authentication:** Better-Auth\n- **Package Manager:** pnpm\n\n## Core Architecture \u0026 Features\n\nThe server is built using modular routing and a well-defined schema, making it easy to maintain and scale.\n\n- **Role-Based Access Control (RBAC):** Users are categorized into `CUSTOMER`, `SELLER`, and `ADMIN` roles, allowing for strict endpoint protection.\n- **Authentication:** Managed via `better-auth`, handling secure sessions, tokens, and user verification via the `/api/auth` routes.\n- **Relational Data Management:** The Prisma schema defines clear relationships between `Category`, `Medicine`, `Order`, `OrderItem`, `Review`, and `User` models.\n- **CORS (Cross-Origin Resource Sharing):** Configured to accept requests smoothly from the frontend URL (`http://localhost:3000` by default).\n\n## Getting Started\n\nFollow these steps to set up the development environment locally.\n\n### Prerequisites\n\n- Node.js installed\n- PostgreSQL database running\n- `pnpm` package manager installed globally\n\n## Frontend Client\n\nThe user interface for this backend API is managed in a separate repository. You can explore the frontend codebase here:\n[mediStore Client Repository](https://github.com/md8-habibullah/medistore_client.git)\n\n### Installation\n\n1. **Clone the repository:**\n\n```bash\n  git clone https://github.com/md8-habibullah/medistore_server.git\n  cd medistore_server\n```\n\n2. **Install dependencies:**\n\n```bash\n  pnpm install\n\n```\n\n3. **Environment Setup:**\n   Create a `.env` file in the root directory (refer to `.env.example` if available) and add your environment variables:\n\n```env\nPORT=5000\nDATABASE_URL=\"postgresql://user:password@localhost:5432/medistore\"\nFRONTEND_APP_URL=\"http://localhost:3000\"\n\n```\n\n4. **Database Migration \u0026 Generation:**\n   Sync the Prisma ORM with your PostgreSQL database:\n\n```bash\npnpm prisma generate\npnpm prisma db push\n\n```\n\n5. **Seed the Database:**\n   Populate the database with initial categories or admin accounts:\n\n```bash\npnpm run seed\n\n```\n\n6. **Start the Development Server:**\n\n```bash\npnpm run dev\n\n```\n\nThe server will start running at `http://localhost:5000`.\n\n## API (Application Programming Interface) Routes\n\nThe server exposes the following main HTTP (Hypertext Transfer Protocol) endpoints under the `` prefix:\n\n- `GET /` - Root health check endpoint.\n- `ANY /api/auth/*` - Handles all authentication and session creation.\n- `USE /medicine` - Medicine inventory, search, and management.\n- `USE /orders` - Order placement and status tracking.\n- `USE /reviews` - Product ratings and user comments.\n- `USE /users` - User profile and account management.\n\n## Scripts\n\n- `pnpm run dev`: Starts the server in watch mode using `tsx` for rapid development.\n- `pnpm run build`: Generates the Prisma client and compiles the TypeScript code into minified ES Modules using `tsup`.\n- `pnpm start`: Runs the compiled production code.\n\n---\n\n### Glossary of Short-forms\n\n- **API:** Application Programming Interface - A set of rules that allows different software applications to communicate with each other.\n- **ORM:** Object-Relational Mapping - A programming technique to convert data between incompatible type systems (like JavaScript objects and SQL databases).\n- **CORS:** Cross-Origin Resource Sharing - A security feature that restricts or allows web applications running at one origin to interact with resources from a different origin.\n- **JSON:** JavaScript Object Notation - A lightweight format for storing and transporting data.\n- **HTTP:** Hypertext Transfer Protocol - The foundation of data communication for the World Wide Web.\n- **ESM:** ECMAScript Modules - The official standard format to package JavaScript code for reuse.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmd8-habibullah%2Fmedistore_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmd8-habibullah%2Fmedistore_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmd8-habibullah%2Fmedistore_server/lists"}