🚌 Open Bus Backend

August 24, 2025 Β· View on GitHub

A backend service powering the Open-Bus platform. Provides APIs for health checks, GitHub issue creation, complaints, and government transportation data.

πŸ“’ Get Involved

πŸ“– API Documentation

βš™οΈ Installation

npm install

🌍 Environment Variables

Create a .env file:

# Server Configuration
PORT=3001
HOST=0.0.0.0
NODE_ENV=development
LOG_LEVEL=info

# GitHub Configuration
GITHUB_TOKEN=your_github_token
GITHUB_OWNER=your_github_username
GITHUB_REPO=your_repository_name

πŸš€ Running the Server

Development

npm run dev

Production

npm start

πŸ§ͺ Testing

# Run all tests
npm test

# Run with coverage
npm run test:coverage

# Run lint checks
npm run test:lint

# Fix lint issues
npm run lint:fix

🐳 Running with Docker

  1. Build the image
docker build -t open-bus-backend .
  1. Run the container
docker run -it -p 3001:3001 \
  -e GITHUB_TOKEN=your_github_token \
  -e GITHUB_OWNER=your_github_owner \
  -e GITHUB_REPO=your_github_repo \
  -e LOG_LEVEL=info \
  open-bus-backend

πŸ”— API Endpoints

🩺 Health Check

  • GET / β†’ Returns server status

🐞 GitHub Issues

  • POST /issues β†’ Create a new GitHub issue
    • Required: title, contactName, contactEmail, description, environment, expectedBehavior, actualBehavior, reproducibility
    • Optional: attachments[] (array of URLs)

πŸ“£ Complaints

  • POST /complaints β†’ Submit a complaint to government forms
    • Required:

      • userData: firstName, lastName, id, email, phone
      • databusData: operator
    • Optional: debug, complaintType, description

πŸ›οΈ Government Transportation

EndpointMethodRequired Body
/gov/lines-by-stationPOSTEventDate, OperatorId, StationId
/gov/stations-by-linePOSTeventDate, OperatorId, OfficelineId, Directions
/gov/subjectsPOSTlistName = "subject_type_vehicles"
/gov/train-stationsPOSTStationTypeId
/gov/pniyaPOSTlistName = "pniya"
/gov/not-real-numbersPOSTlistName = "notrealnumbers"
/gov/lines-by-linePOSTeventDate, OperatorId, OperatorLineId
/gov/citiesPOSTnone
/gov/timeGETnone

Server will be available at: http://localhost:3001