Skip to content

kwabsntim/surreal-artz

Repository files navigation

SurrealArTz

A modern web application that showcases surreal paintings from WikiArt, featuring a decoupled architecture with Go backend API and static frontend.

Features

  • Surreal Art Gallery: Browse beautiful surreal paintings from WikiArt
  • Pinterest-style Layout: Responsive masonry grid with image overlays
  • API-driven: RESTful Go backend with Redis caching
  • Modern Frontend: HTML/CSS/JavaScript with Masonry.js and ImagesLoaded
  • Docker Ready: Containerized deployment with Docker Compose
  • Production Deployed: Backend on Render, Frontend on Vercel

Tech Stack

  • Backend: Go (net/http), Redis caching, WikiArt API integration
  • Frontend: Vanilla JavaScript, HTML5, CSS3, Masonry.js
  • Deployment: Docker, Docker Compose, Render (backend), Vercel (frontend)
  • Database: Redis for API response caching

Quick Start

Prerequisites

  • Go 1.20+
  • Docker & Docker Compose
  • Redis (local or cloud)

Local Development

  1. Clone the repository

    git clone https://github.com/kwabsntim/surreal-artz.git
    cd surreal-artz
  2. Environment Setup

    # Copy environment template
    cp .env.example .env
    
    # Edit .env with your Redis credentials
    REDIS_ADDR=localhost:6379
    REDIS_USERNAME=default  # optional
    REDIS_PASSWORD=your_password
  3. Run with Docker Compose

    docker-compose up --build
  4. Access the application

Manual Setup (without Docker)

  1. Start Redis

    docker run --name redis -p 6379:6379 -d redis:7-alpine
  2. Run the Go server

    go mod tidy
    go run ./cmd

API Documentation

GET /paintings

Fetch paginated surreal paintings.

Parameters:

  • style (optional): Art style (default: "surrealism")
  • page (optional): Page number (default: 1)
  • limit (optional): Items per page (default: 10, max: 100)

Example:

curl "http://localhost:8080/paintings?style=surrealism&page=1&limit=20"

Response:

[
  {
    "id": "painting-id",
    "title": "The Persistence of Memory",
    "artistName": "Salvador Dalí",
    "yearAsString": "1931",
    "image": "https://example.com/painting.jpg"
  }
]

Project Structure

surreal-artz/
├── cmd/
│   └── server.go          # HTTP server entry point
├── internal/
│   └── wikiartz/
│       ├── interface.go   # Service interfaces
│       ├── models.go      # Data models
│       └── service.go     # WikiArt API integration
├── utils/
│   ├── parser.go          # Pagination utilities
│   └── redis.go           # Redis client wrapper
├── web/                   # Static frontend files
│   ├── index.html
│   ├── style.css
│   ├── app.js
│   └── config.js
├── Dockerfile
├── docker-compose.yml
├── go.mod
└── README.md

Deployment

Backend (Render)

  1. Connect your GitHub repo to Render
  2. Set build command: go build -o server ./cmd
  3. Set start command: ./server
  4. Add environment variables:
    • REDIS_ADDR: Your Redis Cloud URL
    • REDIS_USERNAME: default
    • REDIS_PASSWORD: Your Redis password

Frontend (Vercel)

  1. Import the repo to Vercel
  2. Set root directory: web
  3. Deploy (Vercel detects static site automatically)
  4. Update web/index.html with your Render backend URL

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

License

This project is licensed under the Creative Commons Attribution 4.0 International License.

CC BY 4.0

You are free to:

  • Share — copy and redistribute the material in any medium or format
  • Adapt — remix, transform, and build upon the material for any purpose, even commercially

Under the following terms:

  • Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made.

See the LICENSE file for full license text.

Acknowledgments


Enjoy exploring surreal art! 🎨

About

Surreal artz is a project I made to explore surreal paintings using the wiki artz api

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors