Skip to content

jpke/bagacam-public

Repository files navigation

BagaCam

A serverless video streaming application for live and time-travel playback from a Raspberry Pi camera, powered by AWS Kinesis Video Streams.

Deployed at: baga.jpearnest.com

BagaCam Landing Page
Landing page with Google SSO

BagaCam Webcam View
Live stream with time travel controls

Features

  • Live Streaming: Watch real-time video from a Raspberry Pi camera
  • Time-Travel Playback: Seek to any point in the last 24 hours
  • Google SSO: Secure authentication via AWS Cognito
  • Serverless Architecture: Fully managed AWS infrastructure

Architecture

See ARCHITECTURE.md for detailed diagrams and component descriptions.

flowchart LR
    Pi[Raspberry Pi] --> KVS[Kinesis Video Streams]
    KVS --> Lambda
    Lambda --> App[React App]
    App --> CF[CloudFront]
Loading

Tech Stack

Component Technology
Frontend React 19, Vite, TypeScript, Tailwind CSS
Video Player hls.js
Authentication AWS Cognito, Google OAuth
Backend AWS Lambda (Python 3.11), API Gateway
Video Streaming AWS Kinesis Video Streams
Hosting AWS S3, CloudFront
Infrastructure Terraform, Terragrunt

Project Structure

bagacam/
├── app/                    # React frontend (Vite)
│   ├── components/         # UI components (VideoPlayer, Dashboard, etc.)
│   ├── services/           # API clients
│   ├── config/             # Amplify configuration
│   └── .env.example        # Environment template
├── backend/                # Lambda functions (Python)
│   └── src/handlers/       # Lambda handlers
├── infrastructure/         # Terraform/Terragrunt IaC
│   ├── modules/            # Reusable Terraform modules
│   └── environments/       # Environment-specific config
└── scripts/                # Development utilities

Quick Start

Prerequisites

  • Node.js 20+
  • AWS CLI configured with appropriate permissions
  • (Optional) Raspberry Pi streaming to Kinesis Video Streams

Local Development

  1. Install dependencies:

    cd app && npm install
    cd ../scripts && npm install
  2. Configure environment:

    cp app/.env.example app/.env.local
    # Edit app/.env.local with your configuration
  3. Start development server:

    # Terminal 1: Start KVS proxy (optional, for local video testing)
    cd scripts && npm run proxy
    
    # Terminal 2: Start frontend
    cd app && npm run dev
  4. Open http://localhost:5173

Build for Production

cd app
npm run build

Deployment

Infrastructure is deployed via AWS CodePipeline triggered by GitHub pushes.

Deployment Order:

  1. KMS (encryption keys)
  2. SSM (configuration)
  3. Cognito (authentication)
  4. ACM (SSL certificates)
  5. Lambda (backend)
  6. API Gateway
  7. Frontend Hosting (S3 + CloudFront + CodePipeline)

See infrastructure/ for Terragrunt configurations.

License

MIT License - see LICENSE for details.

About

Live video streaming with React, AWS KVS, and Terraform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors