Pineapple Gallery is a web application for managing and displaying galleries of images. πΈ It is built using Hono and leverages Cloudflare Workers, D1, and R2 for backend services. π
- User-Friendly Interface: Easy to navigate and manage galleries. π
- Cloudflare Integration: Utilizes Cloudflare Workers, D1, and R2 for efficient and scalable backend operations. π
- Multi-Language Support: Supports multiple languages for a global audience. π
- Admin Panel: Comprehensive admin panel for managing galleries and images π οΈ
- Basic Authentication: Secure admin access with username/password protection π
- Image Management: Upload, delete, and toggle image approval status π
- Cache Control: Manual cache purging and automated cache middleware π
- Frontend: Hono (with server-side rendering), HTMX
- Backend: Hono, Cloudflare Workers
- Database: Cloudflare D1
- Storage: Cloudflare R2
- Cache: Cloudflare KV
- Main Route: The main route (
/
) is server-side rendered, generating HTML on the server for dynamic content. - Admin Routes: The admin routes (
/admin/*
) are also server-side rendered, providing a dynamic and responsive admin panel.
- Description
- Quick Start
- Prerequisites
- Setup
- Development
- Deployment
- Known Issues
- To Do
- License
- Contributing
Before you start, you need the following:
- Node.js and npm installed
- A Cloudflare account
- Wrangler installed
-
Node.js and npm: Ensure you have Node.js and npm installed. You can download them from Node.js official website.
-
Cloudflare Account: Sign up for a Cloudflare account at Cloudflare.
-
Wrangler: Install Wrangler, the Cloudflare Workers CLI tool, by running:
npm install -g @cloudflare/wrangler
-
Clone the repository:
git clone https://github.com/Endriur24/PineappleGallery.git cd PineappleGallery
-
Install dependencies:
npm install
-
Create a D1 database:
wrangler d1 create "pineapplegallery-database"
Paste the results, which look like this, into
wrangler.toml
(keep the binding name the same = "DB"):[[d1_databases]] binding = "DB" database_name = "pineapplegallery-database" database_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
-
Create an R2 bucket:
wrangler r2 bucket create "pineapplegallery-bucket"
Update
wrangler.toml
according to the response, but keep the binding name the same as below ("R2"):[[r2_buckets]] binding = "R2" bucket_name = "pineapplegallery-bucket"
-
Create KV namespace for cache functionality
wrangler kv namespace create CACHE_KV
Update
wrangler.toml
according to the response, but keep the binding name the same as below:[[kv_namespaces]] binding = "CACHE_KV" id = "42ee21cd50bf44adb285c6c3d02727cd" #paste your own id
-
Create .dev.vars according to example (image transformations doesnt work locally)
Start the development server:
npm run dev
Deploy the application:
npm run deploy
Turn on image transformations for your account in cloudflare dashboard.
The following environment variables need to be set:
USERNAME
- Admin panel usernamePASSWORD
- Admin panel password
The gallery can be mounted on any path by adjusting both index.jsx
and wrangler.toml
POST /api/toggleApproval
- Toggle image approval statusDELETE /api/deleteImage
- Delete an imagePOST /:galleryTableName
- Edit gallery detailsPOST /:galleryTableName/upload
- Upload images to galleryDELETE /:galleryTableName/delete
- Delete entire galleryPOST /:galleryTableName/purge
- Manual cache purge for gallery
/admin/
- Gallery listing and management/admin/new-gallery
- Create new gallery/admin/:galleryTableName
- Single gallery management
when photoswipe lightbox is opened - crashes when changing orientation from landscape to portrait
- gallery password protection
- displaying location
- automatic publication according to publication date
- images approval system
- client side js translations
This project is licensed under the MIT License.
Contributions are welcome!