Skip to content

SamuraJey/viewport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

189 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Έ Viewport - Photo Portfolio Sharing Platform

A modern, full-stack photo portfolio sharing platform that enables photographers to upload, organize, and share their work through secure, expiring share links.

🎯 Project Overview

Viewport is a web application designed for photographers to:

  • πŸ“€ Upload and organize photos into galleries
  • πŸ”— Generate shareable links with customizable expiration dates
  • πŸ‘₯ Share galleries publicly without requiring authentication
  • ⬇️ Allow guests to download individual photos or entire galleries as ZIP files
  • πŸ“Š Track views and downloads with built-in metrics

πŸ› οΈ Tech Stack

Backend

  • Runtime: Python 3.13+
  • Framework: FastAPI (async, high-performance)
  • Database: PostgreSQL with SQLAlchemy ORM
  • Migrations: Alembic
  • Storage: S3-compatible (AWS S3 / rustfs)
  • Queue: Celery with Redis
  • Authentication: JWT (Python-JWT)
  • API Documentation: OpenAPI/Swagger

Frontend

  • Framework: React 19+ with TypeScript
  • Build Tool: Vite
  • Routing: React Router v7
  • State Management: Zustand
  • Styling: Tailwind CSS v4
  • HTTP Client: Axios
  • Testing: Vitest + React Testing Library

Infrastructure

  • Containerization: Docker & Docker Compose
  • Reverse Proxy: Nginx
  • Cache: Redis
  • Monitoring: Prometheus (optional)

πŸš€ Quick Start

Prerequisites

  • Docker & Docker Compose (recommended)
  • Or: Python 3.13+, Node.js 18+, PostgreSQL, Redis, rustfs

Option 1: Docker (Recommended)

git clone https://github.com/SamuraJey/viewport.git
cd viewport
docker-compose up -d

The application will be available at:

Option 2: Local Setup

Backend:

cd /viewport
python -m venv venv
source venv/bin/activate  # or `venv\Scripts\activate` on Windows
pip install -e .
uvicorn viewport.main:app --reload

Frontend:

cd frontend
npm install
npm run dev

See Development Setup Guide for detailed instructions.

πŸ“š Documentation

Complete documentation is organized into the following sections:

βš™οΈ Backend Guide

🐳 Deployment

πŸ”§ Development

πŸ“‹ Project Structure

viewport/
β”œβ”€β”€ docs/                           # Complete project documentation
β”‚   β”œβ”€β”€ api/                        # API reference and examples
β”‚   β”œβ”€β”€ backend/                    # Backend architecture & guides
β”‚   β”œβ”€β”€ frontend/                   # Frontend architecture & guides
β”‚   β”œβ”€β”€ deployment/                 # Deployment & infrastructure
β”‚   β”œβ”€β”€ development/                # Development guides
β”‚   └── ARCHITECTURE.md             # Overall system architecture
β”‚
β”œβ”€β”€ src/viewport/                   # Backend source code
β”‚   β”œβ”€β”€ api/                        # FastAPI route handlers
β”‚   β”‚   β”œβ”€β”€ auth.py                 # Authentication endpoints
β”‚   β”‚   β”œβ”€β”€ gallery.py              # Gallery management
β”‚   β”‚   β”œβ”€β”€ photo.py                # Photo upload & management
β”‚   β”‚   β”œβ”€β”€ sharelink.py            # Share link generation
β”‚   β”‚   └── public.py               # Public gallery access
β”‚   β”œβ”€β”€ models/                     # SQLAlchemy ORM models
β”‚   β”œβ”€β”€ schemas/                    # Pydantic request/response schemas
β”‚   β”œβ”€β”€ repositories/               # Data access layer
β”‚   β”œβ”€β”€ alembic/                    # Database migrations
β”‚   β”œβ”€β”€ main.py                     # FastAPI application entry point
β”‚   β”œβ”€β”€ auth_utils.py               # JWT & password utilities
β”‚   β”œβ”€β”€ db.py                       # Database configuration
β”‚   β”œβ”€β”€ rustfs_utils.py              # S3/rustfs utilities
β”‚   β”œβ”€β”€ cache_utils.py              # Redis caching utilities
β”‚   β”œβ”€β”€ metrics.py                  # Prometheus metrics
β”‚   └── logger.py                   # Logging configuration
β”‚
β”œβ”€β”€ frontend/                       # Frontend React application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/             # Reusable React components
β”‚   β”‚   β”œβ”€β”€ pages/                  # Page components
β”‚   β”‚   β”œβ”€β”€ hooks/                  # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ stores/                 # Zustand state stores
β”‚   β”‚   β”œβ”€β”€ services/               # API client services
β”‚   β”‚   β”œβ”€β”€ styles/                 # Global styles
β”‚   β”‚   β”œβ”€β”€ types/                  # TypeScript type definitions
β”‚   β”‚   β”œβ”€β”€ utils/                  # Utility functions
β”‚   β”‚   β”œβ”€β”€ App.tsx                 # Main App component
β”‚   β”‚   └── main.tsx                # Application entry point
β”‚   β”œβ”€β”€ public/                     # Static assets
β”‚   β”œβ”€β”€ package.json                # Frontend dependencies
β”‚   β”œβ”€β”€ tsconfig.json               # TypeScript configuration
β”‚   β”œβ”€β”€ vite.config.ts              # Vite build configuration
β”‚   β”œβ”€β”€ tailwind.config.js          # Tailwind CSS configuration
β”‚   └── vitest.config.ts            # Vitest testing configuration
β”‚
β”œβ”€β”€ tests/                          # Backend test suite
β”‚   β”œβ”€β”€ unit/                       # Unit tests
β”‚   β”œβ”€β”€ integration/                # Integration tests
β”‚   β”œβ”€β”€ fixtures/                   # Test fixtures & mocks
β”‚   └── conftest.py                 # Pytest configuration
β”‚
β”œβ”€β”€ config/                         # Configuration files
β”œβ”€β”€ scripts/                        # Utility scripts
β”œβ”€β”€ alembic.ini                     # Alembic configuration
β”œβ”€β”€ docker-compose.yml              # Docker Compose services
β”œβ”€β”€ Dockerfile.backend              # Backend Docker image
β”œβ”€β”€ Dockerfile.frontend             # Frontend Docker image
β”œβ”€β”€ Makefile                        # Development commands
└── pyproject.toml                  # Python project configuration

