This repository contains the full CrowdShield application, structured as a monorepo with a separate backend and frontend.
backend/: A Node.js and Express.js server that handles API requests, user authentication, real-time location updates via WebSockets, and interaction with the MongoDB database.crowdshield-frontend/: A modern React client application built with Vite and TypeScript. It provides the user interface for map visualization, reporting, and interacting with the backend services.
To run this project locally, you will need to start both the backend server and the frontend development server.
# Navigate to the backend directory
cd backend
# Install dependencies
npm install
# Create a local environment file from the example
cp .env.example .env
# IMPORTANT: Open .env and fill in your actual secrets
# (e.g., MongoDB URI, JWT Secret, Cloudinary keys)
# Start the server in development mode (with hot-reloading)
npm run devThe backend server will typically start on http://localhost:5000.
# Navigate to the frontend directory from the root
cd crowdshield-frontend
# Install dependencies
npm install
# Create a local environment file if you need to override defaults
# (e.g., VITE_API_URL to point to your backend)
# touch .env.local
# Start the frontend development server
npm run devThe frontend will be available at http://localhost:5173 (or another port if 5173 is busy).
This monorepo is structured for easy deployment on modern hosting platforms.
-
Backend: Deploy the
backenddirectory as a web service on platforms like Render, Railway, or Heroku.- Set the
NODE_ENVenvironment variable toproduction. - Use the platform's secret management to store your production environment variables.
- The start command is
npm start.
- Set the
-
Frontend: Deploy the
crowdshield-frontenddirectory as a static site on platforms like Vercel, Netlify, or Cloudflare Pages.- The build command is
npm run build. - Set the
VITE_API_URLenvironment variable to the URL of your deployed backend service.
- The build command is
backend:npm run dev: Starts the backend withnodemon.npm start: Starts the backend for production.
crowdshield-frontend:npm run dev: Starts the Vite development server.npm run build: Builds the frontend for production.npm run lint: Lints the frontend codebase.