Skip to content

Full-stack ADU construction dashboard with real-time budgeting, role-based access, CMS-ready architecture, and comprehensive test coverage

License

Notifications You must be signed in to change notification settings

odanree/adu-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

58 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

ADU Construction Progress Dashboard

License: MIT Node.js Python React TypeScript Vite Code of Conduct

A modern React + TypeScript dashboard for tracking ADU construction progress, expenses, and milestones with real-time backend data management.

🎯 Features

✨ Current Features:

  • πŸ“Š Real-time budget tracking with backend persistence
  • πŸ’° Customizable multi-phase expense breakdown (configurable via CMS)
  • 🧾 Configurable expense items with dynamic details
  • πŸ“ˆ Animated progress visualization
  • πŸ” Email-based authentication with whitelist
    • Set WHITELISTED_EMAILS environment variable (comma-separated emails)
    • Dynamically loaded on each request, never hardcoded
  • πŸ”’ Whitelisted users see:
    • Full budget including all configured phases
    • All project phases and line items
    • Data Manager admin panel
  • πŸ‘₯ Non-whitelisted users see:
    • Public view with filtered phases
    • Project costs based on visibility rules
  • πŸ“± Fully responsive mobile design
  • ⚑ Built with React 18, TypeScript, Vite, and Tailwind CSS
  • πŸ—„οΈ Python backend with data persistence to JSON

πŸš€ Quick Start

Backend Setup

# Terminal 1: Start Python backend API
python3 server.py
# Runs at http://localhost:8888

Frontend Setup

# Terminal 2: Start React development server
npm install  # if needed
npm run dev
# Opens at http://localhost:5173

Then open: http://localhost:5173

πŸ” Email Whitelist Configuration

The dashboard uses email-based authentication to control access to sensitive features.

How It Works

  • The whitelist is loaded dynamically on every request from the WHITELISTED_EMAILS environment variable
  • This ensures Railway env vars are always fresh (not stale from startup)
  • Users with whitelisted emails get access to the Data Manager and full budget details
  • Non-whitelisted users see a public view only

Local Development

Add to .env file:

WHITELISTED_EMAILS=user1@example.com,user2@example.com

The .env file is loaded automatically by python3 server.py via dotenv.

Production (Railway)

  1. Go to your Railway project dashboard
  2. Click Variables
  3. Add a new variable:
    • Name: WHITELISTED_EMAILS
    • Value: email1@example.com,email2@example.com (comma-separated, no spaces)
  4. Deploy - the whitelist is now active

Important: The env var is read at request time, not at startup. This means Railway env vars are guaranteed to be available regardless of deployment timing.

πŸ“‹ Root Organization

This project follows industry-standard conventions for clean, professional structure:

Root Directory

Documentation & Governance:

Configuration:

  • package.json / package-lock.json - Node dependencies
  • tsconfig.json - TypeScript configuration
  • vite.config.ts - Build configuration
  • tailwind.config.js - CSS framework
  • postcss.config.js - CSS processing
  • eslint.config.mjs - Code linting
  • jest.config.js - Test framework
  • .env.example - Environment template
  • .gitignore - Git ignore rules
  • vercel.json - Deployment config

Application:

  • server.py - Python backend API
  • index.html - React entry point

Subdirectories

  • /docs/ - Comprehensive documentation (10+ markdown files)
  • /src/ - React components and application code
  • /api/ - Backend API routes
  • /assets/ - Static files and images
  • /tests/ - Test suites (Jest + Playwright E2E)

πŸ“š Documentation

Root Documentation

Getting Started

Understanding the Project

Technical & Deployment

Git & Version Control

πŸ”Œ API Endpoints

GET /api/data
  β†’ Returns all expense phases with line items
  
POST /api/data
  β†’ Save updated expense data to data.json
  
GET /api/sheets-link?email=USER_EMAIL
  β†’ Check if email is whitelisted and return Google Sheets link
  
GET /api/expenses-signoff
  β†’ Return expense sign-off status

πŸ—οΈ Data Structure

Budget Calculation: Dynamically calculated from configured phases

Phase Configuration

Phases are fully configurable via the Data Manager:

  • Each phase can contain multiple line items
  • Phase totals are auto-calculated from line items
  • Phases can be hidden/shown based on user role
  • Budget totals update automatically when data changes

πŸ” Authentication

Whitelisted emails are configured in .env file under VITE_WHITELISTED_EMAILS:

VITE_WHITELISTED_EMAILS=user1@example.com,user2@example.com

πŸš€ Deployment

Frontend (Vercel)

  • Deployed automatically from master branch to https://adu-dashboard.vercel.app/
  • Only deploys from master (prevents rate limiting from develop branch)
  • Built with Vite + React 18

Backend (Railway)

Critical Setup for Railway:

  1. Docker Configuration: Backend uses Dockerfile (not Nixpacks) to avoid building Node.js frontend

    • Python 3.11 slim image
    • Only copies server.py
    • Creates empty data.json on build
  2. Environment Variables (set in Railway dashboard):

    PORT=8080                                          (CRITICAL - must match target port)
    VITE_WHITELISTED_EMAILS=email1@example.com,email2@example.com
    VITE_API_URL=https://adu-dashboard-production.up.railway.app  (for frontend)
    VITE_GOOGLE_CLIENT_ID=<your-client-id>
    
  3. Networking Configuration (Railway dashboard β†’ Settings β†’ Networking):

    • Target Port: 8080 (must match PORT env variable)
    • Custom Domain: adu-dashboard-production.up.railway.app
  4. Health Check (set in railway.toml):

    • Path: /health
    • Timeout: 300 seconds

Deployment Process:

  1. Commit changes to master branch
  2. Railway auto-detects and rebuilds
  3. Verifies healthcheck at /health endpoint
  4. Routes traffic to port 8080

