A comprehensive Electric Vehicle (EV) charging and battery swap ecosystem platform supporting public charging networks, private chargers, fleet management, and battery swap services.
- Overview
- Architecture
- Applications
- Tech Stack
- Getting Started
- Project Structure
- Environment Variables
- Development
- API Documentation
- Deployment
- Contributing
EVzone is a multi-tenant EV infrastructure management platform consisting of:
- 8 Frontend Applications - Serving different user personas (admins, drivers, fleet managers, attendants)
- NestJS Backend API - RESTful API with real-time WebSocket support
- CSMS Engine - OCPP-compliant Charging Station Management System
- PostgreSQL Database - Primary data store with Prisma ORM
- Redis - Caching, session management, and pub/sub
- Kafka - Event streaming for OCPP messages and analytics
| Feature | Description |
|---|---|
| Multi-tenant Architecture | Support for multiple organizations with isolated data |
| Public Charging | Station discovery, booking, and charging sessions |
| Private Charging | Home/business charger management with access control |
| Battery Swap | Swap station operations with pack inventory management |
| Fleet Management | Vehicle tracking, driver management, trips, and payouts |
| OCPP Support | OCPP 1.6/2.0 WebSocket gateway for charger communication |
| Smart Charging | Load management and demand response capabilities |
| Wallet System | In-app payments with top-up and transaction history |
| Real-time Updates | WebSocket-based live status updates |
┌─────────────────────────────────────────────────────────────────────────────┐
│ CLIENT APPLICATIONS │
├─────────────┬─────────────┬─────────────┬─────────────┬─────────────────────┤
│ CPMS Admin │ Public App │ Private App │ Fleet App │ Attendant Apps │
│ Portal │ (Charging) │ (Chargers) │ (Partner) │ (Charging/Swap) │
└─────────────┴─────────────┴─────────────┴─────────────┴─────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ API GATEWAY │
│ (Authentication, Rate Limiting, CORS) │
└─────────────────────────────────────────────────────────────────────────────┘
│
┌─────────────────────┼─────────────────────┐
▼ ▼ ▼
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
│ MAIN API │ │ CSMS ENGINE │ │ REALTIME │
│ (NestJS) │ │ (OCPP Gateway) │ │ (Socket.io) │
│ │ │ │ │ │
│ • Auth │ │ • OCPP 1.6/2.0 │ │ • Live Updates │
│ • Users │ │ • Boot Notification │ │ • Session Events │
│ • Stations │ │ • Heartbeat │ │ • Status Changes │
│ • Sessions │ │ • Transactions │ │ │
│ • Bookings │ │ • Meter Values │ │ │
│ • Payments │ │ │ │ │
│ • Swap │ │ │ │ │
│ • Fleets │ │ │ │ │
│ • Analytics │ │ │ │ │
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
│ │ │
└─────────────────────┼─────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ INFRASTRUCTURE │
├─────────────────────┬─────────────────────┬─────────────────────────────────┤
│ PostgreSQL │ Redis │ Kafka │
│ (Primary DB) │ (Cache/PubSub) │ (Event Streaming) │
└─────────────────────┴─────────────────────┴─────────────────────────────────┘
Purpose: Central management dashboard for platform administrators, operators, and station owners.
Users: EVzone Admins, Operators, Station Owners, Site Owners, Technicians
Key Features:
- Dashboard with real-time KPIs and analytics
- Station and charge point management
- User and organization management
- Booking and session monitoring
- Billing, invoices, and settlements
- Incident management and job dispatch
- OCPI roaming partner management
- Smart charging policy configuration
Tech: React 18 + Vite + TypeScript + TailwindCSS
Purpose: Consumer-facing mobile-first PWA for EV drivers to find and use public charging stations.
Users: EV Drivers (Riders)
Key Features:
- Station discovery with map view
- Real-time availability status
- Booking and reservations
- QR code scanning to start sessions
- Live charging session monitoring
- Payment processing
- Wallet management
- Favorites and charging history
Tech: React 18 + Vite + TypeScript + TailwindCSS + PWA
Purpose: Management app for private charger owners (home/business) to control access and monetize their chargers.
Users: Home Charger Owners, Business Charger Owners
Key Features:
- Charger registration and OCPP connection
- Access control (permanent, temporary, guest passes)
- Scheduling and availability
- Pricing and tariff configuration
- Session history and analytics
- Energy analytics and CO2 savings
- Operator marketplace integration
Tech: React 18 + Create React App + JavaScript
Purpose: Consumer app for battery swap services, primarily for e-motorcycle riders.
Users: E-Motorcycle Riders
Key Features:
- Swap station discovery
- Provider selection (GoGo, Spira, etc.)
- Battery reservation and booking
- Swap session flow
- Wallet and payments
- Swap history
- Battery health tracking
Tech: React 18 + Create React App + JavaScript
Purpose: Comprehensive fleet management platform for transport operators.
Users: Fleet Managers, Fleet Admins, Dispatchers
Key Features:
- Vehicle fleet management
- Driver management and ratings
- Trip tracking and history
- Earnings and driver payouts
- School shuttle service management
- Tour booking management
- Vehicle rental service
- Compliance and incident management
- Multi-branch support
Tech: React 18 + Vite + TypeScript + TailwindCSS
Purpose: Operational app for station attendants managing charging operations.
Users: Station Attendants (Fixed and Mobile)
Key Features:
- Port status monitoring
- Booking queue management
- Check-in/check-out flow
- Cash and mobile payment collection
- Transaction history
- Offline support
Tech: React 18 + Vite + TypeScript + TailwindCSS
Purpose: Operational app for swap station attendants managing battery inventory.
Users: Swap Station Attendants
Key Features:
- Pack inventory management
- Shelf and locker status
- Battery inspection workflow
- Pack assignment
- Swap session facilitation
- Handover signatures
- Incident logging
Tech: React 18 + Vite + TypeScript + TailwindCSS
Purpose: Vehicle management and diagnostics app for EV owners.
Users: EV Owners, Fleet Drivers
Key Features:
- Vehicle garage management
- Battery health monitoring
- Live diagnostics
- Trip history and efficiency
- Charging session history
- Route planning with charging stops
- Maintenance reminders
Tech: React 18 + Vite + TypeScript + TailwindCSS
| Technology | Version | Purpose |
|---|---|---|
| React | 18.x | UI Framework |
| TypeScript | 5.x | Type Safety |
| Vite | 5.x | Build Tool |
| TailwindCSS | 3.x | Styling |
| React Router | 6.x | Routing |
| TanStack Query | 5.x | Data Fetching |
| Zustand | 4.x | State Management |
| Socket.io Client | 4.x | Real-time |
| Recharts | 2.x | Charts |
| Technology | Version | Purpose |
|---|---|---|
| Node.js | 20.x | Runtime |
| NestJS | 10.x | Framework |
| TypeScript | 5.x | Type Safety |
| Prisma | 5.x | ORM |
| PostgreSQL | 15.x | Database |
| Redis | 7.x | Cache/PubSub |
| Kafka | 3.x | Event Streaming |
| Socket.io | 4.x | WebSocket |
| Passport | 0.7.x | Authentication |
| JWT | - | Token Auth |
| Technology | Purpose |
|---|---|
| Docker | Containerization |
| Kubernetes | Orchestration (Production) |
| Nginx | Reverse Proxy |
| Let's Encrypt | SSL Certificates |
- Node.js 20.x or higher
- pnpm 8.x (recommended) or npm 10.x
- PostgreSQL 15.x
- Redis 7.x
- Docker & Docker Compose (optional)
# Clone the repository
git clone https://github.com/evzone/evzone-portal.git
cd evzone-portal
# Start infrastructure services
cd backend
docker-compose up -d
# Install dependencies
npm install
# Setup database
npx prisma generate
npx prisma migrate dev
# Seed database
npm run prisma:seed
# Start backend
npm run start:devcd backend
# Install dependencies
npm install
# Copy environment file
cp .env.example .env
# Edit .env with your configuration
# DATABASE_URL, REDIS_URL, JWT_SECRET, etc.
# Generate Prisma client
npx prisma generate
# Run migrations
npx prisma migrate dev
# Seed database (optional)
npm run prisma:seed
# Start development server
npm run start:dev# From project root
npm install
# Copy environment file
cp .env.example .env.local
# Start development server
npm run devEach frontend app can be started independently:
# Public Charging App
cd evzone-public-charging-vite
npm install
npm run dev
# Fleet Partner App
cd FleetPartnerAPP
npm install
npm run dev
# Private Charger App
cd evzone-private-charge
npm install
npm start
# Swap Client
cd evz-swap-client
npm install
npm startevzone-portal/
├── backend/ # NestJS Backend
│ ├── apps/
│ │ ├── api/ # Main REST API
│ │ │ └── src/
│ │ │ ├── auth/ # Authentication
│ │ │ ├── users/ # User management
│ │ │ ├── bookings/ # Booking service
│ │ │ ├── sessions/ # Session management
│ │ │ ├── swap/ # Battery swap
│ │ │ ├── fleets/ # Fleet management
│ │ │ ├── vehicles/ # Vehicle service
│ │ │ ├── wallet/ # Wallet service
│ │ │ ├── payments/ # Payment processing
│ │ │ ├── analytics/ # Analytics service
│ │ │ ├── notifications/# Notifications
│ │ │ ├── support/ # Support tickets
│ │ │ ├── realtime/ # WebSocket gateway
│ │ │ └── integrations/ # Redis, Kafka
│ │ └── csms-engine/ # OCPP Gateway
│ │ └── src/
│ │ ├── ocpp/ # OCPP protocol
│ │ └── kafka/ # Event streaming
│ ├── prisma/
│ │ ├── schema.prisma # Database schema
│ │ ├── migrations/ # DB migrations
│ │ └── seed.ts # Seed data
│ └── docker-compose.yml # Infrastructure
│
├── src/ # CPMS Admin Portal
│ ├── app/ # App shell & routing
│ ├── core/ # Auth, config, types
│ ├── features/ # Feature components
│ ├── ui/ # UI components
│ └── data/ # Data layer
│
├── evzone-public-charging-vite/ # Public Charging App
│ └── src/
│ ├── app/ # App screens
│ ├── core/ # SDK, types
│ ├── features/ # Feature modules
│ └── shared/ # Shared components
│
├── evzone-private-charge/ # Private Charger App
│ └── src/
│ ├── screens/ # App screens
│ ├── components/ # UI components
│ └── services/ # API services
│
├── evz-swap-client/ # Swap Client App
│ └── src/
│ ├── screens/ # App screens
│ ├── shared/ # Shared utilities
│ └── layout/ # Layout components
│
├── FleetPartnerAPP/ # Fleet Partner App
│ └── src/
│ ├── pages/ # Page components
│ ├── components/ # UI components
│ └── context/ # React contexts
│
├── ev-charging-attendant/ # Charging Attendant
│ └── src/
│ └── components/ # App components
│
├── evzone-swap-attendant/ # Swap Attendant
│ └── src/
│ └── pages/ # App pages
│
└── My-vehicles/My-vehicles/ # My Vehicles App
└── src/
├── vehicles/ # Vehicle management
├── diagnostics/ # Diagnostics
└── routeplanner/ # Route planning
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/evzone"
# Redis
REDIS_URL="redis://localhost:6379"
# Kafka (optional)
KAFKA_BROKERS="localhost:9092"
KAFKA_CLIENT_ID="evzone-api"
# JWT
JWT_SECRET="your-super-secret-key"
JWT_REFRESH_SECRET="your-refresh-secret-key"
JWT_EXPIRATION="15m"
# OAuth (optional)
GOOGLE_CLIENT_ID="your-google-client-id"
APPLE_CLIENT_ID="your-apple-client-id"
# Payments
STRIPE_SECRET_KEY="sk_test_..."
STRIPE_WEBHOOK_SECRET="whsec_..."
# SMS/Email - OTP Delivery (optional)
# Mailgun for Email
MAILGUN_API_KEY="your-mailgun-api-key"
MAILGUN_DOMAIN="your-mailgun-domain.com"
MAILGUN_FROM_EMAIL="noreply@your-domain.com"
# Twilio for SMS (International)
TWILIO_ACCOUNT_SID="your-twilio-account-sid"
TWILIO_AUTH_TOKEN="your-twilio-auth-token"
TWILIO_PHONE_NUMBER="+1234567890"
# AfricasTalking for SMS (Africa-focused)
AFRICASTALKING_API_KEY="your-africastalking-api-key"
AFRICASTALKING_USERNAME="your-africastalking-username"
AFRICASTALKING_SENDER_ID="your-sender-id"
# OTP Provider Preferences (optional)
# Set to 'true' to prefer a specific provider, otherwise auto-selects based on phone number region
OTP_PREFER_AFRICASTALKING="false"
OTP_PREFER_TWILIO="false"# API URL
VITE_API_URL="http://localhost:3000"
# WebSocket URL
VITE_WS_URL="ws://localhost:3000"
# Google Maps (for station discovery)
VITE_GOOGLE_MAPS_API_KEY="..."
# Feature Flags
VITE_ENABLE_SWAP=true
VITE_ENABLE_FLEET=true# Backend unit tests
cd backend
npm run test
# Backend e2e tests
npm run test:e2e
# Frontend tests
npm run test# Generate Prisma client after schema changes
npx prisma generate
# Create migration
npx prisma migrate dev --name migration_name
# Apply migrations (production)
npx prisma migrate deploy
# Open Prisma Studio
npx prisma studio
# Reset database
npx prisma migrate reset# Lint
npm run lint
# Format
npm run format
# Type check
npm run type-checkThe API follows RESTful conventions with the following base structure:
POST /auth/register- User registrationPOST /auth/login- Email/phone loginPOST /auth/otp/send- Send OTPPOST /auth/otp/verify- Verify OTPPOST /auth/refresh- Refresh tokensPOST /auth/social- Social login (Google/Apple)
GET /stations- List stationsGET /stations/:id- Get station detailsPOST /stations- Create stationPATCH /stations/:id- Update stationDELETE /stations/:id- Delete station
GET /bookings- List user bookingsPOST /bookings- Create bookingPATCH /bookings/:id/status- Update booking statusDELETE /bookings/:id- Cancel booking
GET /sessions- List sessionsGET /sessions/active- Get active sessionsPOST /sessions/start- Start sessionPOST /sessions/:id/stop- Stop session
GET /wallet- Get wallet balanceGET /wallet/transactions- Transaction historyPOST /wallet/topup- Top up wallet
GET /swap/stations- List swap stationsPOST /swap/initiate- Start swap sessionPOST /swap/:id/complete- Complete swap
GET /vehicles- List user vehiclesPOST /vehicles- Add vehicleGET /vehicles/:id/diagnostics- Get diagnosticsGET /vehicles/:id/trips- Get trip history
Full API documentation is available via Swagger at /api/docs when running the backend.
# Build images
docker build -t evzone-api ./backend
docker build -t evzone-portal .
# Run with docker-compose
docker-compose -f docker-compose.prod.yml up -d# Production build
npm run build
# Preview production build
npm run preview- API Health:
GET /health - Database:
GET /health/db - Redis:
GET /health/redis
| Role | Description | Access Level |
|---|---|---|
SUPER_ADMIN |
Platform super administrator | Full access |
PLATFORM_ADMIN |
Platform administrator | Full access (no system config) |
ORG_OWNER |
Organization owner | Organization-wide access |
ORG_ADMIN |
Organization administrator | Organization management |
STATION_OWNER_INDIVIDUAL |
Individual station owner | Own stations |
STATION_OWNER_ORG |
Organizational station owner | Org stations |
STATION_ADMIN |
Station administrator | Station management |
STATION_ATTENDANT |
Station attendant | Operational tasks |
FLEET_MANAGER |
Fleet manager | Fleet operations |
FLEET_DRIVER |
Fleet driver | Driver operations |
TECHNICIAN_PUBLIC |
Public technician | Maintenance jobs |
TECHNICIAN_ORG |
Organization technician | Org maintenance |
RIDER_PREMIUM |
Premium rider | All rider features |
RIDER_STANDARD |
Standard rider | Basic rider features |
GUEST |
Guest user | Limited access |
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
We follow Conventional Commits:
feat:New featurefix:Bug fixdocs:Documentationstyle:Formattingrefactor:Code refactoringtest:Testschore:Maintenance
This project is proprietary software. All rights reserved.
For support, contact:
- Email: delta@evzone.com
- Documentation: https://docs.evzone.com
- Issues: https://github.com/evzone/evzone-portal/issues