{"id":21569406,"url":"https://github.com/aweirddev/rapiz","last_synced_at":"2025-03-18T05:45:12.560Z","repository":{"id":236754633,"uuid":"671868314","full_name":"AWeirdDev/rapiz","owner":"AWeirdDev","description":"Rapiz, more like React.","archived":false,"fork":false,"pushed_at":"2023-07-30T07:58:14.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-24T12:32:30.399Z","etag":null,"topics":["python"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AWeirdDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-28T10:23:16.000Z","updated_at":"2023-07-30T08:00:12.000Z","dependencies_parsed_at":"2024-04-28T12:44:02.262Z","dependency_job_id":"08065a84-afa8-4983-a71d-6dcbbe6b6887","html_url":"https://github.com/AWeirdDev/rapiz","commit_stats":null,"previous_names":["aweirddev/rapiz"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWeirdDev%2Frapiz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWeirdDev%2Frapiz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWeirdDev%2Frapiz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWeirdDev%2Frapiz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AWeirdDev","download_url":"https://codeload.github.com/AWeirdDev/rapiz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244166677,"owners_count":20409178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python"],"created_at":"2024-11-24T11:09:26.516Z","updated_at":"2025-03-18T05:45:12.537Z","avatar_url":"https://github.com/AWeirdDev.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# rapiz\nThe frontend \u0026 backend tool for everyone, fast.\n\n## File Structure\nThe file structure of rapiz stays simple — APIs and Pages stay in their own directory, you can think of it as their homes.\n\n```haskell\nmy-app/\n├─ src/\n│  ├─ api/\n│  │  ├─ db.py\n│  ├─ pages/\n│  ├─ ├─ index.py\n│  │  ├─ users/\n│  │  │  ├─ [name].py\n├─ rapiz.config.py\n```\n\n## Pages\nLike any other tools you've seen, rapiz does pretty much the same. Define a function named `default` and rapiz will think of it as your default export.\n\nTo return a response, you can use rapiz' `html` class to do anything with html. Alternatively, you can use the `markdown` class to do everything in Markdown.\n\n```python\nfrom rapiz import html\n\nasync def default(ctx):\n  return html.h1(\n    \"I love HTML!\",\n    style={\n      \"font-family\": \"sans-serif\"\n    }\n  )\n```\n\n### Components \u0026 States\nManage components \u0026 states like a pro! Do everything just like what you'd do in React.\n\n```python\nfrom rapiz import component, html\n\n@component\nasync def Button(ctx):\n  [clicks, set_clicks] = ctx.use_state(1)\n  return html.Button(f\"Click! ({clicks})\", on_click=lambda: set_clicks(clicks + 1))\n\nasync def default(ctx):\n  return Button()\n```\n\n## APIs\nrapiz uses FastAPI under the hood, so it's definitely easy \u0026 fast to make APIs (as its name suggests):\n\n```python\n# src/api/db.py\nfrom fastapi import Request\nfrom rapiz import only_us\n\nmethods = [\"GET\"] # assign available methods\n\n@only_us # block external (reverse-engineered) requests\nasync def default(request: Request):\n  try:\n    data: dict = await fake_db.load()\n    return data\n  except ThunderStormWarning:\n    return 418, {\n      \"message\": \"Go grab yourself some tea!\"\n    }\n```\n\nWith that being said, you can easily fetch your APIs from your pages:\n```python\n# src/pages/index.py\nfrom rapiz import html, fetch_api\n\nasync def default(ctx):\n  data = await fetch_api(\"/db\")\n  return html.p(\n    \"Here are all the available services: \" + data['all_services']\n  )\n```\n\n## HMR\nrapiz also supports HMR, it seems like HMR is a must ever since the vite era has come.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faweirddev%2Frapiz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faweirddev%2Frapiz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faweirddev%2Frapiz/lists"}