askrobots / dbbasic Public

Model-config web apps: describe the app in configuration instead of writing code. Built on Polars and DuckDB.

0 downloads

dbbasic/docs/paradigms/RAILS_IN_CONFIG.yaml
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Add DBBasic crate engine logo and update README 0d628db 1 year, 2 months ago History
RAILS_IN_CONFIG.yaml · 8.7 KB · 421 lines
1# The Complete DBBasic Specification
2# Everything Rails does, but in config
3# Define the contract, implementations improve forever
4
5name: "Complete Application Spec"
6version: "1.0"
7
8# ==========================================
9# CORE DATA
10# ==========================================
11model:
12 users:
13 fields: [id, email, password_hash, confirmed_at]
14 indexes: [email]
15 validations:
16 email: "email_format"
17 password: "min_length:8"
18
19 posts:
20 fields: [id, user_id, title, content, published_at]
21 associations:
22 belongs_to: user
23 has_many: comments
24
25# ==========================================
26# DATABASE MANAGEMENT
27# ==========================================
28database:
29 migrations:
30 auto_generate: true # From model changes
31 versioning: true
32 rollback: true
33
34 seeds:
35 development:
36 users: 100
37 posts: 1000
38
39 backup:
40 schedule: "daily"
41 retention: 30
42
43 replicas:
44 read: 3
45 regions: [us-east, eu-west, asia]
46
47# ==========================================
48# URL ROUTING
49# ==========================================
50routes:
51 # RESTful resources
52 resources:
53 users: [index, show, new, create, edit, update, destroy]
54 posts: [index, show]
55
56 # Custom routes
57 custom:
58 "/": "home#index"
59 "/dashboard": "dashboard#show"
60 "/api/v1/*": "api#handle"
61
62 # Constraints
63 constraints:
64 subdomain: "admin"
65 routes:
66 "/": "admin#dashboard"
67
68# ==========================================
69# TEMPLATES & VIEWS
70# ==========================================
71templates:
72 engine: "auto" # HTML, JSX, or whatever works
73
74 layouts:
75 application: |
76 <html>
77 {{ head }}
78 <body>
79 {{ flash_messages }}
80 {{ yield }}
81 </body>
82 </html>
83
84 partials:
85 _user: "<div>{{ user.name }}</div>"
86 _navigation: "{{ link_to 'Home', root_path }}"
87
88 helpers:
89 format_currency: "ai://format_money"
90 time_ago: "ai://human_time"
91
92# ==========================================
93# JAVASCRIPT & ASSETS
94# ==========================================
95assets:
96 javascript:
97 framework: "vanilla" # or react, vue, svelte
98 bundler: "auto" # Don't care, just make it work
99
100 css:
101 preprocessor: "auto" # sass, less, postcss, whatever
102
103 images:
104 optimize: true
105 lazy_load: true
106 cdn: "auto"
107
108 pipeline:
109 fingerprint: true
110 compress: true
111 cache: "1.year"
112
113# ==========================================
114# EMAIL
115# ==========================================
116email:
117 provider: "auto" # SendGrid, SES, Postmark, whatever
118
119 mailers:
120 user_mailer:
121 welcome:
122 to: "user.email"
123 subject: "Welcome to {{ app_name }}"
124 template: "welcome.html"
125
126 password_reset:
127 to: "user.email"
128 subject: "Reset your password"
129 template: "password_reset.html"
130
131 settings:
132 from: "noreply@example.com"
133 track_opens: true
134 track_clicks: true
135
136# ==========================================
137# BACKGROUND JOBS
138# ==========================================
139jobs:
140 # Processor: Sidekiq, Resque, whatever works
141 processor: "auto"
142
143 definitions:
144 send_welcome_email:
145 perform: "email:user_mailer.welcome"
146 queue: "mailers"
147 retry: 3
148
149 cleanup_old_sessions:
150 perform: "DELETE FROM sessions WHERE created_at < 30.days.ago"
151 schedule: "daily at 3am"
152
153 generate_reports:
154 perform: "ai://generate_monthly_reports"
155 schedule: "first monday of month"
156
157 queues:
158 critical: {priority: 1}
159 default: {priority: 2}
160 low: {priority: 3}
161
162# ==========================================
163# WEBSOCKETS / REALTIME
164# ==========================================
165realtime:
166 # ActionCable, Phoenix Channels, whatever
167 provider: "auto"
168
169 channels:
170 posts:
171 stream_from: "posts"
172
173 on_create: |
174 broadcast(:post_created, post)
175
176 on_update: |
177 broadcast(:post_updated, post)
178
179 notifications:
180 stream_for: "current_user"
181
182 presence:
183 track_users: true
184 timeout: 30.seconds
185
186# ==========================================
187# SECURITY
188# ==========================================
189security:
190 csrf:
191 enabled: true
192 token_name: "authenticity_token"
193
194 cors:
195 origins: ["https://example.com"]
196 methods: ["GET", "POST"]
197
198 headers:
199 X-Frame-Options: "DENY"
200 X-Content-Type-Options: "nosniff"
201
202 rate_limiting:
203 requests: 100
204 period: "1.minute"
205 by: "ip"
206
207 authentication:
208 provider: "auto" # Devise, Authlogic, whatever
209 strategies: [password, oauth, magic_link]
210
211 authorization:
212 provider: "auto" # Pundit, CanCan, whatever
213 roles: [admin, user, guest]
214
215# ==========================================
216# FILE UPLOADS
217# ==========================================
218uploads:
219 storage: "auto" # S3, GCS, local, whatever
220
221 processors:
222 images:
223 resize: [thumb: "100x100", medium: "300x300"]
224 format: ["webp", "jpg"]
225
226 documents:
227 scan_viruses: true
228 max_size: "10MB"
229
230 direct_upload: true # Straight to S3/GCS
231
232# ==========================================
233# RICH TEXT EDITING
234# ==========================================
235rich_text:
236 editor: "auto" # Trix, Quill, whatever
237
238 features:
239 - bold
240 - italic
241 - links
242 - images
243 - code_blocks
244
245 storage: "uploads"
246 sanitize: true
247
248# ==========================================
249# TESTING
250# ==========================================
251testing:
252 framework: "auto" # RSpec, Minitest, whatever
253
254 system_tests:
255 browser: "headless_chrome"
256
257 fixtures:
258 generate_from: "seeds"
259
260 coverage:
261 minimum: 80
262
263 continuous:
264 on: ["push", "pull_request"]
265
266# ==========================================
267# CACHING
268# ==========================================
269cache:
270 store: "auto" # Redis, Memcached, whatever
271
272 strategies:
273 page_cache:
274 paths: ["/", "/about"]
275 duration: "1.hour"
276
277 fragment_cache:
278 partials: ["user_card", "post_summary"]
279
280 query_cache:
281 enabled: true
282
283 cdn_cache:
284 provider: "cloudflare"
285 purge_on: "deploy"
286
287# ==========================================
288# MONITORING & LOGGING
289# ==========================================
290monitoring:
291 errors: "auto" # Sentry, Rollbar, whatever
292
293 performance:
294 apm: "auto" # NewRelic, DataDog, whatever
295 track_queries: true
296
297 logging:
298 level: "info"
299 rotate: "daily"
300 keep: 7
301
302 alerts:
303 error_rate: "> 1%"
304 response_time: "> 500ms"
305
306# ==========================================
307# DEPLOYMENT
308# ==========================================
309deployment:
310 platform: "auto" # Heroku, Fly, Railway, VPS
311
312 environments:
313 production:
314 domain: "example.com"
315 ssl: "auto" # Let's Encrypt
316
317 staging:
318 domain: "staging.example.com"
319 password_protect: true
320
321 scaling:
322 min_instances: 2
323 max_instances: 10
324 scale_on: "cpu > 70%"
325
326 zero_downtime: true
327
328# ==========================================
329# ADMIN INTERFACE
330# ==========================================
331admin:
332 enabled: true
333 path: "/admin"
334
335 models: "all" # Auto-generate CRUD
336
337 dashboard:
338 widgets:
339 - users_count
340 - revenue_chart
341 - recent_activity
342
343 auth:
344 role: "admin"
345
346# ==========================================
347# API
348# ==========================================
349api:
350 versions:
351 v1:
352 format: ["json", "xml"]
353 auth: "token"
354
355 v2:
356 format: ["json", "graphql"]
357 auth: "jwt"
358
359 documentation:
360 generate: true
361 format: "openapi"
362
363 rate_limit:
364 authenticated: 1000
365 anonymous: 100
366
367# ==========================================
368# INTEGRATIONS
369# ==========================================
370integrations:
371 payment:
372 provider: "stripe" # or paypal, square
373
374 analytics:
375 provider: "plausible" # or google, mixpanel
376
377 search:
378 provider: "algolia" # or elasticsearch
379
380 cdn:
381 provider: "cloudflare"
382
383 sms:
384 provider: "twilio"
385
386# ==========================================
387# AI SERVICES (The Secret Sauce)
388# ==========================================
389ai_services:
390 # These get better over time without config changes
391
392 generate_monthly_reports:
393 description: "Analyze data and create reports"
394
395 format_money:
396 description: "Format currency for user's locale"
397
398 human_time:
399 description: "Convert timestamp to human readable"
400
401 moderate_content:
402 description: "Check for inappropriate content"
403
404 suggest_tags:
405 description: "Auto-tag posts based on content"
406
407 detect_spam:
408 description: "Identify and flag spam"
409
410# ==========================================
411# THE GENIUS PART
412# ==========================================
413# We can define all this config BEFORE the implementation exists.
414# As DBBasic improves, apps get better without changing config.
415#
416# Today: Basic implementation
417# Tomorrow: Optimized implementation
418# Next year: AI-powered perfection
419#
420# Your config stays the same. Your app gets better.
421# ==========================================