MedicBD is a hybrid Ruby on Rails application that started as an API-only backend and is now evolving into a full-stack Rails app using Hotwire & Tailwind.
-
Clean API design with JWT authentication
-
A safe transition from API-only → full-stack Rails
-
Clear separation between API and Web layers
-
Modern Rails 7 tooling (Hotwire, Tailwind, Importmap)
- Ruby on Rails
- PostgreSQl
API (v1)-
-
Doctors, Specializations, Chambers, Districts
-
Filter doctors by specialization & district
-
JWT-based authentication
-
Designed for React / mobile clients
Web (Full-Stack Rails)-
-
Server-rendered HTML (ERB)
-
Hotwire (Turbo + Stimulus)
-
Tailwind CSS
-
Session-based authentication (planned)
This project was intentionally developed in phases:
- Rails API-only mode
- JWT authentication
- JSON endpoints for doctors, chambers, districts, and feedback
- Designed to support React and mobile clients
- Stable and production-ready
A snapshot of this stage is preserved in the v1.0-api branch.
- Transitioned to full-stack Rails
- Introduced Web controllers alongside API controllers
- Added Hotwire (Turbo + Stimulus)
- Tailwind CSS for UI
- API v1 remains unchanged
Controller Separation (Core Design)
ApplicationController < ActionController::Base
└── Web::BaseController
├── Web::HomeController
└── Web::DoctorsController
Api::BaseController < ActionController::API
└── Api::V1::DoctorsController
Api::BaseController < ActionController::API </br>
└── Api::V1::DoctorsController # JSON / JWT
### Why This Matters
----------------------------------
Concern API Web
----- ------- ---------------
State Stateless Stateful
Auth JWT Session + Cookies
CSRF Not needed Required
Views ❌ ✅
-
API backward-compatible
-
Web layer free to evolve
-
Zero cross-contamination of concerns
Ruby & Node check:
ruby --version
node --version
Install dependencies:
bundle install
npm install
rails db:create
rails db:migrate
rails db:fixtures:load
For specific environments:
RAILS_ENV=test rails db:create
RAILS_ENV=production rails db:migrate
bin/dev
**Important- bin/dev runs Rails and the Tailwind build watcher. rails s alone will NOT compile CSS.
API-only branches:
rails s
🧪 Running Tests:
rails test
-Safe experimentation -API stability -Clear evolution history
Base URL:
Examples:
Endpoint Method
/auth/login POST
/specializations GET
/doctors GET/POST
/doctors/:id GET
/doctors/filtered_doctors GET
/chambers GET
/districts GET
👉 Full payload examples are documented in docs/api.md
Tailwind not updating?
Use: bin/dev
Tailwind is build-time, not runtime.
JWT auth removed from ApplicationController?
Correct.
API auth belongs in Api::BaseController
Web uses sessions + CSRF
🔭 Future Roadmap-Shared service object for filtered_doctors
-Turbo-powered filters
-Stimulus carousel for doctor sliders
-Appointment booking (full-stack)
🧠 What This Project Demonstrates
✔ Rails controller inheritance mastery ✔ JWT vs session authentication knowledge ✔ Safe refactoring mindset ✔ Hotwire done intentionally, not blindly ✔ Production-quality thinking
Md Arafat Hossain
- GitHub: HossainAraf
- LinkedIn: Md. Arafat Hossain
📄 License MIT License — see root/LICENSE.md
-Family support -Microverse — structure, standards, and discipline