Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

49 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Avaya Banner

Avaya โ€” Women's Safety Navigation

Because the safest path and the shortest path are two very different things.


๐ŸŒธ The Problem

Every day, millions of women make a decision that most people never think about โ€” "Is this route safe enough?"

Traditional maps like Google Maps optimize for speed and distance. They don't know which street is poorly lit. They don't know which lane has a history of incidents. They don't factor in whether a route has CCTV coverage or is near a police station.

Avaya was built to change that.

We show you the safest route, not just the shortest one โ€” scored dynamically using real-world safety factors, adjusted in real-time based on the time of day.


โœจ Key Features

๐Ÿ—บ๏ธ Safety-Scored Routing

Every road segment on the map is scored and color-coded based on real factors:

Factor How It's Used
๐Ÿ’ก Street Lighting Lit roads boost the safety score
๐Ÿ“น CCTV Presence Surveilled areas score higher
๐Ÿ‘ฅ Crowd Density High-traffic areas feel safer
๐Ÿš” Police Proximity Closer to a station = higher score
๐Ÿ“Š Incident History Past reports lower the score
๐ŸŒ™ Time of Day Scores dynamically adjust at night

Routes are presented side-by-side โ€” so you can compare the safest path vs. the shortest path and make an informed choice.


๐Ÿšจ One-Tap SOS Emergency

When every second counts, Avaya's SOS button does everything at once:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  ๐Ÿ‘† ONE TAP                                     โ”‚
โ”‚                                                 โ”‚
โ”‚  โ†’ ๐Ÿ“ Pins your exact live location on the map  โ”‚
โ”‚  โ†’ ๐Ÿš” Sends location to nearest police station  โ”‚
โ”‚  โ†’ ๐Ÿ“ข Posts an alert to the community feed      โ”‚
โ”‚                                                 โ”‚
โ”‚  No typing. No searching. Just one tap.         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿค Community Feed

A built-in social safety network where users can:

  • ๐Ÿ“ Share safety tips and local advisories
  • โš ๏ธ Report incidents to warn others in real-time
  • ๐Ÿšจ See SOS alerts from nearby users with live location
  • ๐Ÿ’ฌ Comment and support each other
  • โค๏ธ Like posts to surface the most important ones

๐Ÿ” Secure Authentication

Powered by Clerk, Avaya supports:

  • Email/password sign-up & sign-in
  • Social login (Google, GitHub, etc.)
  • Protected routes โ€” map & community require authentication
  • User avatars and profile management

๐Ÿ—๏ธ Architecture

avaya/
โ”œโ”€โ”€ client/                    # React Frontend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Map/           # AvayaMap, RoadLayer, UserMarker, DestinationMarker
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ UI/            # SOSButton, SOSModal, SearchBar, RoutePanel,
โ”‚   โ”‚   โ”‚   โ”‚                  # RouteSelectorPanel, SafetyLegend, Toast, etc.
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Layout/        # SiteHeader, SiteFooter, SiteLayout, AuthLayout
โ”‚   โ”‚   โ”œโ”€โ”€ pages/             # Landing, Map, SignIn, SignUp, About, Contact,
โ”‚   โ”‚   โ”‚                      # HowItWorks, SafetyTips, NotFound
โ”‚   โ”‚   โ”œโ”€โ”€ services/          # API client (Axios)
โ”‚   โ”‚   โ”œโ”€โ”€ store/             # Zustand state management
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/             # Custom React hooks
โ”‚   โ”‚   โ””โ”€โ”€ main.jsx           # App entry with Clerk provider
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ backend/                   # Node.js API Server
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ roads.js       # Safe routing engine + road segments API
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ police.js      # Nearest police station lookup
โ”‚   โ”‚   โ”œโ”€โ”€ db/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ index.js       # PostgreSQL + PostGIS schema, triggers, views
โ”‚   โ”‚   โ””โ”€โ”€ middleware/
โ”‚   โ”‚       โ””โ”€โ”€ errorHandler.js
โ”‚   โ”œโ”€โ”€ server.js              # Express entry point
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ””โ”€โ”€ README.md

๐Ÿ› ๏ธ Tech Stack

Frontend

Technology Purpose
React 19 UI framework with latest concurrent features
Vite 7 Lightning-fast dev server and build tool
Tailwind CSS 4 Utility-first styling
Leaflet + React-Leaflet Interactive safety maps with custom layers
Clerk Authentication, user management, and protected routes
Zustand Lightweight state management
Axios HTTP client for API communication
Lucide React Beautiful, consistent iconography
React Router DOM 7 Client-side routing and navigation

Backend

Technology Purpose
Node.js Server runtime
Express 5 Web framework for API routes
PostgreSQL Relational database
PostGIS Spatial queries โ€” distance, geometry, geolocation
pgRouting Graph-based shortest/safest path computation
NeonDB Serverless PostgreSQL hosting
Graphology In-memory graph processing for route optimization
dotenv Environment variable management

๐Ÿงฎ How the Safety Score Works

Avaya computes a dynamic safety score (0โ€“10) for every road segment using a custom SQL view:

Final Score = Base Safety Score
              + Lighting Bonus         (+1.0 if lit)
              + CCTV Bonus             (+1.0 if present)
              + Crowd Level Bonus      (+1.0 high / -1.0 low)
              + Police Proximity Bonus (up to +2.0 based on distance)
              - Incident Penalty       (up to -3.0 based on reports)
              ร— Night Modifier         (ร—0.7 between 10 PM โ€“ 5 AM)

This score is recalculated in real-time so the same road may be rated differently at noon versus midnight.


๐Ÿš€ Getting Started

Prerequisites

  • Node.js โ‰ฅ 18
  • PostgreSQL with PostGIS & pgRouting extensions (or a NeonDB account)
  • Clerk account for authentication (clerk.com)

1. Clone the repository

git clone https://github.com/your-username/avaya.git
cd avaya

2. Backend Setup

cd backend
npm install

Create a .env file:

NODE_ENV=development
DATABASE_URL=postgresql://user:password@host/dbname?sslmode=require
PORT=5000

Start the dev server:

npm run dev

Verify it's working:

GET http://localhost:5000/health
โ†’ { "status": "ok", "db": "connected" }

3. Frontend Setup

cd client
npm install

Create a .env file:

VITE_API_BASE_URL=http://localhost:5000
VITE_CLERK_PUBLISHABLE_KEY=pk_test_your_clerk_key

Start the dev server:

npm run dev

Visit http://localhost:5173 ๐ŸŽ‰


๐Ÿ“ก API Endpoints

Roads & Routing

Method Endpoint Description
GET /api/roads/segments Get all road segments with safety scores
GET /api/roads/route Compute safest route between two points

Police Stations

Method Endpoint Description
GET /api/police/nearest?lat=&lng= Find nearest active police station

Community

Method Endpoint Description
GET /api/community/posts Paginated community feed with filters
POST /api/community/posts Create a new post
GET /api/community/posts/:id Get post details with comments
POST /api/community/posts/:id/comments Add a comment
POST /api/community/posts/:id/like Toggle like on a post
POST /api/community/sos-alert Trigger an SOS community alert

Health

Method Endpoint Description
GET /health Server + database health check

๐Ÿ—ƒ๏ธ Database Schema

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  police_stations โ”‚     โ”‚    road_segments      โ”‚     โ”‚     users      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค     โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค     โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ id               โ”‚โ—„โ”€โ”€โ”€โ”€โ”‚ nearest_police_id    โ”‚     โ”‚ id             โ”‚
โ”‚ name             โ”‚     โ”‚ road_name            โ”‚     โ”‚ name           โ”‚
โ”‚ phone            โ”‚     โ”‚ safety_score         โ”‚     โ”‚ phone          โ”‚
โ”‚ address          โ”‚     โ”‚ lighting             โ”‚     โ”‚ email          โ”‚
โ”‚ geom (Point)     โ”‚     โ”‚ crowd_level          โ”‚     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚ active           โ”‚     โ”‚ cctv_present         โ”‚            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚ incidents_reported   โ”‚            โ”‚
                         โ”‚ geom (LineString)    โ”‚     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚incident_reportsโ”‚
                                                      โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚ road_id        โ”‚
โ”‚ community_posts  โ”‚     โ”‚ community_comments   โ”‚     โ”‚ user_id        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค     โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค     โ”‚ description    โ”‚
โ”‚ id               โ”‚โ—„โ”€โ”€โ”€โ”€โ”‚ post_id              โ”‚     โ”‚ geom (Point)   โ”‚
โ”‚ clerk_user_id    โ”‚     โ”‚ clerk_user_id        โ”‚     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚ content          โ”‚     โ”‚ content              โ”‚
โ”‚ category         โ”‚     โ”‚ author_name          โ”‚     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ is_sos           โ”‚     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚community_likes โ”‚
โ”‚ sos_lat/lng      โ”‚                                  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ author_name      โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚ post_id        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                  โ”‚ clerk_user_id  โ”‚
                                                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Triggers:

  • trg_police_proximity โ€” auto-assigns the nearest police station to new road segments
  • trg_incident_count โ€” syncs incident count when new reports are filed

Views:

  • v_road_safety โ€” pre-computed final safety scores with time-of-day adjustments

๐Ÿ“ฑ Pages

Page Route Description
๐Ÿ  Landing / Hero section, feature showcase, how-it-works
๐Ÿ—บ๏ธ Map /map Interactive safety map with routing (auth required)
๐Ÿ“– How It Works /how-it-works Step-by-step guide to using Avaya
๐Ÿ›ก๏ธ Safety Tips /safety-tips Curated safety advice for women travelers
โ„น๏ธ About /about About the project and team
๐Ÿ“ž Contact /contact Contact form and information
๐Ÿ”‘ Sign In /sign-in Clerk authentication
๐Ÿ“ Sign Up /sign-up New user registration

๐ŸŒŸ Why "Avaya"?

The name comes from Abhaya (เค…เคญเคฏ) โ€” a Sanskrit word meaning fearless or without fear.

Avaya is our promise: a world where women can navigate any city, any street, at any hour โ€” without fear.

"Take up space. We'll handle the safety."


๐Ÿ‘ฅ Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the ISC License.


Built with โค๏ธ for a safer world
Avaya โ€” Let her walk safely.

About

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages