Red Head
A web application that displays Reddit posts from an archive.
Project Structure
.
├── Dockerfile # Docker configuration for the Python backend
├── docker-compose.yml # Docker Compose configuration
├── .gitignore # Git ignore rules
├── README.md # This file
├── src/
│ ├── server/ # Python Flask backend
│ │ ├── app.py # Main Flask application
│ │ ├── parse_archive.py # Archive parsing logic
│ │ ├── requirements.txt # Python dependencies
│ │ ├── sample_posts.json # Sample data
│ │ └── test_parse_archive.py # Tests
│ └── website/ # Frontend files
│ ├── app.js # JavaScript logic
│ ├── index.html # Main HTML file
│ ├── Reddit_Logo.webp # Logo image
│ └── styles.css # CSS styling
└── website/ # Additional website files
└── cache/ # Cache directory
Docker Setup
Prerequisites
- Docker Engine installed
- Docker Compose installed
Running the Application
-
Build and start the containers:
docker-compose up --build -
Run in detached mode:
docker-compose up -d -
Stop the containers:
docker-compose down
Environment Variables
The application uses the following environment variables:
ARCHIVE_DIR: Path to the archive directory (default:/app/archive)FLASK_ENV: Flask environment (default:production)
Ports
- 6006: Main application port (Flask server)
Volumes
The following volumes are mounted for development:
./src/server→/app/src/server./src/website→/app/website./website/cache→/app/website/cache
Development
Making Changes
- Modify source code in the
src/directory - Docker will automatically reload the application
- Access the application at
http://localhost:6006
Testing
To test the Docker setup:
# Build the images
docker-compose build
# Start the containers
docker-compose up -d
# Check container status
docker-compose ps
# View logs
docker-compose logs app
# Stop containers
docker-compose down
API Endpoints
GET /posts- Get first 10 posts for initial loadGET /posts/more?count=N- Get next 10 posts, starting from index NGET /posts/total- Get total number of posts availableGET /- Server status endpoint
Architecture
The application consists of:
-
Python Flask Backend (
src/server/)- Serves API endpoints
- Handles archive parsing
- Serves static frontend files
-
Frontend (
src/website/)- HTML, CSS, and JavaScript
- Fetches data from the backend API
- Implements infinite scrolling
Dependencies
Python Dependencies (from src/server/requirements.txt):
- Flask
- Flask-CORS
- Pillow
- beautifulsoup4
- requests
Frontend Dependencies:
- None (pure HTML/CSS/JavaScript)
License
This project is licensed under the MIT License.
Description
Web app for browsing posts from a local Reddit archive — Dockerized Python backend with a minimal frontend.
Languages
Python
33.2%
JavaScript
30.3%
CSS
19.5%
C
11.8%
HTML
3.8%
Other
1.4%