A philosophical metaphor about pursuit and loss
δΈζζζ‘£ | English
A beautifully designed error page API service that explores the concept of "unattainability". Each error page is a visual narrative about absence, interruption, and unavailability.
This is a collection of error pages, each with a unique design style:
- 404 - Page Not Found (Dark red theme)
- 502 - Bad Gateway (Warm orange theme)
- 503 - Service Unavailable (Cool blue theme)
Each page features:
- Unique color schemes
- Elegant typography
- Smooth animations
- Noise textures and glow effects
- Real-time visit statistics
docker-compose up -dThe service will start on http://localhost:3000
Access different error pages:
http://localhost:3000/- Homepagehttp://localhost:3000/gallery- Gallery pagehttp://localhost:3000/404?style=dark&token=YOUR_TOKEN- 404 pagehttp://localhost:3000/502?style=warm&token=YOUR_TOKEN- 502 pagehttp://localhost:3000/503?style=cool&token=YOUR_TOKEN- 503 page
# Build image
docker build -t happiness-secrets .
# Run container
docker run -d -p 3000:3000 \
-e DATABASE_URL=postgres://postgres:postgres@db:5432/happiness_secrets?sslmode=disable \
happiness-secretsgo run main.go- β¨ Multiple beautifully designed error pages
- π¨ Unique color scheme and style for each page
- π Unified visit statistics
- πΎ Persistent data storage (PostgreSQL)
- π³ Docker containerized deployment
- π± Fully responsive design
- π RESTful API support
- π CORS cross-origin support
- π Easy integration into any project
- Frontend: HTML5 + CSS3 (Native animations)
- Backend: Go (Standard library)
- Database: PostgreSQL 16
- Deployment: Docker + Docker Compose
happiness-secrets/
βββ main.go # Go backend service
βββ go.mod # Go module definition
βββ pages/ # Error pages directory
β βββ index.html # Homepage
β βββ gallery.html # Gallery page
β βββ 404/ # 404 error pages
β β βββ dark.html # Dark style
β βββ 502/ # 502 error pages
β β βββ warm.html # Warm style
β βββ 503/ # 503 error pages
β βββ cool.html # Cool style
βββ Dockerfile # Docker image definition
βββ docker-compose.yml # Docker Compose configuration
βββ README.md # Project documentation
Visit the homepage and click "Generate Token" to create your unique token. Each token independently tracks visit statistics.
Access error pages directly in the browser:
https://your-domain.com/404?style=dark&token=YOUR_TOKEN
https://your-domain.com/502?style=warm&token=YOUR_TOKEN
https://your-domain.com/503?style=cool&token=YOUR_TOKEN
Get error page HTML via API:
GET /api/error?code=404&style=dark&token=YOUR_TOKEN
GET /api/error?code=502&style=warm&token=YOUR_TOKEN
GET /api/error?code=503&style=cool&token=YOUR_TOKEN
Response headers include visit count:
X-Visit-Count: 123
Use custom error pages in Nginx configuration:
server {
listen 80;
server_name your-domain.com;
# Custom error pages (with Token)
error_page 404 https://happiness-secrets.example.com/404?style=dark&token=YOUR_TOKEN;
error_page 502 https://happiness-secrets.example.com/502?style=warm&token=YOUR_TOKEN;
error_page 503 https://happiness-secrets.example.com/503?style=cool&token=YOUR_TOKEN;
location / {
proxy_pass http://localhost:8080;
}
}// Get error page and read visit statistics
async function loadErrorPage(code, style, token) {
const response = await fetch(
`https://happiness-secrets.example.com/api/error?code=${code}&style=${style}&token=${token}`
);
// Get visit count from response headers
const visitCount = response.headers.get('X-Visit-Count');
console.log('Visit count:', visitCount);
// Get HTML content
const html = await response.text();
document.open();
document.write(html);
document.close();
}
// Usage example
const myToken = 'YOUR_TOKEN';
loadErrorPage('404', 'dark', myToken);import { useEffect, useState } from 'react';
function ErrorPage({ code = '404', style = 'dark', token }) {
const [html, setHtml] = useState('');
const [visitCount, setVisitCount] = useState(0);
useEffect(() => {
fetch(`https://happiness-secrets.example.com/api/error?code=${code}&style=${style}&token=${token}`)
.then(res => {
setVisitCount(res.headers.get('X-Visit-Count'));
return res.text();
})
.then(setHtml)
.catch(console.error);
}, [code, style, token]);
return (
<div>
<div>Visit count: {visitCount}</div>
<div dangerouslySetInnerHTML={{ __html: html }} />
</div>
);
}- π Custom error pages for websites (via Nginx configuration)
- π¨ Art projects or conceptual exhibitions
- π» Creative elements for personal websites
- π€ Visual expression of philosophical thinking
- π Error page API service for other projects
- π± Error handling interface for frontend applications
Inspiration: The initial idea came from the concept of "Happiness Secrets" - placing a seemingly hopeful link in a personal signature, but upon access, it's a 404 error, forming a metaphor about expectation and disappointment.
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}certbot --nginx -d your-domain.com# Start
docker-compose up -d
# View logs
docker-compose logs -f
# Stop
docker-compose down
# Restart
docker-compose restartHappiness Secrets is not just a collection of error pages, it's a metaphor about pursuit and loss:
- 404 - The happiness you seek doesn't exist
- 502 - The path to happiness is interrupted
- 503 - Happiness is temporarily unavailable
Sometimes, happiness is like these error pages - we keep searching, only to find it may never have existed. Or perhaps, this search itself is a form of happiness?
MIT License
We welcome contributions! If you've designed a beautiful error page and want to share it with the community:
- Fork this repository
- Create a new branch for your design:
git checkout -b feature/add-404-minimal-style
- Add your error page:
- Place your HTML file in the appropriate directory (e.g.,
pages/404/your-style.html) - Follow the existing naming convention:
pages/{error-code}/{style-name}.html - Ensure your design is self-contained (inline CSS/JS preferred)
- Place your HTML file in the appropriate directory (e.g.,
- Update the backend (
main.go):- Add your style to the corresponding switch case
- Update the gallery (
pages/gallery.html):- Add a preview card for your design
- Test your design:
docker-compose up -d # Visit http://localhost:3000/gallery to preview - Commit and push:
git add . git commit -m "Add minimal style for 404 page" git push origin feature/add-404-minimal-style
- Create a Pull Request to the
mainbranch
- Self-contained: Prefer inline CSS and JavaScript
- Responsive: Ensure your design works on mobile devices
- Accessible: Follow accessibility best practices
- Unique: Bring your own creative vision
- Lightweight: Keep file size reasonable
- New styles for existing error codes (404, 502, 503)
- New error codes (500, 403, etc.)
- Creative interpretations of the "unattainability" theme
- Unique typography, color schemes, and animations
Issues and Pull Requests are welcome!
Made with π and philosophical humor