Server-Side Rendering

Server-Side Rendering

Guides an AI agent to build server-rendered web apps with template engines like Jinja2, Django templates and EJS, including caching and performance tuning.

Skill files10 files

references/

scripts/

templates/

SKILL.md106 lines
1
---
2
name: server-side-rendering
3
description: >
4
Implement server-side rendering with template engines, view layers, and
5
dynamic content generation. Use when building server-rendered applications,
6
implementing MVC architectures, and generating HTML on the server.
7
---
8
9
# Server-Side Rendering
10
11
## Table of Contents
12
13
- [Overview](#overview)
14
- [When to Use](#when-to-use)
15
- [Quick Start](#quick-start)
16
- [Reference Guides](#reference-guides)
17
- [Best Practices](#best-practices)
18
19
## Overview
20
21
Build server-side rendered applications using modern template engines, view layers, and data-driven HTML generation with caching, streaming, and performance optimization across Python, Node.js, and Ruby frameworks.
22
23
## When to Use
24
25
- Building traditional web applications
26
- Rendering HTML on the server
27
- Implementing SEO-friendly applications
28
- Creating real-time updating pages
29
- Building admin dashboards
30
- Implementing email templates
31
32
## Quick Start
33
34
Minimal working example:
35
36
```python
37
# app.py
38
from flask import Flask, render_template, request, jsonify
39
from datetime import datetime
40
41
app = Flask(__name__)
42
43
# Custom Jinja2 filters
44
@app.template_filter('currency')
45
def format_currency(value):
46
return f"${value:.2f}"
47
48
@app.template_filter('date_format')
49
def format_date(date_obj):
50
return date_obj.strftime('%Y-%m-%d %H:%M:%S')
51
52
@app.context_processor
53
def inject_globals():
54
"""Inject global variables into templates"""
55
return {
56
'app_name': 'My App',
57
'current_year': datetime.now().year,
58
'support_email': 'support@example.com'
59
}
60
61
# routes.py
62
// ... (see reference guides for full implementation)
63
```
64
65
## Reference Guides
66
67
Detailed implementations in the `references/` directory:
68
69
| Guide | Contents |
70
|---|---|
71
| [Flask with Jinja2 Templates](references/flask-with-jinja2-templates.md) | Flask with Jinja2 Templates |
72
| [Jinja2 Template Examples](references/jinja2-template-examples.md) | Jinja2 Template Examples |
73
| [Node.js/Express with EJS Templates](references/nodejsexpress-with-ejs-templates.md) | Node.js/Express with EJS Templates |
74
| [EJS Template Examples](references/ejs-template-examples.md) | EJS Template Examples |
75
| [Caching and Performance](references/caching-and-performance.md) | Caching and Performance |
76
| [Django Template Examples](references/django-template-examples.md) | Django Template Examples |
77
| [Django Templates](references/django-templates.md) | Django Templates |
78
79
## Best Practices
80
81
### ✅ DO
82
83
- Use template inheritance for DRY code
84
- Implement caching for frequently rendered pages
85
- Use template filters for formatting
86
- Separate concerns between views and templates
87
- Validate and sanitize all user input
88
- Use context processors for global variables
89
- Implement proper pagination
90
- Use conditional rendering appropriately
91
- Cache expensive queries
92
- Optimize template rendering
93
94
### ❌ DON'T
95
96
- Put business logic in templates
97
- Use unbounded loops in templates
98
- Execute database queries in templates
99
- Trust user input without sanitization
100
- Over-nest template inheritance
101
- Use very long template files
102
- Render sensitive data in templates
103
- Ignore template caching opportunities
104
- Use global variables excessively
105
- Mix multiple concerns in one template
106

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 11,613 prompts

More by @OpenSourceBuffGuy

See all
Luxury Pancake Stack Food Commercial prompt image

Luxury Pancake Stack Food Commercial

Creates an ultra-luxury commercial shot of fluffy American pancakes with maple syrup cascading over berries and nuts, lit with warm morning light.

image-prompt, nano-banana, food-photography, photorealistic, close-up, bokeh, soft-lighting, natural-light, luxury, cinematic, macro, high-angle, advertising, cooking, video-ad, camera-movement, golden-hour, product-video

Korean woman in pastel top leaves home prompt image

Korean woman in pastel top leaves home

Generates a 30-second early-2000s camcorder-style clip of a young woman walking through a Seoul neighbourhood, with beat-by-beat actions and a locked look for her face and outfit.

video-prompt, seedance, home-video, handheld, vlog, korea, woman, character-consistency, camera-movement, tracking-shot, summer, natural-light, candid, photorealistic, film-grain, muted-colors, guardrails, lip-sync, cityscape, for-filmmakers, long-form, full-body

Baby Headgear Station Snapshot prompt image

Baby Headgear Station Snapshot

Makes a candid smartphone-style snapshot of a woman in a white lace bonnet outfit standing still in a busy Tokyo station concourse at rush hour.

image-prompt, gpt-image, smartphone-photo, candid, street-photography, photorealistic, woman, portrait, cityscape, japan, fashion, motion-blur, muted-colors, soft-lighting, photography, for-photographers, long-form

Reviews

Loading reviews…

Discussion

Loading comments…