Troubleshooting:

  • If getting 502 errors: Check that PORT=8080 environment variable is set
  • If build fails: Verify Dockerfile is using Python-only (no npm)
  • If health check fails: Ensure /health endpoint is responding (check server.py logs)

Users with whitelisted emails see:

  • All project expense phases
  • Full budget with all line items
  • Data Manager admin panel
  • Cost breakdown by phase

πŸ› οΈ Admin Panel

Whitelisted users can access the Data Manager to:

  • Edit phase names and line item descriptions
  • Update cost values
  • Add/remove line items
  • Auto-calculated phase totals
  • Save changes to backend (persisted to data.json)

Access: Click "πŸ“Š Data Manager" button on dashboard footer (whitelisted users only)

πŸ“ Project Structure

Root Directory (Industry Standard)

/
β”œβ”€β”€ README.md                    # Main project documentation (you are here)
β”œβ”€β”€ package.json                 # Node dependencies and scripts
β”œβ”€β”€ tsconfig.json                # TypeScript configuration
β”œβ”€β”€ vite.config.ts               # Vite build configuration
β”œβ”€β”€ tailwind.config.js           # Tailwind CSS configuration
β”œβ”€β”€ postcss.config.js            # PostCSS configuration
β”œβ”€β”€ eslint.config.mjs            # ESLint configuration
β”œβ”€β”€ jest.config.js               # Jest test configuration
β”œβ”€β”€ vitest.config.mjs            # Vitest configuration
β”‚
β”œβ”€β”€ .env                         # Environment variables (local)
β”œβ”€β”€ .env.example                 # Environment variables template
β”œβ”€β”€ .gitignore                   # Git ignore rules
β”œβ”€β”€ vercel.json                  # Vercel deployment config
β”‚
β”œβ”€β”€ server.py                    # Python backend API server
β”œβ”€β”€ index.html                   # HTML entry point
β”‚
β”œβ”€β”€ src/                         # React source code
β”œβ”€β”€ api/                         # API routes/handlers
β”œβ”€β”€ assets/                      # Static assets
β”œβ”€β”€ tests/                       # Test files
β”œβ”€β”€ docs/                        # πŸ“š All documentation (organized)
β”œβ”€β”€ node_modules/                # Dependencies (auto-generated)
└── .git/                        # Git repository

Source Code Structure

src/
β”œβ”€β”€ App.tsx                      # Main app with data filtering
β”œβ”€β”€ Router.tsx                   # Page routing (Dashboard/Admin)
β”œβ”€β”€ pages/
β”‚   └── Admin.tsx               # Data manager admin panel
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ExpenseBreakdown.tsx    # Phase display
β”‚   β”œβ”€β”€ ProgressBar.tsx         # Progress visualization
β”‚   β”œβ”€β”€ StatCard.tsx            # Metric cards
β”‚   └── ... (other components)
β”œβ”€β”€ hooks/
β”‚   β”œβ”€β”€ useAuth.ts              # Authentication logic
β”‚   └── useFetchADUData.ts      # Data fetching
β”œβ”€β”€ styles/
β”‚   β”œβ”€β”€ Admin.css               # Admin panel styling
β”‚   β”œβ”€β”€ Router.css              # Navigation styling
β”‚   └── App.css                 # Global styles
└── types/
    └── index.ts                # TypeScript interfaces

Documentation Structure (/docs)

docs/
β”œβ”€β”€ QUICK_REFERENCE.md          # Quick commands and lookup
β”œβ”€β”€ ADMIN_SETUP.md              # Admin panel guide
β”œβ”€β”€ PROJECT-OVERVIEW.md         # Implementation status
β”œβ”€β”€ DEVELOPMENT-SUMMARY.md      # Development phases
β”œβ”€β”€ STRUCTURE.md                # Detailed directory info
β”œβ”€β”€ DEPLOYMENT.md               # Deployment instructions
β”œβ”€β”€ CHANGELOG.md                # Version history
β”œβ”€β”€ REACT-MIGRATION.md          # Migration notes
β”œβ”€β”€ GIT_AND_DOCUMENTATION_SUMMARY.md  # Git organization
└── GIT_COMMIT_SUMMARY.txt      # Detailed commit history

πŸš€ Deployment

See Deployment Guide for detailed instructions on:

  • Building for production
  • Deploying to Vercel
  • Deploying to AWS S3 + CloudFront
  • Other hosting options

πŸ”„ Recent Changes

Latest Updates (v2.0)

  • βœ… Multi-phase expense tracking with dynamic budgets
  • βœ… Email-based whitelist for access control
  • βœ… Data Manager admin panel with full CRUD operations
  • βœ… Backend data persistence to JSON file
  • βœ… Role-based budget visibility (whitelisted vs. public)
  • βœ… Animated progress visualization
  • βœ… Backend API with Python server
  • βœ… Railway deployment with Docker
  • βœ… Generic example data as fallback (real data from backend)
  • βœ… Refactored root directory with industry standards
  • βœ… All documentation moved to /docs directory

❓ Troubleshooting

Port 8888 already in use:

# Find and kill the process
lsof -i :8888
kill -9 <PID>

# Then restart
python3 server.py

Port 5173 already in use:

npm run dev -- --port 3000
# Will run on http://localhost:3000

Dependencies issues:

rm -rf node_modules package-lock.json
npm install
npm run dev

For more troubleshooting, see Deployment Guide.

πŸ”— Useful Links


Project Location: /
Last Updated: February 11, 2026
Status: βœ… v2.0 Production Ready
Built with: React 18, TypeScript, Python, Tailwind CSS

About

Full-stack ADU construction dashboard with real-time budgeting, role-based access, CMS-ready architecture, and comprehensive test coverage

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published