A modern, full-stack electricity management platform revolutionizing prepaid utility services
SmartCashPower is an enterprise-grade solution that enables users to purchase electricity tokens, manage multiple meters, and track consumption in real-time. Built with Spring Boot and React, it delivers a seamless experience for both customers and administrators.
Modern, responsive landing page with dark theme and engaging UI
SmartCashPower is a comprehensive prepaid electricity management system featuring:
- π Secure Authentication - JWT-based authentication with role-based access control
- β‘ Real-Time Monitoring - Live meter consumption tracking and visualization
- π³ Instant Purchases - Seamless electricity token purchases with mobile money integration
- π Admin Dashboard - Comprehensive management tools for system administrators
- π Multi-Meter Support - Manage multiple electricity meters from a single account
- π± Responsive Design - Modern, mobile-first UI with dark theme
This project currently uses mock APIs for demonstration purposes:
- REG (Rwanda Energy Group) Integration: Mock implementation simulating real meter data and token generation
- Mobile Money Payments (MTN MoMo & Airtel Money): Mock payment processing for demonstration
Future Plans: I am actively seeking partnerships with REG and mobile money providers to integrate real APIs when this project is accepted for production use. These integrations are designed to be easily replaceable with actual API implementations.
- Framework: Spring Boot 3.2.0
- Language: Java 21
- Database: PostgreSQL
- Security: Spring Security with JWT
- ORM: Spring Data JPA (Hibernate)
- Build Tool: Maven
- Framework: React 18+ with TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS 4.1 with Custom Dark Theme
- Routing: React Router v6
- HTTP Client: Axios
- State Management: React Hooks
- Notifications: React Hot Toast
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β React SPA βββββββΆβ Spring Boot API βββββββΆβ PostgreSQL β
β (Port 5173) ββββββββ (Port 8080) ββββββββ Database β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β
β β
βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ
β Tailwind CSS β β Mock APIs β
β Dark Theme β β (REG, MoMo)* β
βββββββββββββββββββ ββββββββββββββββββββ
*To be replaced with real APIs
| Feature | Description |
|---|---|
| Account Management | Secure registration, login, and profile management |
| Meter Management | Add, view, and delete electricity meters |
| Token Purchases | Buy electricity with mobile money integration |
| Transaction History | Complete record of all purchases and consumption |
| Real-Time Updates | Live meter consumption visualization |
| Password Recovery | Admin-approved password reset workflow |
| Feature | Description |
|---|---|
| User Management | View, block, unblock, and delete user accounts |
| Meter Oversight | Monitor and manage all registered meters |
| Transaction Reports | Filter and export transaction data by date range |
| Password Approvals | Review and approve password reset requests |
| System Analytics | Real-time statistics and monitoring dashboard |
| Search & Filter | Advanced search across users, meters, and transactions |
- Java 21 or higher
- Node.js 16+ and npm/yarn
- PostgreSQL database
- Maven (included via wrapper)
-
Clone the repository
git clone https://github.com/ManJoseph/Smart-Cash-Power.git cd "Smart Cash Power"
-
Configure PostgreSQL
Create a database and user:
CREATE DATABASE smartcashpower_db; CREATE USER smartcash_user WITH PASSWORD 'smartcashpower123@#'; GRANT ALL PRIVILEGES ON DATABASE smartcashpower_db TO smartcash_user;
-
Update application.properties (if needed)
spring.datasource.url=jdbc:postgresql://localhost:5432/smartcashpower_db spring.datasource.username=smartcash_user spring.datasource.password=smartcashpower123@#
-
Run the backend
./mvnw spring-boot:run
Backend will start on
http://localhost:8080
-
Navigate to frontend directory
cd smart-cash-power-ui -
Install dependencies
npm install
-
Start development server
npm run dev
Frontend will start on
http://localhost:5173 -
Build for production
npm run build
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/v1/auth/register |
Register new user | No |
| POST | /api/v1/auth/login |
User login | No |
| PUT | /api/v1/auth/profile |
Update profile | Yes |
| POST | /api/v1/auth/change-password |
Change password | Yes |
| POST | /api/v1/auth/forgot-password |
Request password reset | No |
| GET | /api/v1/auth/reset-status |
Check reset approval | No |
| POST | /api/v1/auth/reset-password |
Complete password reset | No |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/v1/meters |
Get user's meters | Yes (USER) |
| POST | /api/v1/meters |
Add new meter | Yes (USER) |
| DELETE | /api/v1/meters/{id} |
Delete meter | Yes (USER) |
| PUT | /api/v1/meters/{id}/units |
Update meter units | Yes (USER) |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/v1/transactions/purchase |
Initiate purchase | Yes (USER) |
| GET | /api/v1/transactions/history |
Get transaction history | Yes (USER) |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/v1/admin/users |
Get all users | Yes (ADMIN) |
| POST | /api/v1/admin/users/{id}/block |
Block user | Yes (ADMIN) |
| POST | /api/v1/admin/users/{id}/unblock |
Unblock user | Yes (ADMIN) |
| DELETE | /api/v1/admin/users/{id} |
Delete user | Yes (ADMIN) |
| GET | /api/v1/admin/meters |
Get all meters | Yes (ADMIN) |
| DELETE | /api/v1/admin/meters/{id} |
Delete meter | Yes (ADMIN) |
| GET | /api/v1/admin/reports/transactions |
Get transactions by date | Yes (ADMIN) |
| GET | /api/v1/admin/password-resets |
Get pending resets | Yes (ADMIN) |
| POST | /api/v1/admin/password-resets/{id}/approve |
Approve reset | Yes (ADMIN) |
users
user_id(PK) - Unique identifieremail- User email (unique)password_hash- BCrypt hashed passwordphone_number- Contact number (unique)full_name- User's full namerole- USER or ADMINactive- Account statuscreated_at- Registration timestamppassword_reset_requested_at- Reset request timepassword_reset_allowed_until- Reset window expiry
meters
meter_id(PK) - Unique identifiermeter_number- Meter identifier (unique)current_units- Available electricity unitsused_units- Consumed unitsactive- Meter statususer_id(FK) - Owner reference
transactions
transaction_id(PK) - Unique identifieruser_id(FK) - User referencemeter_id(FK) - Meter referenceamount- Payment amountunits_purchased- Units boughttransaction_date- Purchase timestampstatus- PENDING, SUCCESS, FAILEDtransaction_reference- External reference
- JWT Tokens: Stateless authentication with secure token generation
- BCrypt Hashing: Industry-standard password encryption
- Role-Based Access: USER and ADMIN role separation
- Protected Routes: Frontend and backend route protection
- CORS configuration for allowed origins
- Input validation on all endpoints
- SQL injection prevention via JPA
- XSS protection in React components
- Secure password reset workflow
- Session management with JWT expiry
- Enable HTTPS/TLS encryption
- Implement rate limiting
- Add request logging and monitoring
- Use environment variables for secrets
- Enable database connection pooling
- Implement backup and recovery procedures
Smart-Cash-Power/
βββ Smart Cash Power/ # Backend (Spring Boot)
β βββ src/main/java/smartcashpower/app/
β β βββ config/ # Security & CORS configuration
β β βββ controller/ # REST API controllers
β β βββ dto/ # Data Transfer Objects
β β βββ exception/ # Custom exceptions
β β βββ integration/ # External API integrations (Mock)
β β βββ model/ # JPA entities
β β βββ repository/ # Data access layer
β β βββ service/ # Business logic
β βββ src/main/resources/
β β βββ application.properties
β βββ pom.xml
β
βββ smart-cash-power-ui/ # Frontend (React + TypeScript)
βββ src/
β βββ components/ # React components
β βββ services/ # API service layer
β βββ App.tsx # Main application
β βββ main.tsx # Entry point
βββ vite.config.ts
βββ tailwind.config.js
βββ package.json
- Modern Dark Theme: Professional black-green color scheme throughout
- Responsive Layout: Mobile-first design that works on all devices
- Real-Time Updates: Live meter consumption visualization
- Interactive Modals: Detailed views for meters and transactions
- Search & Filter: Advanced filtering across all data tables
- Toast Notifications: User-friendly feedback for all actions
- Loading States: Smooth loading indicators and animations
- Error Handling: Clear error messages and validation
User β Select Meter β Enter Amount β Choose Provider β Confirm
β Backend Processes Payment (Mock) β Update Meter Units β Return Token
β Display Confirmation β Toast Notification β Update Dashboard
User β Request Reset β Toast Notification (6s) β Admin Reviews β Admin Approves
β User Receives Notification β User Resets Password
β Confirmation β Redirect to Login
Login β Fetch Meters β Start Draining Effect (0.002 kWh/sec)
β Update UI Every Second β On Zero: Persist to Backend
β On Logout: Save All States
./mvnw testnpm run testWe welcome contributions and ideas from developers and customers!
- Developers: Code contributions, bug fixes, feature implementations
- Customers: Feature requests, UI/UX feedback, usability suggestions
- Everyone: Documentation improvements, testing, bug reports
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow existing code style and conventions
- Write clear commit messages
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
Have an idea for improvement? We'd love to hear it!
- Open an issue with the
enhancementlabel - Join discussions in existing issues
- Reach out via email with suggestions
Developer: Joseph Manizabayo
Email: josephmanizabayo7@gmail.com
GitHub: @ManJoseph
LinkedIn: manjoseph
Phone: +250 784 461 703
For bug reports and feature requests, please open an issue on GitHub.
These features are planned for future development:
-
Real API Integrations
- REG (Rwanda Energy Group) official API integration
- MTN Mobile Money production API
- Airtel Money production API
-
Mobile Applications
- Native iOS application
- Native Android application
- Cross-platform support with React Native
-
Enhanced Features
- SMS notifications for low balance alerts
- Email notifications for transactions
- Multi-language support (Kinyarwanda, French, English)
- Advanced analytics and reporting dashboards
- Export reports to PDF/Excel
-
IoT Integration
- Automated meter reading via IoT devices
- Real-time consumption monitoring
- Smart meter compatibility
-
Payment Options
- Integration with more payment providers
- Bank transfer support
- Credit/Debit card payments
-
User Experience
- Voice commands and accessibility features
- Chatbot support for customer service
- In-app tutorials and help center
Built with β€οΈ for a smarter energy future
SmartCashPower - Empowering communities through intelligent utility management
Note: This project is open to partnerships with energy providers and payment platforms. If you're interested in collaborating, please reach out!