https://github.com/kosmaster87/super-rando
A modern, mobile-first web app, built with Vanilla JavaScript, CSS, and PHP. The project demonstrates professional frontend architecture and best practicesβwithout relying on external frameworks.
https://github.com/kosmaster87/super-rando
es6-modules listener php single-page-application-with-js state-management
Last synced: about 2 months ago
JSON representation
A modern, mobile-first web app, built with Vanilla JavaScript, CSS, and PHP. The project demonstrates professional frontend architecture and best practicesβwithout relying on external frameworks.
- Host: GitHub
- URL: https://github.com/kosmaster87/super-rando
- Owner: KosMaster87
- Created: 2025-08-22T16:46:55.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-11-08T13:15:09.000Z (8 months ago)
- Last Synced: 2025-11-08T14:52:20.792Z (8 months ago)
- Topics: es6-modules, listener, php, single-page-application-with-js, state-management
- Language: JavaScript
- Homepage: https://super-rando.dev2k.org/
- Size: 2.8 MB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π Super~Rando SPA - Fusion Cuisine Restaurant
A modern Single Page Application (SPA) for a fusion restaurant, developed with **Vanilla JavaScript, CSS, and PHP backend**. This project demonstrates professional frontend architecture without any external frameworks.
---
## π Live Demo
π [Live Demo β super-rando.dev2k.org](https://super-rando.dev2k.org)
π [API Dokumentation](https://super-rando.dev2k.org/docs/index.html)
---
## πΈ Preview

---
## β¨ Core Features
- π± **100% Vanilla JavaScript** - No external dependencies
- π¨ **Mobile First Responsive** - CSS Grid & Flexbox
- π **Smart Shopping Cart** - LocalStorage persistent
- π§ **Secure Contact Form** - Spam protection & email confirmation
- π **Toast Notifications** - User-friendly feedback
- βΏ **Accessibility Ready** - ARIA & keyboard navigation
## π Quick Start
```bash
npm install
npm run dev
# β Automatically opens http://localhost:3000
```
## ποΈ Architecture Highlights
### State Management β
```js
// Getter/Setter pattern for secure state access
export const getCartItems = () => [...appState.cart];
export const setCurrentPage = (page) => { notifyListeners(); };
// Reactive UI Updates
State change β notifyListeners() β automatic re-rendering
```
### Service Layer β
```
src/services/
βββ cart.js # Cart logic
βββ navigation.js # SPA routing
βββ contact-form.js # Form handling
βββ notification.js # Toast system
```
### 14-Line Functions β
```js
// Each function max. 14 lines, single responsibility
const handleCartClick = (itemName) => {
updateCartItem(itemName, { quantity: item.quantity + 1 });
saveCartToStorage();
notifyListeners();
};
```
## π Project Structure
```
Super-Rando-SPA/
βββ src/
β βββ app.js # App entry point
β βββ state.js # Central state + getter/setter
β βββ components/ # UI components
β β βββ pages/ # Page-specific components
β β βββ cart.js, header.js # Reusable components
β βββ services/ # Business logic
β βββ utils/ # Utility functions & constants
βββ styles/components/ # Component-based CSS
βββ assets/ # Images, icons, PWA manifest
βββ api/contact.php # Backend endpoint
```
## π§ Implemented Standards
### JavaScript β
- **ES6+ Modules** - Consistent import/export usage
- **14-Line Rule** - All functions comply
- **JSDoc Documentation** - All public functions
- **Immutable Updates** - State never mutated directly
- **Arrow Functions** - Modern syntax
### CSS β
- **Mobile First** - Breakpoints: 768px, 1024px, 1280px
- **CSS Custom Properties** - All colors as variables
- **Relative Units** - rem for sizing, px for borders
- **BEM-like Classes** - Consistent naming convention
### Security β
- **Honeypot Fields** - Bot protection
- **Math Captcha** - User-friendly spam prevention
- **Rate Limiting** - IP-based request limit (3/hour)
- **Input Sanitization** - XSS protection on client & server
## π Special Features
### Reactive UI Without Framework
```js
// Event-driven architecture
cart.add() β notifyListeners() β renderAllComponents() β reset events
```
### Session Restoration
```js
// Navigation & cart persist across browser reloads
localStorage: Cart + user preferences
sessionStorage: Current page + category filter
```
### Service-Oriented Architecture
```js
// Clear separation: presentation vs. business logic
Components: HTML rendering;
Services: State manipulation + API calls;
```
## π― Upcoming Features
### π§ In Development
- [ ] **Theme System** - Dark/Light mode
- [ ] **Multi-language Support** - DE/EN toggle
- [ ] **PWA Features** - Offline functionality
### π Roadmap
- [ ] **User Authentication** - Login/registration
- [ ] **Order History** - View past orders
- [ ] **Advanced Search** - Ingredient filtering
- [ ] **Push Notifications** - PWA notifications
## π§ API Documentation
### Contact Endpoint
```bash
POST /api/contact.php
Content-Type: application/json
{
"name": "Max Mustermann",
"email": "max@example.com",
"subject": "Reservation",
"message": "Table for 4 persons...",
"captcha": 42
}
```
**Features:**
- Rate limiting (3 requests/hour per IP)
- Dual email system (admin + confirmation)
- HTML email templates
- Comprehensive input validation
## π¨ Design System
```css
:root {
--color-primary: #ff6b6b; /* Coral */
--color-secondary: #4ecdc4; /* Teal */
--color-accent: #ffe66d; /* Yellow */
--color-surface: #ffffff; /* White */
--color-background: #f8f9fa; /* Light Gray */
}
```
**Typography:** Comic Neue (locally hosted) + system-ui fallback
## π» Development
### Browser Support
- β
Chrome/Edge/Firefox (modern versions)
- β
Safari (modern versions)
- β
Mobile browsers (iOS Safari, Chrome Mobile)
### Performance
- β‘ No framework overhead
- π± Touch-optimized interactions
- πΎ Aggressive LocalStorage usage
- π― CSS-only animations
## π License
MIT License - see [LICENSE](LICENSE) for details.
---
**π Built with β€οΈ for modern web development**
_A showcase for professional frontend architecture with Vanilla JavaScript_
- [ ] **Order History** - Personal order overview
- [ ] **Push Notifications** - PWA notifications
- [ ] **Advanced Search** - Ingredient/allergen filtering
- [ ] **Social Sharing** - Share dishes on social media
- [ ] **Admin Dashboard** - Content Management System
### π Code Quality & Testing
- [ ] **Unit Tests** - Jest test suite
- [ ] **E2E Tests** - Playwright integration
- [ ] **Performance Monitoring** - Lighthouse CI
- [ ] **Error Logging** - Sentry integration
- [ ] **Code Coverage** - Targeting 90%+ coverage
## π οΈ Development
### Coding Standards β
- All JavaScript functions max. 14 lines
- JSDoc comments for all public functions
- Consistent naming conventions (camelCase for JS, kebab-case for CSS)
- Mobile first CSS development
- No inline styles or event handlers
### Browser Support β
- β
Chrome/Edge (modern versions)
- β
Firefox (modern versions)
- β
Safari (modern versions)
- β
Mobile browsers (iOS Safari, Chrome Mobile)
### Performance β
- β‘ Vanilla JavaScript (no framework overhead)
- ποΈ CSS-only animations
- π± Touch-optimized interactions
- π― Lazy loading for images
- πΎ Aggressive LocalStorage usage
## π§ API Endpoints
### POST /api/contact.php β
```js
// Contact form with spam protection
{
"name": "Max Mustermann",
"email": "max@example.com",
"subject": "Reservation",
"message": "Table for 4 persons...",
"captcha": 42
}
```
**Features:**
- Rate limiting (3 requests/hour per IP)
- Honeypot spam protection
- HTML email templates
- Dual email system (admin + confirmation)
- Comprehensive input validation
## π¨ Design System
### Color Palette β
```css
:root {
--color-primary: #ff6b6b; /* Coral */
--color-secondary: #4ecdc4; /* Teal */
--color-accent: #ffe66d; /* Yellow */
--color-surface: #ffffff; /* White */
--color-background: #f8f9fa; /* Light Gray */
}
```
### Typography β
- **Primary Font:** Comic Neue (locally hosted)
- **Fallback:** system-ui, -apple-system, sans-serif
- **Sizing System:** rem-based for scalability
## π± Progressive Web App
### Manifest β
- App icons (32px to 512px)
- Offline-ready basic structure
- Theme color integration
- Display mode: standalone
### Performance Optimizations β
- CSS custom properties for fast theme switching
- Event delegation for better performance
- Minimal DOM manipulations via virtual-DOM-like updates
## π Security Features
### Frontend Security β
- XSS protection via HTML escaping
- Input length validation
- CSRF token preparation
- Honeypot anti-spam
### Backend Security β
- Rate limiting with IP tracking
- Input sanitization
- Email header injection protection
- Comprehensive error handling
## π Highlights
This project demonstrates modern frontend development **without external dependencies** and shows how to build a professional SPA with vanilla technologies:
- **π 100% Vanilla** - No framework lock-in
- **π Clean Architecture** - Service layer + state management
- **βΏ Accessibility First** - Developed WCAG-compliant
- **π Performance** - Optimized for mobile & desktop
- **π§ Maintainable** - Modular, testable code
- **π± Modern** - PWA-ready & future-proof
## π» Local Development
```bash
# Clone repository
git clone [repository-url]
cd Super-Rando-SPA
# Install dependencies
npm install
# Start development server
npm run dev
# Browser will automatically open http://localhost:3000
```
## π License
MIT License - see [LICENSE](LICENSE) for details.
---
**π Built with β€οΈ for modern web development**
_A showcase for professional frontend architecture with Vanilla JavaScript_