An open API service indexing awesome lists of open source software.

https://github.com/srdjan/kelpapp

Modern SSR Web App styled with KelpUI
https://github.com/srdjan/kelpapp

css example html template web

Last synced: 6 months ago
JSON representation

Modern SSR Web App styled with KelpUI

Awesome Lists containing this project

README

          

# Kelp UI Landing Page - Modern SSR Web App

A beautiful, high-performance landing page for the Kelp UI library built with **Deno**, **HTMX**, and **functional TypeScript**. This project showcases modern web development practices with server-side rendering, progressive enhancement, and a sophisticated design system.

![Kelp UI Landing Page](https://img.shields.io/badge/Deno-2.0-00599C?style=for-the-badge&logo=deno)
![TypeScript](https://img.shields.io/badge/TypeScript-Functional-3178C6?style=for-the-badge&logo=typescript)
![HTMX](https://img.shields.io/badge/HTMX-Progressive-336791?style=for-the-badge)

## โœจ Key Features

### ๐Ÿ—๏ธ **Modern Architecture**
- **Server-Side Rendering (SSR)** with Deno for optimal performance
- **Functional TypeScript** - Zero classes, pure functions, algebraic data types
- **Type-safe routing** with pattern matching and validation
- **Result types** for explicit error handling without exceptions

### ๐ŸŽจ **Beautiful Design System**
- **Blue-to-Orange gradient** color palette with 50+ design tokens
- **Inter + Space Grotesk** typography with responsive scaling
- **8pt grid system** for consistent spacing
- **Micro-interactions** and hover effects throughout
- **Mobile-first responsive design** with container queries

### โšก **Performance & UX**
- **Progressive enhancement** with HTMX for dynamic interactions
- **Real-time form validation** without page refreshes
- **Optimized static asset serving** with proper caching headers
- **Security-first** approach with comprehensive headers
- **Newsletter subscription** with server-side validation

### ๐Ÿ› ๏ธ **Developer Experience**
- **Hot reload** development server
- **Comprehensive testing** with Deno's built-in test runner
- **Type checking** and linting with strict TypeScript
- **Functional programming patterns** following CLAUDE.md guidelines

## ๐Ÿ“ Project Structure

```
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ lib/
โ”‚ โ”‚ โ”œโ”€โ”€ types.ts # Core type definitions
โ”‚ โ”‚ โ”œโ”€โ”€ router.ts # Functional router implementation
โ”‚ โ”‚ โ””โ”€โ”€ validation.ts # Pure validation functions
โ”‚ โ”œโ”€โ”€ server/
โ”‚ โ”‚ โ”œโ”€โ”€ handlers.ts # Route handlers
โ”‚ โ”‚ โ”œโ”€โ”€ static.ts # Static file serving
โ”‚ โ”‚ โ””โ”€โ”€ data.ts # Application data
โ”‚ โ”œโ”€โ”€ templates/
โ”‚ โ”‚ โ”œโ”€โ”€ layout.ts # HTML layout templates
โ”‚ โ”‚ โ””โ”€โ”€ components.ts # Reusable components
โ”‚ โ””โ”€โ”€ main.ts # Server entry point
โ”œโ”€โ”€ public/
โ”‚ โ””โ”€โ”€ styles.css # CSS design system
โ”œโ”€โ”€ deno.json # Deno configuration
โ””โ”€โ”€ README.md
```

## ๐Ÿš€ Quick Start

### Prerequisites

- **[Deno](https://deno.land/) v1.40+** - Modern JavaScript/TypeScript runtime
- **Git** - For cloning the repository

### Installation & Setup

```bash
# Clone the repository
git clone
cd kelpapp

# Start development server with hot reload
deno task dev

# Open in your browser
open http://localhost:8000
```

### ๐Ÿ”ง Available Commands

| Command | Description |
|---------|-------------|
| `deno task dev` | Start development server with hot reload |
| `deno task start` | Start production server |
| `deno task test` | Run all tests with coverage |
| `deno task typecheck` | Type check all TypeScript files |
| `deno task fmt` | Format code with Deno formatter |
| `deno task lint` | Lint code with Deno linter |

### ๐Ÿงช Testing

```bash
# Run all tests
deno task test

# Run specific test file
deno test src/lib/validation_test.ts --allow-all

# Run tests with coverage
deno test --coverage=coverage/ src/
```

## ๐ŸŒ API Reference

### ๐Ÿ“„ **Pages**
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/` | GET | Beautiful landing page with hero, features, testimonials |
| `/index.html` | GET | Compatibility redirect to homepage |

### ๐Ÿ”Œ **API Endpoints**
| Endpoint | Method | Description | Response |
|----------|--------|-------------|----------|
| `/api/newsletter` | POST | Newsletter subscription with validation | HTML fragment |
| `/api/newsletter/stats` | GET | Current subscription statistics | JSON |
| `/api/health` | GET | Server health check | JSON |

### ๐Ÿ“ **Static Assets**
| Endpoint | Description | Cache |
|----------|-------------|-------|
| `/styles.css` | Complete design system CSS | 1 year |
| `/favicon.ico` | Site favicon | 1 year |

### ๐Ÿ“‹ **Example API Usage**

```bash
# Subscribe to newsletter
curl -X POST http://localhost:8000/api/newsletter \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "email=user@example.com"

# Get subscription stats
curl http://localhost:8000/api/newsletter/stats

# Health check
curl http://localhost:8000/api/health
```

## ๐Ÿ—๏ธ Architecture

This application follows **functional TypeScript** principles:

### Core Principles

1. **Zero Classes** - Everything built with pure functions
2. **Type-Driven Design** - Comprehensive type safety
3. **Immutable Data** - All data structures are readonly
4. **Result Types** - Explicit error handling with `Result`
5. **Pure Functions** - Side effects pushed to boundaries

### Key Patterns

```typescript
// Result type for error handling
type Result =
| { readonly success: true; readonly data: T }
| { readonly success: false; readonly error: E };

// Functional route creation
const createRoute = (pattern: string, handler: RouteHandler): RouteConfig => ({
pattern: new RegExp(`^${pattern.replace(/:\w+/g, "([^/]+)")}$`),
handler,
});

// Pure validation functions
const validateEmail = (email: string): ValidationResult => {
// Implementation
};
```

## ๐ŸŽจ Design System

### **Color Palette**
```css
/* Primary (Blue) */
--color-primary-500: #0ea5e9; /* Main blue */
--color-primary-600: #0284c7; /* Button blue */

/* Accent (Orange) */
--color-accent-500: #f97316; /* Main orange */
--color-accent-600: #ea580c; /* Strong orange */

/* Gradients */
--gradient-primary: linear-gradient(135deg, #0284c7 0%, #ea580c 100%);
--gradient-hero: linear-gradient(135deg, #0ea5e9 0%, #f97316 50%, #0369a1 100%);
```

### **Typography Scale**
- **Display Font**: Space Grotesk (headings, brand)
- **Body Font**: Inter (content, UI)
- **Scale**: 12px โ†’ 72px with responsive clamp()

### **Spacing System**
- **8pt Grid**: `--space-1` (4px) โ†’ `--space-32` (128px)
- **Consistent rhythm** across all components

### **Component Features**
- **Micro-interactions**: Smooth hover effects and transitions
- **Accessibility**: ARIA labels, semantic HTML, keyboard navigation
- **Responsive**: Mobile-first with container queries
- **Performance**: Optimized animations with `transform` and `opacity`

## ๐Ÿ”ง HTMX Integration

HTMX provides progressive enhancement for dynamic interactions:

```html

```

## ๐Ÿš€ Deployment

### **Environment Variables**
```bash
PORT=8000 # Server port (default: 8000)
DENO_ENV=production # Environment mode
```

### **Production Deployment**

#### **Direct Deployment**
```bash
# Production server
deno task start

# Custom port
PORT=3000 deno task start

# Background process
nohup deno task start > server.log 2>&1 &
```

#### **Docker Deployment**
```dockerfile
FROM denoland/deno:1.44.4

WORKDIR /app
COPY . .

# Cache dependencies
RUN deno cache src/main.ts

EXPOSE 8000

USER deno

CMD ["deno", "task", "start"]
```

```bash
# Build and run
docker build -t kelp-landing .
docker run -p 8000:8000 kelp-landing
```

#### **Cloud Platforms**
- **Deno Deploy**: Direct deployment with `deployctl`
- **Railway**: Connect GitHub repo for auto-deploys
- **Fly.io**: Use provided Dockerfile
- **DigitalOcean App Platform**: Node.js buildpack with Deno

### **Performance Metrics**

| Metric | Value | Description |
|--------|-------|-------------|
| **First Contentful Paint** | <1.2s | Server-side rendering |
| **Largest Contentful Paint** | <2.5s | Optimized images & fonts |
| **Cumulative Layout Shift** | <0.1 | Stable layout design |
| **Bundle Size** | ~45KB | Minimal CSS, no JS framework |
| **Lighthouse Score** | 95+ | Performance, Accessibility, SEO |

### **Security Features**

#### **HTTP Security Headers**
```http
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Referrer-Policy: strict-origin-when-cross-origin
Content-Security-Policy: default-src 'self'
```

#### **Input Validation**
- **Type-safe validation** with Result types
- **Email format validation** with regex
- **XSS prevention** through HTML escaping
- **CSRF protection** ready for implementation

## ๐Ÿ“š Learning Resources

### **Functional TypeScript Patterns**
- **Result Types**: Explicit error handling without exceptions
- **Pure Functions**: Predictable, testable code
- **Algebraic Data Types**: Type-safe domain modeling
- **Pattern Matching**: Exhaustive conditional logic

### **Modern Web Development**
- **Server-Side Rendering**: SEO-friendly, fast initial loads
- **Progressive Enhancement**: Works without JavaScript
- **Semantic HTML**: Accessibility-first markup
- **CSS Custom Properties**: Maintainable design systems

### **Resources**
- [Deno Documentation](https://docs.deno.com/)
- [HTMX Guide](https://htmx.org/docs/)
- [Functional TypeScript](https://github.com/gcanti/fp-ts)
- [Kelp UI Library](https://kelpui.com/)

## ๐Ÿค Contributing

We welcome contributions! Please follow these guidelines:

1. **Fork the repository** and create a feature branch
2. **Follow functional TypeScript patterns** (no classes)
3. **Add tests** for new functionality
4. **Update documentation** as needed
5. **Run quality checks**: `deno task test && deno task typecheck && deno task lint`
6. **Submit a pull request** with a clear description

### **Development Workflow**
```bash
# Setup development environment
git clone
cd kelpapp

# Create feature branch
git checkout -b feature/amazing-feature

# Make changes and test
deno task dev
deno task test

# Quality assurance
deno task typecheck
deno task fmt
deno task lint

# Commit and push
git add .
git commit -m "Add amazing feature"
git push origin feature/amazing-feature
```

## ๐Ÿ“„ License

**MIT License** - Feel free to use this project for learning, commercial projects, or as a starting point for your own landing pages.

---

**Built with โค๏ธ by the community**

๐Ÿš€ **Tech Stack**: Deno + HTMX + Functional TypeScript + Modern CSS
๐ŸŽจ **Design**: Blue-to-Orange gradient system with micro-interactions
โšก **Performance**: SSR + Progressive Enhancement + Zero JS frameworks
๐Ÿ”’ **Security**: Comprehensive headers + Type-safe validation