🎨 Key Features

For Photographers

  • βœ… Secure user authentication with JWT
  • βœ… Organize photos into galleries
  • βœ… Generate unique share links with optional expiration
  • βœ… View analytics (views, downloads)
  • βœ… Bulk and individual file downloads

For Guests

  • βœ… View galleries without authentication
  • βœ… Responsive gallery grid (desktop/tablet/mobile)
  • βœ… Lightbox image viewer
  • βœ… Download individual photos or entire galleries
  • βœ… Auto-expiring links for time-limited access

For Developers

  • βœ… Well-documented RESTful API
  • βœ… Comprehensive test coverage
  • βœ… Docker containerization for easy deployment
  • βœ… Database migrations with Alembic
  • βœ… Type-safe code with TypeScript/Pydantic

πŸ“Š Database Schema

The application uses PostgreSQL with the following main entities:

Users
  β”œβ”€β”€ Galleries (one-to-many)
  β”‚   β”œβ”€β”€ Photos (one-to-many)
  β”‚   └── ShareLinks (one-to-many)
  └── Auth tokens (one-to-many)

See Database Models Documentation for detailed schema.

πŸ§ͺ Testing

Backend Tests

pytest                              # Run all tests
pytest -v                           # Verbose output
pytest --cov=src/viewport          # With coverage report
pytest -k "test_upload"             # Run specific tests

Frontend Tests

npm test                            # Run tests in watch mode
npm run test:run                    # Run tests once
npm run test:coverage               # Generate coverage report
npm run test:ui                     # Open interactive UI

See Testing Guide for details.

πŸš€ Deployment

Quick Deployment

docker-compose -f docker-compose.yml up -d

Production Deployment

See Production Deployment Guide for:

  • Environment configuration
  • SSL/TLS setup
  • Database backups
  • Monitoring & logging
  • Performance optimization

πŸ”’ Security

  • βœ… JWT-based authentication with refresh tokens
  • βœ… Password hashing with bcrypt
  • βœ… File type validation (magic byte checking)
  • βœ… CORS configuration
  • βœ… Rate limiting (via Nginx)
  • βœ… HTTPS/TLS support

See Security Considerations for details.

🀝 Contributing

We welcome contributions! Please see Contributing Guide for:

  • Development workflow
  • Code standards
  • Testing requirements
  • Pull request process

πŸ“ License

[Add your license here]

πŸ’¬ Support & Contact

  • πŸ“§ Email: [contact info]
  • πŸ› Issues: [GitHub Issues Link]
  • πŸ’‘ Discussions: [GitHub Discussions Link]

πŸ“š Additional Resources


Last Updated: November 2025 Current Version: 0.1.0 Status: Active Development

About

Website for photographers, from the photographer

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors