Medistream is a backend service for managing healthcare operations such as:
- User & Role Management (Doctors, Patients, Admins)
- Medical Records & Prescriptions
- Vitals & Reports
- Appointments & Scheduling
- Authentication & Authorization (JWT-based)
- Rate Limiting & Request Metrics (Prometheus + Redis)
Built with Go + Gin + PostgreSQL + Redis, Medistream is structured for scalability, modularity, and performance.
- Language: Go 1.22+
- Framework: Gin
- Database: PostgreSQL + GORM
- Cache: Redis
- Metrics: Prometheus
- Auth: JWT (access & refresh tokens)
- Migrations: Raw SQL with migration scripts using goose
├── cmd/ # Application entrypoint
├── config/ # Database & Redis configuration
├── controllers/ # Request handlers (appointments, auth, vitals, etc.)
├── metrics/ # Prometheus metrics setup
├── middleware/ # Auth, rate limiting, metrics middleware
├── migrations/ # SQL migration files
├── models/ # GORM models (User, Patient, Doctor, Vitals, etc.)
├── routes/ # Route registration
├── scripts/ # Utility scripts (migrations, etc.)
├── services/ # Business logic (cache, ratelimiter, etc.)
├── tests/ # API tests, factories, helpers
└── utils/ # Helpers (JWT, logger, context utils, etc.)
- Go 1.22+
- PostgreSQL 14+
- Redis 7+
- Goose (use the provided migration script in scripts/migrate.sh)
git clone https://github.com/<your-username>/medistream.git
cd medistream
go mod tidy
DATABASE_URL=postgres://user:password@localhost:5432/medistream?sslmode=disable
REDIS_URL=redis://localhost:6379
JWT_SECRET=supersecret
PORT=8080
./scripts/migrate.sh up
./scripts/migrate.sh upgo run cmd/main.go
go test ./tests/... -v- Exposes Prometheus metrics under /metrics.
- Tracks DB queries,request timings,cache hits and misses
- JWT Access & Refresh tokens
- RBAC (DOCTOR, PATIENT, ADMIN)
- Add support for notifications (email/SMS)
- Expand reporting & analytics
- Containerize with Docker & Helm (K8s support)
- CI/CD pipeline integration
- Contributions are welcome! Please fork the repo, create a branch, and submit a PR.