A real-time dashboard showing market data and tech news.
The Today Dashboard is built with a modern microservices architecture:
- React + TypeScript application built with Vite
- Located in
/srcdirectory - Key components:
- Market data visualization (TickerCard, TickerTable)
- Tech news aggregation (HackerNews, GithubTrending, RSSFeed)
- Reusable UI components in
/src/components/ui
- Custom hooks for data fetching and state management in
/src/hooks - Utility functions and constants in
/src/lib
A consolidated Go backend handles all data fetching and processing:
- Go Backend (
/backend/go-backend)- Built with Go Fiber framework
- Uses SQLite for data persistence
- Implements a job scheduler for periodic data fetching
- Key modules:
github: Scrapes and serves GitHub trending repositorieshackernews: Fetches and processes Hacker News storiestickers: Retrieves financial market data from Yahoo Financerss: Aggregates tech news from various RSS feeds
The application uses Caddy v2 as a reverse proxy to handle routing and load balancing. The key feature is its ability to intelligently route /api requests across multiple backend services.
The Caddy configuration provides efficient routing:
handle /api/* {
# Strip the /api prefix before forwarding to backend
uri strip_prefix /api
# Route to Go backend
reverse_proxy today-go-backend:3001 {
# Health checks
health_uri /health
health_interval 30s
health_timeout 10s
}
}Key Features:
- Clean API URL structure by stripping prefixes
- Health checking for backend service
- Secure headers and HTTPS handling
- Efficient routing of all API requests to the Go backend
/
├── src/ # Frontend React application
│ ├── components/ # React components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utilities and constants
│ └── pages/ # Page components
├── backend/
│ └── go-backend/ # Consolidated Go backend service
│ ├── pkg/ # Backend modules (github, hackernews, rss, tickers)
│ └── data/ # SQLite database directory
└── caddy/ # Caddy reverse proxy configuration
Before running the application, ensure you have the following installed:
Required for Production:
- Docker (20.10+)
- Docker Compose (v2+)
Required for Development:
# Check if all prerequisites are installed
make check-prereqs
# Complete fresh installation setup
make install
# For development mode
make dev
# OR for production mode
make prodThat's it! The Makefile handles everything automatically.
This project uses a comprehensive Makefile to simplify all workflows. The Makefile is designed to work on completely fresh installations.
Before starting, verify all required tools are installed:
make check-prereqsThis checks for Docker, Docker Compose, Node.js, npm, and Go.
For a complete fresh setup (first time):
make installThis command:
- ✅ Checks all prerequisites
- ✅ Creates environment files from
.env.example - ✅ Creates Docker network (
shared-web) - ✅ Prepares the system for deployment
Run the application locally for development:
make devThis will:
- Install all npm and Go dependencies
- Start Go backend on
http://localhost:3001 - Start React frontend on
http://localhost:5173 - Enable hot-reload for both services
Individual Services:
make dev-frontend # Frontend only (port 5173)
make dev-backend # Backend only (port 3001)Deploy using Docker containers:
# Complete production deployment from scratch
make prod
# OR step-by-step:
make install # Initial setup
make build # Build Docker images
make up # Start servicesProduction URLs:
- Frontend:
http://localhost - API:
http://localhost/api
Service Management:
make up # Start all services
make down # Stop all services
make restart # Restart all services
make status # Check service status
make health # Check health of servicesView logs from running services:
make logs # All services
make logs-frontend # Frontend only
make logs-backend # Backend only
make logs-caddy # Caddy onlyRun tests across the application:
make test # All tests
make test-backend # Backend tests onlyRebuild specific services without full cleanup:
make rebuild # Rebuild everything
make rebuild-frontend # Frontend only
make rebuild-backend # Backend only
make rebuild-caddy # Caddy onlyBackup and restore the SQLite database:
# Backup database
make db-backup
# Restore from backup
make db-restore BACKUP_FILE=backups/today-20231201-120000.dbRemove build artifacts and containers:
make clean # Remove containers and build artifacts
make clean-all # Complete cleanup including volumes and imagesmake shell-frontend # Open shell in frontend container
make shell-backend # Open shell in backend container
make shell-caddy # Open shell in Caddy container
make validate-caddy # Validate Caddyfile configuration
make update-deps # Update all dependenciesView the complete list of commands:
make helpClient Request
↓
[Caddy Reverse Proxy] :80/:443
↓
├─→ /api/* → [Go Backend] :3001 (internal)
│ ↓
│ [SQLite Database]
│
└─→ /* → [React Frontend] :80 (internal)
The Caddy configuration (caddy/Caddyfile) implements intelligent routing:
-
API Requests (
/api/*):- Strips the
/apiprefix - Forwards to
today-go-backend:3001 - Example:
http://localhost/api/tickers→http://today-go-backend:3001/tickers
- Strips the
-
Frontend Requests (everything else):
- Forwards to
today-frontend:80 - Serves the React SPA
- Handles client-side routing
- Forwards to
-
Security Headers:
- X-Content-Type-Options
- X-XSS-Protection
- X-Frame-Options
- Referrer-Policy
All services communicate through a shared Docker network:
shared-web (Docker network)
├── shared-caddy (caddy:2-alpine)
├── today-frontend (node:20-alpine)
└── today-go-backend (golang:1.23-alpine → alpine:latest)
Key Points:
- Services communicate via container names
- Internal ports are not exposed to host
- Only Caddy exposes ports 80/443
- SQLite database persists in Docker volume
The Go backend runs periodic jobs to fetch data:
- GitHub Trending: Every 1 hour
- Hacker News: Every 15 minutes
- RSS Feeds: Configurable intervals
- Ticker Data: On-demand (cached)
Data is stored in SQLite and served through REST APIs.