Overview
MinistryHub is built with a “The Right Tool for the Right Task” philosophy, combining modern frontend technologies with a robust backend architecture designed for performance and security.Frontend Stack
Core Framework
React 19 with TypeScript- Latest stable React version with strict typing
- Enhanced type safety and developer experience
- Modern hooks and concurrent features
- Ultra-fast development server with HMR (Hot Module Replacement)
- Optimized production builds with code splitting
- Native ES modules support
frontend/package.json
Routing & State
React Router 7- Client-side routing for SPA experience
- Protected route handling
- Seamless navigation without page reloads
UI & Styling
Vanilla CSS with CSS Variables- Custom design system with no CSS framework dependencies
- Native Dark Mode support via CSS variables
- Glassmorphism effects and premium micro-animations
- Zero runtime CSS-in-JS overhead
- Maximum performance (no runtime style processing)
- Full control over design system
- Native browser capabilities
- Smaller bundle size
HTTP Client
Axios 1.13+- Promise-based HTTP requests
- Request/response interceptors for JWT handling
- Automatic error handling
Specialized Libraries
ChordSheetJS 13.2+- Music notation parsing and rendering
- ChordPro format support
- Dynamic transposition engine
- Used in the Worship/Ministry Hub
- React-based charting library
- Interactive data visualizations
- Used for attendance stats and reports
- Comprehensive internationalization
- Support for ES, EN, PT languages
- JSON-based translation keys (no hardcoded strings)
- Dynamic locale switching
clsx- Conditional className composition
Backend Stack
Core Language & Architecture
Vanilla PHP (PSR-4)- Professional, custom micro-framework approach
- Zero external dependencies (no Composer packages)
- PSR-4 autoloading for clean namespace organization
- Object-oriented design patterns
- Maximum performance (no framework overhead)
- Full control over request handling
- Easy deployment on any shared hosting
- Predictable behavior and debugging
Application Structure
Controller-Repository Patternbackend/src/Controllers/SongController.php
- Controllers: Handle HTTP logic, routing, validation
- Repositories: Manage database queries and data persistence
- Helpers: Provide utilities (Response, Logger, CORS)
- Middleware: Security filters (Auth, Permissions, CORS)
PSR-4 Autoloader
backend/src/bootstrap.php
Middleware System
Centralized Security Filters:- CORS Middleware - Initialized on every request
- Auth Middleware - Validates JWT tokens
- Permission Middleware - Role-based access control
backend/src/Middleware/AuthMiddleware.php
Database Stack
Database Engine
MySQL- Relational data storage
- Optimized indexing for multi-tenancy
- Separate schemas for Users, Music, Calendar, etc.
Data Access
PDO (PHP Data Objects)- Prepared statements (100% SQL injection protection)
- Named parameters for clarity
- Exception-based error handling
backend/src/Database.php
main- User management, churches, rolesmusic- Songs, setlists, instruments
Security Stack
Authentication
JWT (JSON Web Tokens)- Stateless authentication
- Custom implementation (no external library)
- HS256 algorithm with secret key
- 1-hour token expiration
backend/src/Jwt.php
- Stored in
localStorageon frontend - Sent in
Authorization: Bearer <token>header - Validated on every protected API request
Bot Protection
reCAPTCHA v3- Invisible security layer (no user interaction)
- Integrated into login endpoint
- Score-based verification (threshold: 0.5)
- Server-side validation in
AuthController
backend/src/Controllers/AuthController.php
Password Security
bcrypt Hashing- PHP’s native
password_hash()andpassword_verify() - Automatic salt generation
- Cost factor for future-proofing
Development Tools
Build Optimization
Code Splitting- Dynamic
import()for lazy loading - Manual chunks for vendor libraries
- Optimized bundle sizes
Version Control
Git- Standard version control
- Feature branch workflow
Docker (Development)
Local Environment- Containerized development setup
- Consistent across team members
Deployment Architecture
See Request Lifecycle for detailed deployment structure. Key Principles:- Frontend: Static build deployed to
public_html/ - Backend: PHP core in
backend/(sibling to public_html, unreachable via URL) - Configuration:
.envfiles outside web root - Logs: Writable directory outside public access
Technology Decision Rationale
| Technology | Why This Choice? |
|---|---|
| React 19 | Modern UI with best-in-class ecosystem |
| TypeScript | Type safety prevents runtime errors |
| Vite | Fastest build tool available |
| Vanilla CSS | Maximum performance, zero runtime cost |
| Vanilla PHP | No framework overhead, easy hosting |
| PDO | Industry-standard database security |
| JWT | Stateless auth scales horizontally |
| MySQL | Reliable, well-documented, universal support |
Next Steps
Request Lifecycle
Learn how requests flow from browser to database
Database
Explore the schema and data access patterns
Security
Deep dive into authentication and authorization
Architecture Overview
See the high-level system design