pharmacy-erp 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +38 -449
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,479 +1,68 @@
1
1
  <div align="center">
2
2
 
3
- <img src="img/logo.png" alt="Pharmacy ERP Logo" width="120" />
3
+ <img src="https://raw.githubusercontent.com/omersx/pharmacy-erp/main/img/logo.png" alt="Pharmacy ERP Logo" width="120" />
4
4
 
5
- # Pharmacy ERP & POS System
5
+ # Pharmacy ERP & POS System (CLI)
6
6
 
7
- **A modern, open-source Pharmacy ERP & Point of Sale system built for independent pharmacies, chains, and hospitals.**
7
+ **The interactive CLI to scaffold and launch the Pharmacy ERP system.**
8
8
 
9
- *Full Arabic (RTL) & English support · Designed for the Gulf/MENA market*
10
-
11
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
12
- [![CI](https://github.com/omersx/pharmacy-erp/actions/workflows/ci.yml/badge.svg)](https://github.com/omersx/pharmacy-erp/actions/workflows/ci.yml)
13
- [![Docker](https://img.shields.io/badge/Docker_Hub-images-2496ED?logo=docker&logoColor=white)](https://hub.docker.com/u/omersx)
14
9
  [![npm](https://img.shields.io/npm/v/pharmacy-erp?color=CB3837&logo=npm)](https://www.npmjs.com/package/pharmacy-erp)
15
- [![Python 3.12+](https://img.shields.io/badge/Python-3.12+-3776AB?logo=python&logoColor=white)](https://python.org)
16
- [![Node.js 18+](https://img.shields.io/badge/Node.js-18+-339933?logo=node.js&logoColor=white)](https://nodejs.org)
17
- [![FastAPI](https://img.shields.io/badge/FastAPI-0.115+-009688?logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com)
18
- [![Next.js 15](https://img.shields.io/badge/Next.js-15-000000?logo=next.js&logoColor=white)](https://nextjs.org)
19
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
20
-
21
- [Features](#-features) · [Quick Start](#-quick-start) · [Screenshots](#-screenshots) · [Architecture](#-architecture) · [API Docs](#-api-documentation) · [Docker](#-docker-deployment) · [Contributing](#-contributing)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/omersx/pharmacy-erp/blob/main/LICENSE)
22
11
 
23
12
  </div>
24
13
 
25
- ---
26
-
27
- ## ✨ Features
28
-
29
- <table>
30
- <tr>
31
- <td width="50%">
32
-
33
- ### 🏪 Point of Sale
34
- - Fullscreen, keyboard-first, touch-friendly POS
35
- - Barcode/search product lookup
36
- - Hold & recall sales
37
- - Split payments (cash, card, credit)
38
- - Receipt printing (PDF export)
39
-
40
- </td>
41
- <td width="50%">
42
-
43
- ### 💊 Medicine Management
44
- - Complete product catalog with categories
45
- - Batch tracking with expiry dates
46
- - FEFO (First Expiry, First Out) allocation
47
- - CSV/Excel bulk import
48
- - Low stock & expiry alerts
49
-
50
- </td>
51
- </tr>
52
- <tr>
53
- <td width="50%">
54
-
55
- ### 📦 Inventory & Purchasing
56
- - Append-only inventory ledger
57
- - Real-time stock levels per branch
58
- - Purchase orders & goods receipt
59
- - Supplier management & tracking
60
- - Automated stock alerts
61
-
62
- </td>
63
- <td width="50%">
64
-
65
- ### 💰 Sales & Cash Management
66
- - Sales invoices & returns
67
- - Cash session management (open/close)
68
- - Opening float & blind close
69
- - X-Report & Z-Report generation
70
- - Customer credit tracking
71
-
72
- </td>
73
- </tr>
74
- <tr>
75
- <td width="50%">
76
-
77
- ### 📊 Reports & Analytics
78
- - Sales reports (daily, weekly, monthly)
79
- - Inventory valuation reports
80
- - Profit & margin analysis
81
- - Top-selling products
82
- - Exportable to Excel/PDF
83
-
84
- </td>
85
- <td width="50%">
86
-
87
- ### 🌍 Enterprise Features
88
- - **Bilingual**: Full Arabic (RTL) + English
89
- - **Dark/Light Theme**: Premium UI design
90
- - **RBAC**: Role-based access control
91
- - **Multi-branch**: Branch management
92
- - **Responsive**: Desktop, tablet, & mobile
93
-
94
- </td>
95
- </tr>
96
- </table>
97
-
98
- ---
99
-
100
- ## 📸 Screenshots
101
-
102
- > **Coming soon** — Screenshots of the Dashboard, POS, Inventory, and Reports pages will be added here.
103
- >
104
- > Want to see the app in action? Follow the [Quick Start](#-quick-start) guide to run it locally in under 5 minutes!
105
-
106
- <!-- Uncomment and add your screenshots:
107
- <div align="center">
108
-
109
- | Dashboard | Point of Sale |
110
- |:---------:|:------------:|
111
- | ![Dashboard](img/screenshots/dashboard.png) | ![POS](img/screenshots/pos.png) |
112
-
113
- | Inventory | Reports |
114
- |:---------:|:-------:|
115
- | ![Inventory](img/screenshots/inventory.png) | ![Reports](img/screenshots/reports.png) |
116
-
117
- </div>
118
- -->
119
-
120
- ---
121
-
122
14
  ## 🚀 Quick Start
123
15
 
124
- ### Prerequisites
125
-
126
- | Tool | Version | Download |
127
- |------|---------|----------|
128
- | **Node.js** | 18+ | [nodejs.org](https://nodejs.org) |
129
- | **pnpm** | 9+ | `npm install -g pnpm` |
130
- | **Python** | 3.12+ | [python.org](https://python.org) |
131
-
132
- ### Option A: One-Command Setup
133
-
134
- <details>
135
- <summary><b>🪟 Windows</b></summary>
136
-
137
- ```batch
138
- git clone https://github.com/omersx/pharmacy-erp.git
139
- cd pharmacy-erp
140
- start.bat
141
- ```
142
-
143
- This will automatically:
144
- 1. Create the `.env` config file
145
- 2. Install all frontend & backend dependencies
146
- 3. Seed the database with demo data
147
- 4. Start both servers
148
-
149
- </details>
150
-
151
- <details>
152
- <summary><b>🐧 Linux / 🍎 macOS</b></summary>
16
+ The easiest way to install and start the Pharmacy ERP system is using our interactive CLI:
153
17
 
154
18
  ```bash
155
- git clone https://github.com/omersx/pharmacy-erp.git
156
- cd pharmacy-erp
157
- chmod +x start.sh
158
- ./start.sh
159
- ```
160
-
161
- </details>
162
-
163
- ### Option B: Step-by-Step
19
+ # 1. Scaffold the project (clones, installs, and seeds data automatically)
20
+ npx pharmacy-erp init
164
21
 
165
- ```bash
166
- # 1. Clone the repository
167
- git clone https://github.com/omersx/pharmacy-erp.git
22
+ # 2. Enter the directory
168
23
  cd pharmacy-erp
169
24
 
170
- # 2. Install root dependencies (concurrently)
171
- pnpm install
172
-
173
- # 3. Setup frontend
174
- pnpm run setup:frontend
175
-
176
- # 4. Setup backend (auto-detects Windows/Linux/macOS)
177
- pnpm run setup:backend
178
-
179
- # 5. Configure environment
180
- cp .env.example .env # Linux/macOS
181
- # copy .env.example .env # Windows
182
-
183
- # 6. Seed demo data
184
- pnpm run seed
185
-
186
- # 7. Start development servers
187
- pnpm dev
25
+ # 3. Start the application
26
+ npx pharmacy-erp start
188
27
  ```
189
28
 
190
- ### 🎉 You're Ready!
191
-
192
- | Service | URL |
193
- |---------|-----|
194
- | 🌐 **Frontend** | [http://localhost:3000](http://localhost:3000) |
195
- | 🔧 **Backend API** | [http://localhost:8000](http://localhost:8000) |
196
- | 📚 **API Docs (Swagger)** | [http://localhost:8000/docs](http://localhost:8000/docs) |
197
-
198
- ### Default Login
199
-
200
- | Role | Email | Password |
201
- |------|-------|----------|
202
- | Super Admin | `admin@pharmacy.com` | `admin123` |
203
-
204
- > ⚠️ **Change the default credentials** before deploying to production!
29
+ That's it! The application will start at:
30
+ - **Frontend:** http://localhost:3000
31
+ - **Backend API:** http://localhost:8000
32
+ - **API Docs:** http://localhost:8000/docs
205
33
 
206
34
  ---
207
35
 
208
- ## 🏗️ Architecture
36
+ ## 🛠️ CLI Commands
209
37
 
210
- ```mermaid
211
- graph TB
212
- subgraph Client
213
- A[Browser] -->|HTTP/HTTPS| B[Next.js Frontend]
214
- end
38
+ You can run these commands via `npx pharmacy-erp <command>` or inside your project directory if you have it installed globally.
215
39
 
216
- subgraph Frontend["Frontend Next.js 15"]
217
- B --> C[App Router]
218
- C --> D[POS Module]
219
- C --> E[ERP Dashboard]
220
- C --> F[Auth Pages]
221
- B --> G[Zustand Store]
222
- B --> H[next-intl i18n]
223
- end
40
+ | Command | Description |
41
+ |---------|-------------|
42
+ | `init` | Scaffolds a new Pharmacy ERP project in the current directory (clones, installs deps, seeds DB). |
43
+ | `start` | Starts the frontend and backend development servers simultaneously. |
44
+ | `setup` | Installs all required Node.js and Python dependencies. |
45
+ | `seed` | Seeds the database with demo products, users, and transactions. |
46
+ | `docker` | Starts the application in production mode using Docker Compose. |
47
+ | `help` | Shows the help menu with all available commands. |
224
48
 
225
- subgraph Backend["Backend — FastAPI"]
226
- I[API Gateway] --> J[Auth & RBAC]
227
- I --> K[Medicines]
228
- I --> L[Inventory]
229
- I --> M[Sales & POS]
230
- I --> N[Purchases]
231
- I --> O[Customers]
232
- I --> P[Cash Sessions]
233
- I --> Q[Reports]
234
- I --> R[Admin & Audit]
235
- end
49
+ ## 📦 Prerequisites
236
50
 
237
- subgraph Data["Data Layer"]
238
- S[(SQLite / PostgreSQL)]
239
- end
51
+ Before running the CLI, ensure you have the following installed on your system:
240
52
 
241
- B -->|REST API| I
242
- J --> S
243
- K --> S
244
- L --> S
245
- M --> S
246
- N --> S
247
- O --> S
248
- P --> S
249
- Q --> S
250
- R --> S
251
- ```
53
+ - **Node.js 18+** ([nodejs.org](https://nodejs.org))
54
+ - **pnpm 9+** (`npm install -g pnpm`)
55
+ - **Python 3.12+** ([python.org](https://python.org))
56
+ - **Git** ([git-scm.com](https://git-scm.com))
252
57
 
253
- ### Project Structure
58
+ ## 🌐 Features of Pharmacy ERP
254
59
 
255
- ```
256
- pharmacy-erp/
257
- ├── frontend/ # Next.js 15 (App Router)
258
- │ ├── src/
259
- │ │ ├── app/ # Routes & pages
260
- │ │ │ └── [locale]/ # i18n routing (en, ar)
261
- │ │ │ ├── (app)/ # ERP dashboard pages
262
- │ │ │ ├── (auth)/ # Login / register
263
- │ │ │ └── (pos)/ # Point of Sale
264
- │ │ ├── components/ # Reusable UI components
265
- │ │ │ ├── ui/ # Base components (Radix UI)
266
- │ │ │ └── pos/ # POS-specific components
267
- │ │ ├── lib/ # API client, utilities
268
- │ │ ├── store/ # Zustand state stores
269
- │ │ ├── messages/ # i18n translations (en.json, ar.json)
270
- │ │ └── i18n/ # i18n configuration
271
- │ ├── Dockerfile
272
- │ └── package.json
273
-
274
- ├── backend/ # FastAPI (Python 3.12)
275
- │ ├── app/
276
- │ │ ├── core/ # Config, database, security, exceptions
277
- │ │ ├── modules/ # Business logic modules
278
- │ │ │ ├── auth/ # Authentication & JWT
279
- │ │ │ ├── users/ # User management
280
- │ │ │ ├── roles/ # RBAC roles & permissions
281
- │ │ │ ├── organizations/# Branch management
282
- │ │ │ ├── medicines/ # Product catalog & batches
283
- │ │ │ ├── inventory/ # Stock movements & ledger
284
- │ │ │ ├── sales/ # Invoices, returns, held sales
285
- │ │ │ ├── purchases/ # Purchase orders
286
- │ │ │ ├── suppliers/ # Supplier management
287
- │ │ │ ├── customers/ # Customer & credit management
288
- │ │ │ ├── cash_sessions/# Cash register sessions
289
- │ │ │ ├── reports/ # Analytics & reporting
290
- │ │ │ ├── notifications/# System notifications
291
- │ │ │ └── admin/ # Audit logs & admin tools
292
- │ │ ├── main.py # FastAPI application entry
293
- │ │ └── seed.py # Demo data seeder
294
- │ ├── Dockerfile
295
- │ └── requirements.txt
296
-
297
- ├── nginx/ # Nginx reverse proxy config
298
- ├── img/ # Logo and brand assets
299
- ├── docker-compose.yml # Production deployment
300
- ├── package.json # Root orchestration scripts
301
- ├── start.bat # One-click setup (Windows)
302
- ├── start.sh # One-click setup (Linux/macOS)
303
- ├── .env.example # Environment template
304
- └── README.md
305
- ```
306
-
307
- ---
308
-
309
- ## 🖥️ Tech Stack
310
-
311
- | Layer | Technologies |
312
- |-------|-------------|
313
- | **Frontend** | [Next.js 15](https://nextjs.org) · [React 19](https://react.dev) · [TypeScript](https://typescriptlang.org) · [Tailwind CSS](https://tailwindcss.com) |
314
- | **UI Components** | [Radix UI](https://radix-ui.com) · [Lucide Icons](https://lucide.dev) · [Framer Motion](https://framer.com/motion) · [Recharts](https://recharts.org) |
315
- | **State & i18n** | [Zustand](https://zustand-demo.pmnd.rs) · [next-intl](https://next-intl-docs.vercel.app) |
316
- | **Backend** | [FastAPI](https://fastapi.tiangolo.com) · [Python 3.12](https://python.org) · [Pydantic v2](https://docs.pydantic.dev) · [SQLAlchemy 2](https://sqlalchemy.org) |
317
- | **Database** | [SQLite](https://sqlite.org) (dev) · [PostgreSQL](https://postgresql.org) (production) |
318
- | **Auth** | JWT (httpOnly cookies) · [Argon2](https://github.com/P-H-C/phc-winner-argon2) password hashing |
319
- | **DevOps** | [Docker](https://docker.com) · [Nginx](https://nginx.org) · [Uvicorn](https://uvicorn.org) |
320
-
321
- ---
60
+ - **Point of Sale (POS)**: Fullscreen, keyboard-first, touch-friendly POS.
61
+ - **Inventory & Purchasing**: Expiry tracking, batch management, FEFO.
62
+ - **Bilingual**: Full Arabic (RTL) & English support out of the box.
63
+ - **Modern Tech Stack**: Next.js 15, FastAPI, Python 3.12, Tailwind CSS.
322
64
 
323
- ## 📖 API Documentation
65
+ ## 🔗 Links
324
66
 
325
- Once the backend is running, interactive API documentation is available at:
326
-
327
- | Format | URL |
328
- |--------|-----|
329
- | **Swagger UI** | [http://localhost:8000/docs](http://localhost:8000/docs) |
330
- | **ReDoc** | [http://localhost:8000/redoc](http://localhost:8000/redoc) |
331
-
332
- ### API Modules
333
-
334
- | Endpoint Prefix | Module | Description |
335
- |----------------|--------|-------------|
336
- | `/api/v1/auth` | Authentication | Login, register, refresh tokens |
337
- | `/api/v1/medicines` | Medicines | CRUD, batches, categories, import |
338
- | `/api/v1/inventory` | Inventory | Stock movements, alerts, ledger |
339
- | `/api/v1/sales` | Sales | Invoices, returns, held sales |
340
- | `/api/v1/cash-sessions` | Cash Sessions | Open, close, X/Z reports |
341
- | `/api/v1/customers` | Customers | Customer management, credit |
342
- | `/api/v1/suppliers` | Suppliers | Supplier directory |
343
- | `/api/v1/branches` | Branches | Multi-branch management |
344
- | `/api/v1/reports` | Reports | Sales, inventory, profit analytics |
345
- | `/api/v1/users` | Users | User management |
346
- | `/api/v1/roles` | Roles | RBAC roles & permissions |
347
- | `/api/v1/admin` | Admin | Audit logs, system admin |
348
- | `/api/v1/notifications` | Notifications | System notifications |
349
-
350
- ---
351
-
352
- ## 🐳 Docker Deployment
353
-
354
- ### Quick Deploy (from Docker Hub)
355
-
356
- ```bash
357
- # Pull pre-built images and start
358
- docker compose up -d
359
-
360
- # This starts:
361
- # - FastAPI backend → port 8000
362
- # - Next.js frontend → port 3000
363
- # - Nginx proxy → port 80
364
- ```
365
-
366
- Or pull images individually:
367
-
368
- ```bash
369
- docker pull omersx/pharmacy-erp-backend:latest
370
- docker pull omersx/pharmacy-erp-frontend:latest
371
- ```
372
-
373
- ### Build from Source (for contributors)
374
-
375
- ```bash
376
- docker compose -f docker-compose.dev.yml up --build
377
- ```
378
-
379
- ### Production Checklist
380
-
381
- - [ ] Change `SECRET_KEY` to a strong random value (32+ characters)
382
- - [ ] Change default admin credentials
383
- - [ ] Set `APP_ENV=production` and `DEBUG=false`
384
- - [ ] Switch database to PostgreSQL
385
- - [ ] Configure proper `CORS_ORIGINS`
386
- - [ ] Enable HTTPS via reverse proxy
387
- - [ ] Set up automated backups
388
-
389
- ---
390
-
391
- ## ⚙️ Environment Variables
392
-
393
- | Variable | Description | Default |
394
- |----------|-------------|---------|
395
- | `APP_NAME` | Application name | `Pharmacy ERP` |
396
- | `APP_ENV` | Environment (`development` / `production`) | `development` |
397
- | `DEBUG` | Enable debug mode | `true` |
398
- | `DATABASE_URL` | Database connection string | `sqlite+aiosqlite:///./data/pharmacy.db` |
399
- | `SECRET_KEY` | JWT signing key (change in production!) | `dev-secret-key-...` |
400
- | `ACCESS_TOKEN_EXPIRE_MINUTES` | Access token TTL | `30` |
401
- | `REFRESH_TOKEN_EXPIRE_DAYS` | Refresh token TTL | `7` |
402
- | `CORS_ORIGINS` | Allowed CORS origins (comma-separated) | `http://localhost:3000` |
403
- | `NEXT_PUBLIC_API_URL` | API URL for the frontend | `http://localhost:8000/api/v1` |
404
- | `REDIS_URL` | Redis URL (optional, for production) | — |
405
- | `UPLOAD_DIR` | File upload directory | `./data/uploads` |
406
- | `MAX_UPLOAD_SIZE_MB` | Max upload file size | `10` |
407
-
408
- See [`.env.example`](.env.example) for the full template.
409
-
410
- ---
411
-
412
- ## 🌍 Internationalization
413
-
414
- Pharmacy ERP ships with complete support for:
415
-
416
- | Language | Direction | Status |
417
- |----------|-----------|--------|
418
- | 🇬🇧 English | LTR (Left-to-Right) | ✅ Complete |
419
- | 🇸🇦 العربية (Arabic) | RTL (Right-to-Left) | ✅ Complete |
420
-
421
- Switch languages from any page — the entire UI, including layout direction, updates instantly.
422
-
423
- **Adding a new language:**
424
-
425
- 1. Create a new translation file: `frontend/src/messages/<locale>.json`
426
- 2. Add the locale to `frontend/src/i18n/` configuration
427
- 3. All strings are externalized — no hardcoded text in components
428
-
429
- ---
430
-
431
- ## 🤝 Contributing
432
-
433
- We love contributions! Whether it's fixing bugs, adding features, improving docs, or suggesting ideas — all contributions are welcome.
434
-
435
- 1. **Fork** the repository
436
- 2. **Create** a feature branch: `git checkout -b feature/amazing-feature`
437
- 3. **Commit** your changes: `git commit -m 'feat: add amazing feature'`
438
- 4. **Push** to the branch: `git push origin feature/amazing-feature`
439
- 5. **Open** a Pull Request
440
-
441
- Please read our [Contributing Guide](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md) before getting started.
442
-
443
- ---
444
-
445
- ## 🗺️ Roadmap
446
-
447
- - [ ] 📱 Mobile app (React Native)
448
- - [ ] 🔌 Barcode scanner hardware integration
449
- - [ ] 📊 Advanced analytics dashboard
450
- - [ ] 🏥 Insurance claims module
451
- - [ ] 💳 Payment gateway integration
452
- - [ ] 📧 Email notifications & alerts
453
- - [ ] 🔄 Real-time sync across branches
454
- - [ ] 📋 Prescription management
455
- - [ ] 🧪 Lab integration module
456
-
457
- Have a feature idea? [Open a feature request!](../../issues/new?template=feature_request.md)
458
-
459
- ---
460
-
461
- ## ⭐ Show Your Support
462
-
463
- If this project helps you, give it a ⭐ on GitHub — it means a lot and helps others discover it!
464
-
465
- ---
466
-
467
- ## 📄 License
468
-
469
- This project is licensed under the **MIT License** — see the [LICENSE](LICENSE) file for details.
470
-
471
- ---
472
-
473
- <div align="center">
474
-
475
- **Built with ❤️ for pharmacies everywhere**
476
-
477
- [Report Bug](../../issues/new?template=bug_report.md) · [Request Feature](../../issues/new?template=feature_request.md) · [Contribute](CONTRIBUTING.md)
478
-
479
- </div>
67
+ - **GitHub Repository**: [omersx/pharmacy-erp](https://github.com/omersx/pharmacy-erp)
68
+ - **Report an Issue**: [GitHub Issues](https://github.com/omersx/pharmacy-erp/issues)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pharmacy-erp",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Pharmacy ERP & POS System — Enterprise-grade pharmacy management with full Arabic (RTL) and English support",
5
5
  "bin": {
6
6
  "pharmacy-erp": "./bin/cli.js"