Skip to content

liavjulio/BikeSafe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

84 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš΄β€β™‚οΈ BikeSafe

A comprehensive bike security and monitoring system that combines IoT sensors, Bluetooth connectivity, and mobile technology to keep your bike safe and monitored.

BikeSafe Logo

πŸ“‹ Table of Contents

🌟 Overview

BikeSafe is an intelligent bike security system that provides real-time monitoring, theft alerts, and environmental tracking for your bicycle. The system consists of:

  • Flutter Mobile App: Cross-platform mobile application for iOS and Android
  • Node.js Backend: RESTful API server with MongoDB database
  • IoT Integration: ESP32-based sensors for real-time data collection
  • Bluetooth Connectivity: Seamless communication between sensors and mobile device

✨ Features

πŸ” Security & Authentication

  • User Registration & Login: Secure account creation with email verification
  • Google OAuth Integration: Quick sign-in with Google accounts
  • Password Reset: Secure password recovery via email
  • JWT Token Authentication: Secure API access

πŸ“± Mobile App Features

  • Real-time Sensor Monitoring: Live data from temperature, humidity, GPS, and motion sensors
  • Bluetooth Device Management: Connect and manage ESP32/Arduino devices
  • Interactive Maps: Google Maps integration for location tracking
  • Push Notifications: Real-time alerts for security events
  • Battery Monitoring: Track bike battery status and history
  • Dark/Light Theme: Customizable app appearance
  • Admin Panel: Administrative features for user management

🌐 Backend Features

  • RESTful API: Comprehensive API for all app functions
  • Database Management: MongoDB integration for data persistence
  • Email Services: SendGrid integration for notifications
  • Firebase Integration: Push notification support
  • Location Services: GPS tracking and geofencing
  • Sensor Data Processing: Real-time IoT data handling

πŸ”§ IoT & Hardware

  • ESP32 Integration: Support for ESP32-based sensor modules
  • Bluetooth Serial Communication: Reliable data transmission
  • Multiple Sensor Support: Temperature, humidity, GPS, motion detection
  • Real-time Data Streaming: Live sensor data updates

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Flutter App   │◄──►│   Node.js API   │◄──►│    MongoDB      β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚    Database     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚                       β”‚
          β”‚                       β”‚
          β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ESP32 Sensors   β”‚    β”‚   Firebase FCM  β”‚
β”‚ (via Bluetooth) β”‚    β”‚  (Push Notifications)β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‹ Prerequisites

For Mobile App Development

  • Flutter SDK: ^3.6.0
  • Dart: Latest stable version
  • Android Studio: For Android development
  • Xcode: For iOS development (macOS only)

For Backend Development

  • Node.js: v16.0 or higher
  • MongoDB: v4.4 or higher
  • npm: v8.0 or higher

External Services

  • Google Cloud Console: For OAuth and Maps API
  • Firebase: For push notifications
  • SendGrid: For email services

πŸš€ Installation

1. Clone the Repository

git clone https://github.com/liavjulio/bikesafe.git
cd bikesafe

2. Backend Setup

cd bikesafe-backend
npm install

# Copy and configure environment variables
cp .env.example .env
# Edit .env with your configuration

# Start the server
npm start

3. Mobile App Setup

cd bikesafe_app

# Install Flutter dependencies
flutter pub get

# Run the app
flutter run

βš™οΈ Configuration

Backend Environment Variables (.env)

# Database
MONGODB_URI=mongodb://localhost:27017/bikesafe
JWT_SECRET=your-jwt-secret-key

# Google OAuth
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret

# SendGrid Email
SENDGRID_API_KEY=your-sendgrid-api-key
FROM_EMAIL=noreply@bikesafe.com

# Firebase
FIREBASE_ADMIN_SDK_PATH=./bike-safe-24118-e2932191e023.json

# Server
PORT=3000
NODE_ENV=development

Mobile App Configuration

  1. Google Services Setup:

    • Place google-services.json in android/app/
    • Configure GoogleService-Info.plist for iOS
  2. API Configuration:

    • Update lib/utils/constants.dart with your backend URL
  3. Maps API:

    • Add your Google Maps API key to android/app/src/main/AndroidManifest.xml

πŸ“± Usage

Getting Started

  1. Register an Account:

    • Open the app and tap "Register"
    • Enter your email and create a password
    • Or use "Login with Google" for quick access
  2. Connect Your Bike Sensor:

    • Ensure your ESP32 device is paired via Bluetooth
    • Go to the main screen and select your device
    • Tap "Connect" to establish communication
  3. Monitor Your Bike:

    • View real-time sensor data on the dashboard
    • Check battery levels and environmental conditions
    • Receive alerts for unusual activity

Key Features

πŸ” Real-time Monitoring

  • Temperature & Humidity: Environmental conditions
  • GPS Tracking: Live location updates
  • Battery Status: Power level monitoring
  • Motion Detection: Security alerts

πŸ—ΊοΈ Location Services

  • Interactive Maps: Visual location tracking
  • Geofencing: Custom alert zones
  • Route History: Track your rides

πŸ”” Notifications

  • Security Alerts: Immediate theft notifications
  • Battery Warnings: Low power alerts
  • System Updates: App and sensor status

πŸ“š API Documentation

Authentication Endpoints

POST /auth/register
POST /auth/login
POST /auth/google-login
POST /auth/forgot-password
POST /auth/reset-password

Sensor Data Endpoints

GET /sensor/data/:userId
POST /sensor/update
GET /sensor/history/:userId

Location Endpoints

POST /location/update
GET /location/history/:userId

User Management

GET /user/profile
PUT /user/profile
DELETE /user/account

For detailed API documentation, see API_DOCS.md.

πŸ› οΈ Development

Project Structure

bikesafe/
β”œβ”€β”€ bikesafe_app/           # Flutter mobile application
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ screens/        # UI screens
β”‚   β”‚   β”œβ”€β”€ services/       # Business logic services
β”‚   β”‚   └── utils/          # Utility functions
β”‚   β”œβ”€β”€ android/            # Android-specific files
β”‚   β”œβ”€β”€ ios/                # iOS-specific files
β”‚   └── assets/             # Images and resources
β”œβ”€β”€ bikesafe-backend/       # Node.js API server
β”‚   β”œβ”€β”€ controllers/        # Route controllers
β”‚   β”œβ”€β”€ models/             # Database models
β”‚   β”œβ”€β”€ routes/             # API routes
β”‚   β”œβ”€β”€ middleware/         # Express middleware
β”‚   └── utils/              # Utility functions
└── README.md

Development Scripts

Backend

# Start development server
npm start

# Run tests
npm test

# Build for production
npm run build

Mobile App

# Run on Android
flutter run -d android

# Run on iOS
flutter run -d ios

# Build APK
flutter build apk

# Build iOS
flutter build ios

Hardware Development

ESP32 Setup

The system supports ESP32-based sensors with the following capabilities:

  • Bluetooth Serial Communication: RFCOMM protocol
  • Multi-sensor Support: Temperature, humidity, GPS, accelerometer
  • Real-time Data Streaming: JSON-formatted sensor data
  • Low Power Mode: Battery optimization features

Sensor Data Format

{
  "temperature": 25.5,
  "humidity": 60.2,
  "latitude": 40.7128,
  "longitude": -74.0060,
  "speed": 15.3,
  "altitude": 10.2,
  "satellites": 8,
  "time": "12:34:56"
}

πŸ§ͺ Testing

Running Tests

# Backend tests
cd bikesafe-backend
npm test

# Flutter widget tests
cd bikesafe_app
flutter test

# Integration tests
flutter test integration_test/

🀝 Contributing

We welcome contributions to BikeSafe! Please follow these steps:

  1. Fork the Repository
  2. Create a Feature Branch: git checkout -b feature/your-feature-name
  3. Make Your Changes: Follow our coding standards
  4. Test Your Changes: Ensure all tests pass
  5. Submit a Pull Request: Describe your changes clearly

Coding Standards

  • Flutter: Follow Dart style guide
  • Node.js: Use ESLint configuration provided
  • Git Commits: Use conventional commit format

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

Getting Help

  • Documentation: Check this README and inline code comments
  • Issues: Report bugs via GitHub Issues
  • Discussions: Join our community discussions

Help & Guidance

The app includes a built-in help system with guides for:

  • Registration and login
  • Device pairing and connection
  • Monitoring features
  • Alert management
  • Troubleshooting

Contact

For technical support or questions:


Made with ❀️ for cyclists everywhere

⬆ Back to Top

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published