Model-config web apps: describe the app in configuration instead of writing code. Built on Polars and DuckDB.
posts_338905_crud.yaml · 5.5 KB · 291 lines
| 1 | resource: posts_338905 |
| 2 | database: posts_338905.db |
| 3 | fields: |
| 4 | id: |
| 5 | type: primary_key |
| 6 | title: |
| 7 | type: string |
| 8 | required: true |
| 9 | searchable: true |
| 10 | max_length: 200 |
| 11 | ui: |
| 12 | placeholder: Enter an engaging blog post title |
| 13 | help_text: Keep it under 60 characters for best SEO |
| 14 | slug: |
| 15 | type: string |
| 16 | unique: true |
| 17 | max_length: 200 |
| 18 | ui: |
| 19 | help_text: Auto-generated from title, used in URLs |
| 20 | content: |
| 21 | type: text |
| 22 | required: true |
| 23 | ui: |
| 24 | component: rich_editor |
| 25 | toolbar: |
| 26 | - bold |
| 27 | - italic |
| 28 | - link |
| 29 | - image |
| 30 | - code |
| 31 | - quote |
| 32 | height: 400 |
| 33 | excerpt: |
| 34 | type: text |
| 35 | max_length: 500 |
| 36 | ui: |
| 37 | component: textarea |
| 38 | rows: 3 |
| 39 | placeholder: Brief summary for previews and SEO |
| 40 | status: |
| 41 | type: select |
| 42 | options: |
| 43 | - draft |
| 44 | - published |
| 45 | - scheduled |
| 46 | - archived |
| 47 | default: draft |
| 48 | required: true |
| 49 | ui: |
| 50 | variant: badge |
| 51 | colors: |
| 52 | draft: secondary |
| 53 | published: success |
| 54 | scheduled: warning |
| 55 | archived: dark |
| 56 | category_id: |
| 57 | type: foreign_key |
| 58 | references: categories |
| 59 | required: true |
| 60 | ui: |
| 61 | component: select |
| 62 | searchable: true |
| 63 | author_id: |
| 64 | type: foreign_key |
| 65 | references: users |
| 66 | required: true |
| 67 | ui: |
| 68 | default_current_user: true |
| 69 | featured_image: |
| 70 | type: file |
| 71 | accept: |
| 72 | - jpg |
| 73 | - jpeg |
| 74 | - png |
| 75 | - webp |
| 76 | max_size: 5MB |
| 77 | ui: |
| 78 | preview: true |
| 79 | aspect_ratio: '16:9' |
| 80 | seo_title: |
| 81 | type: string |
| 82 | max_length: 60 |
| 83 | ui: |
| 84 | help_text: Custom SEO title (defaults to post title) |
| 85 | seo_description: |
| 86 | type: string |
| 87 | max_length: 160 |
| 88 | ui: |
| 89 | component: textarea |
| 90 | rows: 2 |
| 91 | help_text: Meta description for search engines |
| 92 | tags: |
| 93 | type: many_to_many |
| 94 | references: tags |
| 95 | ui: |
| 96 | component: tag_input |
| 97 | autocomplete: true |
| 98 | view_count: |
| 99 | type: integer |
| 100 | default: 0 |
| 101 | ui: |
| 102 | readonly: true |
| 103 | published_at: |
| 104 | type: timestamp |
| 105 | ui: |
| 106 | component: datetime_picker |
| 107 | help_text: Leave blank to publish immediately |
| 108 | created_at: |
| 109 | type: timestamp |
| 110 | auto_now_add: true |
| 111 | updated_at: |
| 112 | type: timestamp |
| 113 | auto_now: true |
| 114 | hooks: |
| 115 | before_create: |
| 116 | - validate_post_content |
| 117 | - generate_slug_from_title |
| 118 | - extract_excerpt_if_empty |
| 119 | after_create: |
| 120 | - generate_seo_metadata |
| 121 | - create_social_media_posts |
| 122 | - notify_subscribers |
| 123 | before_update: |
| 124 | - preserve_published_date |
| 125 | - validate_slug_uniqueness |
| 126 | after_update: |
| 127 | - invalidate_post_cache |
| 128 | - update_sitemap |
| 129 | - reindex_search |
| 130 | before_delete: |
| 131 | - check_post_dependencies |
| 132 | - backup_post_content |
| 133 | after_delete: |
| 134 | - cleanup_post_assets |
| 135 | - update_category_counts |
| 136 | - purge_cached_content |
| 137 | permissions: |
| 138 | create: authenticated |
| 139 | read: |
| 140 | published: public |
| 141 | draft: owner_or_admin |
| 142 | update: owner_or_admin |
| 143 | delete: owner_or_admin |
| 144 | api: |
| 145 | base_path: /api/posts |
| 146 | enable_bulk: true |
| 147 | enable_export: true |
| 148 | rate_limiting: |
| 149 | read: 1000/hour |
| 150 | write: 100/hour |
| 151 | custom_endpoints: |
| 152 | - path: /published |
| 153 | method: GET |
| 154 | filter: |
| 155 | status: published |
| 156 | - path: /by-category/{category_slug} |
| 157 | method: GET |
| 158 | join: categories |
| 159 | - path: /{slug}/increment-views |
| 160 | method: POST |
| 161 | action: increment_view_count |
| 162 | interface: |
| 163 | list_display: |
| 164 | - title |
| 165 | - author |
| 166 | - category |
| 167 | - status |
| 168 | - view_count |
| 169 | - published_at |
| 170 | list_filters: |
| 171 | - status |
| 172 | - category_id |
| 173 | - author_id |
| 174 | - created_at |
| 175 | search_fields: |
| 176 | - title |
| 177 | - content |
| 178 | - excerpt |
| 179 | ordering: |
| 180 | - -published_at |
| 181 | - -created_at |
| 182 | per_page: 20 |
| 183 | form_layout: |
| 184 | - section: Content |
| 185 | fields: |
| 186 | - title |
| 187 | - slug |
| 188 | - content |
| 189 | - excerpt |
| 190 | columns: 1 |
| 191 | - section: Publishing |
| 192 | fields: |
| 193 | - status |
| 194 | - category_id |
| 195 | - published_at |
| 196 | columns: 3 |
| 197 | - section: Media & SEO |
| 198 | fields: |
| 199 | - featured_image |
| 200 | - seo_title |
| 201 | - seo_description |
| 202 | - tags |
| 203 | columns: 2 |
| 204 | detail_template: blog_post |
| 205 | detail_layout: |
| 206 | header: |
| 207 | - title |
| 208 | - author |
| 209 | - published_at |
| 210 | - category |
| 211 | content: |
| 212 | - featured_image |
| 213 | - content |
| 214 | sidebar: |
| 215 | - tags |
| 216 | - related_posts |
| 217 | - social_share |
| 218 | footer: |
| 219 | - author_bio |
| 220 | - comments |
| 221 | ui: |
| 222 | theme: bootstrap |
| 223 | variant: blog |
| 224 | components: |
| 225 | list: |
| 226 | variant: table-striped |
| 227 | hover: true |
| 228 | responsive: true |
| 229 | actions: |
| 230 | - view |
| 231 | - edit |
| 232 | - delete |
| 233 | - duplicate |
| 234 | form: |
| 235 | variant: horizontal |
| 236 | label_width: 3 |
| 237 | submit_button: |
| 238 | variant: primary |
| 239 | size: lg |
| 240 | text: Publish Post |
| 241 | cancel_button: |
| 242 | variant: outline-secondary |
| 243 | text: Save Draft |
| 244 | detail: |
| 245 | variant: article |
| 246 | typography: true |
| 247 | syntax_highlighting: true |
| 248 | social_sharing: |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | layout: |
| 254 | container: true |
| 255 | sidebar: true |
| 256 | header_nav: true |
| 257 | footer: true |
| 258 | css_classes: |
| 259 | post_title: display-4 font-weight-bold |
| 260 | post_meta: text-muted small |
| 261 | post_content: lead |
| 262 | category_badge: badge badge-primary |
| 263 | tag_badge: badge badge-outline-secondary |
| 264 | seo: |
| 265 | auto_generate: true |
| 266 | title_template: '{title} | My Awesome Blog' |
| 267 | description_template: '{excerpt}' |
| 268 | open_graph: |
| 269 | type: article |
| 270 | image: '{featured_image}' |
| 271 | locale: en_US |
| 272 | twitter_card: |
| 273 | type: summary_large_image |
| 274 | site: '@myblog' |
| 275 | structured_data: |
| 276 | type: BlogPosting |
| 277 | author: '{author.name}' |
| 278 | publisher: My Awesome Blog |
| 279 | analytics: |
| 280 | track_views: true |
| 281 | track_reading_time: true |
| 282 | track_social_shares: true |
| 283 | track_user_engagement: true |
| 284 | recommendations: |
| 285 | enable: true |
| 286 | algorithm: content_similarity |
| 287 | max_results: 5 |
| 288 | factors: |
| 289 | - category |
| 290 | - tags |
| 291 | - author |