A comprehensive Database Management System (DBMS) mini project for managing EV charging stations, slot bookings, and user operations with role-based access control.
Now powered by SQLite - Zero configuration, file-based database! ๐
- Overview
- Quick Start
- Features
- Technology Stack
- Database Design
- Installation
- Usage
- API Endpoints
- DBMS Concepts Demonstrated
- Project Structure
- Future Enhancements
Fluxore is a smart EV charging station management system that allows users to book charging slots in advance and enables administrators to manage stations, vehicles, pricing, and system configuration. The project strongly demonstrates DBMS concepts including:
- Entity Relationships - Complex relationships between users, stations, bookings, vehicles
- Constraints - Primary keys, foreign keys, check constraints, unique constraints
- Normalization - Database designed in 3NF (Third Normal Form)
- Transactions - ACID properties maintained for critical operations
- Role-based Access - Separate admin and user functionalities
- Triggers - Automated calculations and validation
- Views - Simplified complex queries
- Indexes - Performance optimization
Get running in 3 commands:
cd backend
npm install
npm run setup-db && npm run devThen open: http://localhost:3000
Default Credentials:
- Admin:
admin/password123 - User:
john_doe/password123
See QUICKSTART.md for more details.
- โ User registration and authentication
- ๐ View available charging stations across multiple locations
- ๐ Add and manage multiple EV vehicles
- โฐ Book charging slots in advance
- ๐ Automatic charging time estimation based on vehicle specs
- โ Cancel bookings (with penalty fee if within 2 hours)
- ๐ View booking history and status
- ๐ณ Dummy payment simulation
- ๐ข Add, edit, delete charging stations
- ๐ Define number of charging ports per station
- ๐ฐ Set pricing (price per kWh, per hour)
- ๐ Add EV car makes and models with specifications
- ๐ View all bookings and system statistics
- โ๏ธ Manage system settings
- ๐ต Configure cancellation penalty fees
- Fixed time slot management (30, 60, 90, 120 minutes)
- Dynamic slot availability calculation
- Prevents double booking using triggers
- Charging estimation based on:
- Battery capacity
- Current charge level
- Target charge level
- Vehicle charging rate
- Charging efficiency
- Audit logging for tracking system events
- Node.js - Runtime environment
- Express.js - Web framework
- SQLite3 - Embedded database (no server required!)
- bcrypt - Password hashing
- jsonwebtoken - Authentication
- sqlite3 - Database driver
- HTML5 - Structure
- CSS3 - Styling (Custom, no frameworks)
- JavaScript (Vanilla) - Interactivity
- Fetch API - HTTP requests
- SQLite - Zero-configuration, file-based, production-ready DBMS
- Single
fluxore.dbfile - No server setup required
- Perfect for development and testing
- Easy to backup and share
- Can migrate to MySQL for production if needed
- Single
โโโโโโโโโโโโโโโ
โ ROLES โ
โโโโโโโโฌโโโโโโโ
โ 1
โ
โ N
โโโโโโโโดโโโโโโโ โโโโโโโโโโโโโโโโโโ
โ USERS โโโโโโโโโโโถโ AUDIT_LOGS โ
โโโโโโโโฌโโโโโโโ N 1 โโโโโโโโโโโโโโโโโโ
โ 1
โ
โ N
โโโโโโโโดโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ
โ USER_VEHICLES โโโโโโโโ VEHICLE_MODELS โ
โโโโโโโโฌโโโโโโโโโโโ N 1 โโโโโโโโโโโฌโโโโโโโโโโโ
โ โ N
โ โ
โ โ 1
โ โโโโโโโโโโดโโโโโโโโโโโ
โ โ VEHICLE_MAKES โ
โ โโโโโโโโโโโโโโโโโโโโโ
โ 1
โ
โ N
โโโโโโโโดโโโโโโโโโโโ
โ BOOKINGS โโโโโโโโโโโโ
โโโโโโโโฌโโโโโโโโโโโ N 1 โ
โ โ
โ 1 โ
โ โ
โ N โโโโโโโโโโโดโโโโโโโโโโ
โโโโโโโโดโโโโโโโ โ CHARGING_STATIONS โ
โ PAYMENTS โ โโโโโโโโโโโฌโโโโโโโโโโ
โโโโโโโโโโโโโโโ โ 1
โ
โโโโโโโโโโโผโโโโโโโโโโ
โ N โ 1 โ
โโโโโโโโโโดโโโโ โ โโโโโโดโโโโโโโ
โTIME_SLOTS โ โ โ PRICING โ
โโโโโโโโโโโโโโ โ โโโโโโโโโโโโโ
โ N
โโโโโโโโโโดโโโโโโโโโโโ
โ CHARGING_PORTS โ
โโโโโโโโโโโโโโโโโโโโโ
Stores user information with role-based access
- Primary Key:
user_id - Foreign Key:
role_idโ roles - Constraints: UNIQUE(username, email)
Stores charging station locations
- Primary Key:
station_id - Constraints: CHECK(total_ports > 0)
Individual ports at each station
- Primary Key:
port_id - Foreign Key:
station_idโ charging_stations - Constraints: UNIQUE(station_id, port_number)
EV car models with technical specs
- Primary Key:
model_id - Foreign Key:
make_idโ vehicle_makes - Constraints: CHECK(battery_capacity_kwh > 0, charging_rate_kw > 0)
Central table for charging slot bookings
- Primary Key:
booking_id - Foreign Keys: user_id, station_id, port_id, user_vehicle_id, slot_id
- Constraints: CHECK(target > current), CHECK(end_time > start_time)
- Trigger: Prevents double booking
Payment transactions
- Primary Key:
payment_id - Foreign Keys: booking_id, user_id
- Constraints: UNIQUE(transaction_id)
First Normal Form (1NF)
- All tables have atomic values
- Each column contains single values
- Each row is unique (primary key)
Second Normal Form (2NF)
- All non-key attributes fully depend on primary key
- No partial dependencies
- Example: vehicle_models depends on model_id, not on make details
Third Normal Form (3NF)
- No transitive dependencies
- Example: Pricing is separate from stations to avoid redundancy
- User vehicles separated from users to handle multiple vehicles
-- Primary Keys
โ Every table has a primary key
-- Foreign Keys
โ All relationships enforced with CASCADE/RESTRICT
-- Check Constraints
โ Battery capacity > 0
โ Charging rate > 0
โ Efficiency between 50-100%
โ Port number > 0
โ Charge percentages 0-100
โ Target > Current charge
-- Unique Constraints
โ Username, email unique
โ Port numbers unique per station
โ Transaction IDs unique
-- NOT NULL
โ Critical fields marked as required
-- Default Values
โ Timestamps, status fields, booleans-
trg_prevent_double_booking
- Prevents overlapping bookings on same port
- Validates time slot availability
- Raises error if conflict detected
-
trg_calculate_charging_estimates
- Automatically calculates energy needed
- Computes charging duration
- Based on vehicle specifications
-
trg_log_booking_cancellation
- Creates audit log entry
- Tracks cancellation events
-
v_station_availability
- Shows stations with port counts
- Active vs available ports
- Operational status
-
v_user_booking_history
- Comprehensive booking details
- Joins users, stations, vehicles
- Sorted by date
-
v_active_pricing
- Current pricing configuration
- Station-specific or default
- Date-range filtered
- Node.js (v14 or higher)
- MySQL/MariaDB (v5.7 or higher)
- npm or yarn
cd Fluxore-EV-Charging-System# Login to MySQL
mysql -u root -p
# Run schema
mysql -u root -p < database/schema.sql
# Load sample data
mysql -u root -p < database/sample_data.sqlcd backend
# Install dependencies
npm install
# Create .env file
cp .env.example .env
# Edit .env with your database credentials
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=fluxore_db# Development mode
npm run dev
# Production mode
npm startServer will start at http://localhost:3000
Open browser and navigate to:
http://localhost:3000
Admin Login:
- Username:
admin - Password:
password123
User Login:
- Username:
john_doe - Password:
password123
- Register new account or login
- Add your EV vehicle (make, model)
- Browse charging stations
- Select station and check availability
- Book a time slot
- Make payment (dummy)
- View booking confirmation
- Cancel if needed (check penalty)
- Login with admin credentials
- Add new charging stations
- Configure ports for each station
- Add vehicle makes and models
- Set pricing configuration
- View all bookings
- Manage system settings
POST /api/auth/register - Register new user
POST /api/auth/login - User login
GET /api/stations - Get all stations
GET /api/stations/:id - Get station by ID
GET /api/stations/:id/availability - Check available slots
GET /api/vehicles/makes - Get all makes
GET /api/vehicles/makes/:id/models - Get models by make
GET /api/vehicles/user/:userId - Get user vehicles
POST /api/vehicles/user/:userId - Add vehicle
POST /api/bookings - Create booking
GET /api/bookings/user/:userId - Get user bookings
GET /api/bookings/:id - Get booking by ID
PUT /api/bookings/:id/cancel - Cancel booking
GET /api/admin/bookings - View all bookings
POST /api/admin/stations - Add station
PUT /api/admin/stations/:id - Update station
DELETE /api/admin/stations/:id - Delete station
POST /api/admin/vehicle-makes - Add vehicle make
POST /api/admin/vehicle-models - Add vehicle model
POST /api/admin/pricing - Update pricing
GET /api/admin/settings - Get settings
PUT /api/admin/settings/:key - Update setting
GET /api/admin/dashboard/stats - Dashboard statistics
POST /api/payments/process - Process payment
GET /api/payments/booking/:id - Get payment by booking
GET /api/payments/user/:userId - User payment history
- One-to-Many: Users โ Bookings, Stations โ Ports
- Many-to-One: Bookings โ Users, Models โ Makes
- One-to-One: Booking โ Payment (in most cases)
- All foreign keys enforce relationships
- CASCADE delete where appropriate
- RESTRICT to prevent orphaned records
- Entity Integrity: Primary keys on all tables
- Referential Integrity: Foreign key constraints
- Domain Integrity: Check constraints, data types
- User-defined Integrity: Business rules via triggers
- โ No data redundancy
- โ Consistent updates
- โ Efficient storage
- โ Maintainable structure
- Atomicity: Booking + Payment as single unit
- Consistency: Constraints enforced
- Isolation: Concurrent bookings handled
- Durability: Committed transactions persisted
- Primary key indexes (automatic)
- Foreign key indexes for joins
- Custom indexes on frequently queried columns
- Improves query performance
- Abstraction of complex queries
- Security (hide sensitive data)
- Simplified application code
- Automated business logic
- Data validation
- Audit logging
- Calculated fields
Fluxore-EV-Charging-System/
โ
โโโ database/
โ โโโ schema.sql # Complete database schema
โ โโโ sample_data.sql # Sample data for testing
โ
โโโ backend/
โ โโโ config/
โ โ โโโ database.js # Database connection
โ โโโ routes/
โ โ โโโ auth.routes.js # Authentication
โ โ โโโ station.routes.js # Stations API
โ โ โโโ vehicle.routes.js # Vehicles API
โ โ โโโ booking.routes.js # Bookings API
โ โ โโโ admin.routes.js # Admin API
โ โ โโโ payment.routes.js # Payments API
โ โโโ server.js # Express server
โ โโโ package.json # Dependencies
โ โโโ .env.example # Environment template
โ
โโโ frontend/
โ โโโ css/
โ โ โโโ style.css # Complete styling
โ โโโ js/
โ โ โโโ main.js # Core utilities
โ โ โโโ user-dashboard.js # Dashboard logic
โ โโโ index.html # Landing page
โ โโโ login.html # Login page
โ โโโ register.html # Registration
โ โโโ user-dashboard.html # User dashboard
โ
โโโ docs/
โ โโโ ER_DIAGRAM.md # ER diagram explanation
โ โโโ VIVA_QUESTIONS.md # Common viva questions
โ โโโ DBMS_CONCEPTS.md # Detailed concepts
โ
โโโ README.md # This file
(Add screenshots after running the application)
- Landing Page
- User Registration
- Login Page
- User Dashboard
- Station Listing
- Booking Form
- Available Slots
- Booking History
- My Vehicles
- Admin Dashboard
- Real-time slot availability using WebSockets
- Google Maps integration for station locations
- Email/SMS notifications
- Payment gateway integration (Razorpay, Stripe)
- Mobile app (React Native)
- Charging session monitoring
- Dynamic pricing based on demand
- Loyalty points and rewards
- Station reviews and ratings
- Multi-language support
- Stored procedures for complex operations
- Database replication for high availability
- Query optimization and performance tuning
- Database backup and recovery procedures
- Data warehousing for analytics
- Full-text search for stations
See docs/VIVA_QUESTIONS.md for:
- Common DBMS concept questions
- Project-specific questions
- Technical explanations
- Database design justifications
This is an educational project for DBMS mini project purposes.
- SABAREESH S NAIR
- SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
- Course: Database Management Systems
- Instructor: [KARTHIKEYAN]
- Year: 2026
For any queries or issues:
- Email: support@fluxore.com
- GitHub Issues: [Create an issue]
Built with โค๏ธ for DBMS Mini Project
Demonstrating practical application of database concepts in a real-world scenario