_ _ _ _
| | | | (_) | |
| | ___ ___ __ _| | _ _ __ | | __
| | / _ \ / __/ _` | | | | '_ \| |/ /
| |___| (_) | (_| (_| | |___| | | | | <
|______\___/ \___\__,_|______|_|_| |_|_|\_\
Inspired by Life360 β’ Built with Next.js 15, React 19, Express 5, Socket.IO & MapLibre GL
π Live Demo β’ β¨ Features β’ ποΈ Architecture β’ π οΈ Tech Stack β’ π Quick Start β’ βοΈ Configuration β’ π Scripts β’ π’ Deployment
Most commercial location apps lock essential family safety features behind steep monthly subscriptions or harvest personal tracking data.
LocaLink is an open-source, privacy-first alternative offering:
- Zero Third-Party Map Costs: Uses MapLibre GL + OpenStreetMap vector tiles instead of expensive Google Maps or Mapbox APIs.
- True Real-Time: Sub-20ms bidirectional WebSocket sync powered by Socket.IO.
- Complete Privacy: 1-click Ghost Mode, private invite codes, and fully self-hostable backend.
|
|
|
|
|
|
flowchart TD
subgraph Client["Frontend Client (Next.js 15 + React 19)"]
UI["App Router Pages & shadcn/ui"]
Map["MapLibre GL JS (OpenStreetMap Tiles)"]
Audio["Web Audio FX Engine"]
State["Redux Toolkit (Auth) + Zustand (Live GPS)"]
end
subgraph Server["Unified Express 5 & Socket.IO Server"]
Express["Express REST API (/api/v1/*)"]
SocketIO["Socket.IO Engine (user:* & group:* rooms)"]
RateLimit["Rate Limiters (Auth vs General API)"]
NextHandler["Next.js SSR & Static Asset Pipeline"]
end
subgraph DatabaseLayer["Persistence & External APIs"]
Prisma["Prisma ORM Client v6"]
PostgreSQL[("PostgreSQL Database (Neon / Supabase / Local)")]
OAuth["Google & Facebook OAuth"]
Twilio["Twilio SMS Gateway"]
SMTP["Nodemailer (SMTP Emails)"]
end
UI --> State
Map --> UI
UI -->|HTTP / REST API| Express
UI -->|WebSocket Events| SocketIO
Express --> NextHandler
Express --> RateLimit
Express & SocketIO --> Prisma --> PostgreSQL
Express --> OAuth & Twilio & SMTP
| Domain | Technologies |
|---|---|
| Frontend Core | Next.js 15.5 (App Router) β’ React 19.2 β’ TypeScript 5.x |
| Styling & UI | Tailwind CSS v4 β’ shadcn/ui β’ Framer Motion 12 β’ Lucide Icons |
| Map & Geospatial | MapLibre GL JS 6.1 β’ OpenStreetMap Tiles (100% Free & Open) |
| State Management | Redux Toolkit (Session/Theme) β’ Zustand 5 (GPS Telemetry) β’ TanStack Query v5 |
| Backend Service | Express 5.2 β’ Socket.IO 4.8 β’ Node.js 20+ |
| Database & ORM | PostgreSQL β’ Prisma ORM 6.19 (9 Relational Models) |
| Authentication | JWT (Access + Refresh) β’ HttpOnly Cookies β’ bcrypt β’ Google & Facebook OAuth |
| Communications | Nodemailer (Handlebars templates) β’ Twilio SMS / OTP |
| Developer Tools | Swagger UI (/api-docs) β’ ESLint 9 β’ ts-node β’ nodemon |
# 1. Clone repository
git clone https://github.com/samimcodes/live-location-platform.git
cd live-location-platform
# 2. Install packages (--legacy-peer-deps recommended for React 19)
npm install --legacy-peer-deps
# 3. Setup environment variables
cp .env.example .env# Run Prisma migrations
npm run db:migrate
# Generate Prisma Client
npm run db:generatenpm run dev- π Web App: http://localhost:3000
- π API Docs (Swagger): http://localhost:3000/api-docs
Click to view essential .env variables
# Application
NODE_ENV=development
PORT=3000
FRONTEND_URL=http://localhost:3000
# Database (PostgreSQL / Neon / Supabase)
DATABASE_URL="postgresql://user:password@localhost:5432/localink?schema=public"
# JWT Authentication
JWT_SECRET=your_super_secret_jwt_access_key_min_32_chars
JWT_EXPIRES_IN=7d
JWT_REFRESH_SECRET=your_super_secret_refresh_key_min_32_chars
JWT_REFRESH_EXPIRES_IN=30d
# Social Logins (Optional)
NEXT_PUBLIC_GOOGLE_CLIENT_ID=your_google_client_id.apps.googleusercontent.com
NEXT_PUBLIC_FACEBOOK_APP_ID=your_facebook_app_id
# Map Initial Viewport
NEXT_PUBLIC_MAP_DEFAULT_LAT=23.8103
NEXT_PUBLIC_MAP_DEFAULT_LNG=90.4125
NEXT_PUBLIC_MAP_DEFAULT_ZOOM=11
# Email & SMS Services (Optional)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your_email@gmail.com
SMTP_PASS=your_app_password
TWILIO_ACCOUNT_SID=your_twilio_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=+1234567890Click to view repository structure
localink/
βββ prisma/
β βββ schema.prisma # PostgreSQL models (User, Location, Group, etc.)
β
βββ server/ # Custom Express 5 backend
β βββ index.ts # HTTP & Socket.IO entry point
β βββ controllers/ # Auth, Friend, Location, Group, SMS controllers
β βββ routes/ # REST endpoints prefixed with /api/v1/*
β βββ middlewares/ # JWT auth verification, rate limiters, upload guards
β βββ socket/ # Socket.IO handlers (live tracking, emergency SOS)
β βββ swagger/ # OpenAPI 3.0 specification (/api-docs)
β
βββ src/ # Next.js 15 frontend
βββ app/ # App Router: Landing, Auth, Dashboard, Map, Settings
βββ components/
β βββ landing/ # Hero, Features, SOS Demo, Pricing, Map preview
β βββ map/ # LiveMap, EmergencySOSModal, MarkerPanel, Controls
β βββ dashboard/ # Sidebar, Navbar, CommandPalette, KPI Telemetry
β βββ ui/ # Accessible shadcn/ui components
βββ hooks/ # Data hooks (useFriends, useGroups, useLocationSharing)
βββ store/ # Global state (Redux auth + Zustand live GPS)
βββ lib/ # Axios client, Web Audio soundFx, date & map utilities
WebSocket events stream through authenticated rooms (user:<id> and group:<id>):
| Event | Direction | Purpose |
|---|---|---|
location:update |
Client β Server | Broadcast live GPS coordinates, speed, and heading |
sos:dispatch |
Client β Server | Trigger emergency distress beacon & sound alarm |
location:receive |
Server β Client | Deliver updated friend marker coordinates |
sos:alert |
Server β Client | Deliver high-priority distress alert with pinpoint GPS |
friend:online / offline |
Server β Client | Real-time presence updates |
notification |
Server β Client | Instant push alert for geofences and friend requests |
| Command | Description |
|---|---|
npm run dev |
Start development server (Next.js + Express + Socket.IO with hot-reload) |
npm run build |
Compile Next.js production build & compile server TypeScript |
npm run start |
Run compiled production server from dist/ |
npm run type-check |
Run strict TypeScript checks across client & server |
npm run lint |
Run ESLint validation |
npm run db:migrate |
Execute pending Prisma database migrations |
npm run db:studio |
Open interactive Prisma Studio GUI at localhost:5555 |
LocaLink is live on Render: https://localinks.onrender.com
- Create a new Web Service on Render and connect this repository.
- Select runtime: Node.
- Set Build Command:
npm run build - Set Start Command:
npm run start - Configure your environment variables (
DATABASE_URL,JWT_SECRET,CORS_ORIGIN, etc.) in the Render dashboard.
FROM node:20-alpine AS runner
WORKDIR /app
COPY package*.json ./
RUN npm ci --legacy-peer-deps
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "run", "start"]This project is licensed under the MIT License β see the LICENSE file for details.
LocaLink β Connecting families, protecting loved ones, anywhere in the world.
Made with β€οΈ by Samim and open-source contributors.