Skip to content

Latest commit

Β 

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš— CampusPool

A full-stack smart ride-sharing platform built for campus communities.

CampusPool helps students create, discover, join, and manage rides within their campus β€” making everyday transportation more affordable, convenient, and community-driven.


πŸ”— Live Demo

Coming soon


πŸŽ₯ Project Demo

Coming soon


πŸ“Œ Problem Statement

Students often travel between hostels, academic buildings, railway stations, markets, and other locations around campus.

When students travel individually:

  • Transportation costs increase.
  • Fuel is wasted.
  • Available seats in private vehicles go unused.
  • Students have no centralized way to coordinate rides.
  • Finding people travelling in the same direction becomes difficult.

CampusPool addresses this problem by providing a centralized platform where students can create and discover shared rides, join available seats, and coordinate their campus transportation.

The goal is simple:

Travel together. Save money. Reduce unnecessary trips. Build a better campus community.


✨ Features

πŸ” Authentication

  • User Registration
  • User Login
  • User Logout
  • Passport-based authentication
  • Session-based authentication
  • Current-user endpoint (/auth/me)
  • Protected backend routes

πŸš— Ride Management

  • Create a ride
  • View ride details
  • Edit your rides
  • Cancel your rides
  • Delete your rides
  • View available rides
  • Date and time based ride information

πŸ‘₯ Ride Participation

  • Join an available ride
  • Leave a joined ride
  • Automatic passenger tracking
  • Automatic seat availability
  • Full ride detection
  • Prevent duplicate joining
  • Prevent ride owners from joining their own ride

πŸ“Š Dashboard

  • View rides
  • Total ride count
  • Active ride count
  • Ride management
  • Ride status information

🎯 Smart Ride States

CampusPool dynamically handles ride states such as:

  • Available
  • Joined
  • Full
  • Cancelled

The interface updates available actions based on the current user's relationship with the ride.


πŸ›  Tech Stack

Frontend

  • React
  • Vite
  • React Router
  • Tailwind CSS
  • Axios
  • React Hook Form
  • Zod
  • Lucide React
  • Framer Motion

Backend

  • Node.js
  • Express.js
  • Passport.js
  • Express Session
  • Mongoose

Database

  • MongoDB
  • MongoDB Atlas


πŸ—οΈ Architecture

CampusPool follows a full-stack client-server architecture.

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚      CampusPool     β”‚
                    β”‚     React Client    β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β”‚ HTTP / Axios
                               β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚    Express Server   β”‚
                    β”‚       REST API      β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                β”‚                β”‚
              β–Ό                β–Ό                β–Ό
        Authentication     Ride APIs        Dashboard
        Passport/Session   Create/Join/      Ride Management
                          Leave/Edit/Delete
                               β”‚
                               β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚     MongoDB Atlas   β”‚
                    β”‚   Users & Rides     β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‚ Project Structure

The project is divided into separate frontend and backend responsibilities.

CampusPool/
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ context/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── App.jsx
β”‚   β”‚
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ Controller/
β”‚   β”‚   β”œβ”€β”€ auth.js
β”‚   β”‚   └── dashboard.js
β”‚   β”‚
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ userSchema.js
β”‚   β”‚   └── rideSchema.js
β”‚   β”‚
β”‚   β”œβ”€β”€ Routes/
β”‚   β”‚   β”œβ”€β”€ auth.js
β”‚   β”‚   └── dashboard.js
β”‚   β”‚
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ ExpressError.js
β”‚   β”‚   └── wrapAsync.js
β”‚   β”‚
β”‚   β”œβ”€β”€ middlewares.js
β”‚   β”œβ”€β”€ schema.js
β”‚   └── index.js
β”‚
└── README.md

πŸ” Authentication Flow

CampusPool uses Passport.js with session-based authentication.

User Login
     β”‚
     β–Ό
React Frontend
     β”‚
     β”‚ POST /auth/login
     β–Ό
Express Backend
     β”‚
     β–Ό
Passport Authentication
     β”‚
     β–Ό
Session Created
     β”‚
     β–Ό
Authenticated User

The frontend can restore the current authenticated user through:

GET /auth/me

This allows the React application to maintain the user's authentication state even after a page refresh.


🚦 Ride Lifecycle

A ride can move through different states depending on its availability and owner's actions.

                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β”‚   Available  β”‚
                β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚
              Last seat occupied
                       β”‚
                       β–Ό
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β”‚     Full     β”‚
                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


Available / Full
       β”‚
       β”‚ Owner cancels
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Cancelled   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


Any ride
   β”‚
   β”‚ Owner deletes
   β–Ό
Removed from database

πŸ‘€ User Actions

Ride Owner

The owner can:

  • Edit the ride
  • Cancel the ride
  • Delete the ride

Other Users

Users can:

  • Join an available ride
  • Leave a ride they joined
  • View ride information

The UI dynamically changes according to:

  • Current user
  • Ride ownership
  • Passenger status
  • Available seats
  • Ride status

βš™οΈ Installation

1. Clone the repository

git clone https://github.com/your-username/CampusPool.git

2. Navigate to the project

cd CampusPool

3. Install dependencies

Install dependencies for both frontend and backend according to their respective package.json files.

4. Configure environment variables

Create a .env file in the backend and configure the required environment variables.

MONGO_URL=your_mongodb_connection_string
SECRET=your_session_secret

5. Start the backend

nodemon index.js

6. Start the frontend

npm run dev

The frontend will then be available through the Vite development server.


πŸš€ Future Improvements

CampusPool is currently evolving beyond its initial release.

Planned improvements include:

  • πŸ”” Real-time notifications
  • πŸ’¬ In-app chat
  • πŸ—ΊοΈ Google Maps integration
  • πŸ“ Location-based ride discovery
  • ⭐ Ride and user rating system
  • πŸ’³ Payment integration
  • πŸ”„ Real-time ride updates using Socket.IO
  • πŸ“± Improved mobile experience

πŸ›‘οΈ Security

The application separates frontend UI protection from backend authorization.

Backend authentication and authorization are enforced through middleware, while the frontend maintains the current authentication state through the AuthContext and /auth/me endpoint.

Sensitive environment variables such as database credentials and session secrets are never committed to the repository.


πŸ“ˆ Version

CampusPool V1.0.0

Initial stable release featuring:

  • Authentication
  • Ride creation
  • Ride discovery
  • Ride joining
  • Ride leaving
  • Ride editing
  • Ride cancellation
  • Ride deletion
  • Passenger management
  • Seat availability tracking
  • Dashboard
  • Session persistence

πŸ‘¨β€πŸ’» Author

Subhranil Mandal

CSE Student

JNU, New Delhi


❀️ About CampusPool

CampusPool is built around a simple idea:

Why travel alone when someone nearby is going the same way?

CampusPool aims to make campus transportation smarter, more affordable, and more connected β€” one shared ride at a time.

About

Inter campus mobility

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages