{"id":44721499,"url":"https://github.com/supabase/supabase-micro","last_synced_at":"2026-02-15T16:01:28.757Z","repository":{"id":338326233,"uuid":"1138949239","full_name":"supabase/supabase-micro","owner":"supabase","description":"A minimal (experimental still) Supabase client for MicroPython and IoT devices.","archived":false,"fork":false,"pushed_at":"2026-01-22T17:51:06.000Z","size":86,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-14T04:51:56.713Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/supabase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["supabase"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2026-01-21T10:20:30.000Z","updated_at":"2026-01-23T15:07:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/supabase/supabase-micro","commit_stats":null,"previous_names":["supabase/supabase-micro"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/supabase/supabase-micro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase%2Fsupabase-micro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase%2Fsupabase-micro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase%2Fsupabase-micro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase%2Fsupabase-micro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/supabase","download_url":"https://codeload.github.com/supabase/supabase-micro/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase%2Fsupabase-micro/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29483283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T15:33:17.885Z","status":"ssl_error","status_checked_at":"2026-02-15T15:32:53.698Z","response_time":118,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-02-15T16:00:57.161Z","updated_at":"2026-02-15T16:01:28.749Z","avatar_url":"https://github.com/supabase.png","language":"Python","funding_links":["https://github.com/sponsors/supabase"],"categories":[],"sub_categories":[],"readme":"# supabase-micro\n\nA minimal Supabase client for MicroPython and IoT devices.\n\n\u003e **Experimental \u0026 Unofficial**\n\u003e\n\u003e This library is an experimental project and should not be considered as officially supported.\n\u003e We welcome your feedback, comments, and contributions! If you're using supabase-micro on a device,\n\u003e we'd love to hear about your experience — please share your experimentation examples, use cases,\n\u003e and any issues you encounter via [GitHub Issues](https://github.com/supabase/supabase-micro/issues), \n\u003e [GitHub Discussions](https://github.com/supabase/supabase-micro/discussions)\n\u003e or [Supabase Discord](https://discord.supabase.com). Your input helps us improve!\n\n## Why supabase-micro?\n\nThe official [supabase-py](https://github.com/supabase/supabase-py) library is designed for standard Python environments and pulls in many dependencies that won't run on microcontrollers. **supabase-micro** fills this gap:\n\n- **Built for constrained devices** — ESP32, ESP8266, RP2040, and similar microcontrollers\n- **Zero dependencies** — Uses only MicroPython built-ins (`socket`, `ssl`, `json`)\n- **Tiny footprint** — ~46KB total, runs on devices with 40KB+ free RAM\n- **Core features only** — Implements what IoT devices actually need: **PostgREST**, **Auth**, **Storage**\n\nIf you're building sensor loggers, smart home devices, or any IoT project that needs to talk to Supabase, this library is for you.\n\n## Installation\n\n```bash\n# Using mpremote (recommended)\nmpremote cp -r src/supabase_micro :/lib/supabase_micro\n```\n\nSee [docs/installation.md](docs/installation.md) for alternative methods (Thonny, ampy, WebREPL) and troubleshooting.\n\n## Quick Start\n\n```python\nimport network\nfrom supabase_micro import create_client\n\n# Connect to WiFi\nwlan = network.WLAN(network.STA_IF)\nwlan.active(True)\nwlan.connect(\"your-ssid\", \"your-password\")\n\nwhile not wlan.isconnected():\n    pass\n\nprint(\"Connected:\", wlan.ifconfig())\n\n# Initialize Supabase client\nclient = create_client(\n    \"https://your-project.supabase.co\",\n    \"your-api-key\"  # Use publishable key (sb_publishable_...) or anon key\n)\n\n# Query data\nresult = client.table(\"sensors\").select(\"*\").limit(10).execute()\n\nif result[\"status_code\"] == 200:\n    for row in result[\"data\"]:\n        print(row)\nelse:\n    print(\"Error:\", result[\"error\"])\n```\n\n## Security \u0026 Session Management\n\n### Memory-Only Sessions (Secure by Default)\n\n**supabase_micro does NOT store auth tokens on device storage.**\n\nThis is a security feature for IoT devices:\n- Tokens are kept in memory only\n- Sessions are cleared on reboot/restart\n- Prevents token theft from device storage\n- Suitable for physically exposed devices\n\n### Re-Authentication After Reboot\n\nAfter a device reboot, you must re-authenticate. Store credentials in your device configuration:\n\n```python\n# config.py (not in version control)\nSUPABASE_URL = \"https://your-project.supabase.co\"\nSUPABASE_KEY = \"your-anon-key\"\nDEVICE_EMAIL = \"device001@example.com\"  # One email per device\nDEVICE_PASSWORD = \"secure-random-password\"\n\n# main.py (runs on boot)\nimport network\nfrom supabase_micro import create_client\nimport config\n\n# Connect WiFi\nwlan = network.WLAN(network.STA_IF)\nwlan.active(True)\nwlan.connect(\"wifi-ssid\", \"wifi-password\")\nwhile not wlan.isconnected():\n    pass\n\n# Create client and authenticate\nclient = create_client(config.SUPABASE_URL, config.SUPABASE_KEY)\nresult = client.auth.sign_in_with_password(\n    config.DEVICE_EMAIL,\n    config.DEVICE_PASSWORD\n)\n\nif result[\"status_code\"] == 200:\n    print(\"Authenticated successfully!\")\nelse:\n    print(\"Auth failed:\", result[\"error\"])\n```\n\n**Why store credentials instead of tokens?**\n- Credentials can be revoked/changed by updating the user in Supabase\n- Tokens cannot be easily revoked without database changes\n- If device is stolen, you can immediately revoke access by changing the password\n\n### Auto-Refresh\n\nTokens expire after 1 hour by default. Use auto-refresh to keep sessions alive:\n\n```python\nimport time\n\n# Sign in\nclient.auth.sign_in_with_password(email, password)\n\n# In your main loop\nwhile True:\n    # Auto-refresh if token expires within 5 minutes\n    result = client.auth.refresh_if_needed(threshold_seconds=300)\n\n    if result[\"data\"][\"refreshed\"]:\n        print(\"Token refreshed automatically\")\n\n    # Do your work\n    sensor_data = read_sensor()\n    client.table(\"readings\").insert(sensor_data).execute()\n\n    time.sleep(60)  # Check every minute\n```\n\n**Manual refresh check:**\n\n```python\n# Check if refresh is needed\ncheck = client.auth.should_refresh_token()\n\nif check[\"data\"][\"should_refresh\"]:\n    print(f\"Token expires in {check['data']['expires_in']} seconds\")\n    client.auth.refresh_session()\n```\n\n## Basic Usage\n\n### Database (PostgREST)\n\n```python\n# Select with filters\nresult = client.table(\"readings\").select(\"*\").eq(\"device\", \"esp32-01\").limit(5).execute()\n\n# Insert\nresult = client.table(\"readings\").insert({\n    \"device\": \"esp32-01\",\n    \"temperature\": 23.5\n}).execute()\n\n# Update\nresult = client.table(\"readings\").update({\"temperature\": 24.0}).eq(\"id\", 1).execute()\n\n# Delete\nresult = client.table(\"readings\").delete().eq(\"id\", 1).execute()\n```\n\n### Authentication\n\n```python\n# Sign up\nresult = client.auth.sign_up(email=\"user@example.com\", password=\"password123\")\n\n# Sign in\nresult = client.auth.sign_in_with_password(email=\"user@example.com\", password=\"password123\")\n\n# After sign-in, all queries automatically use the user's JWT for RLS\nresult = client.table(\"user_data\").select(\"*\").execute()  # RLS policies apply\n\n# Sign out\nclient.auth.sign_out()\n```\n\n### Storage\n\n```python\n# Upload\nwith open(\"data.txt\", \"rb\") as f:\n    result = client.storage.from_(\"bucket\").upload(\"data.txt\", f.read())\n\n# Download\nresult = client.storage.from_(\"bucket\").download(\"data.txt\")\n\n# List files\nresult = client.storage.from_(\"bucket\").list()\n\n# Delete\nresult = client.storage.from_(\"bucket\").delete(\"data.txt\")\n```\n\n## Documentation\n\n- **[Installation Guide](docs/installation.md)** — All installation methods, verification, troubleshooting\n- **[API Reference](docs/api-reference.md)** — Complete PostgREST, Auth, and Storage API documentation\n- **[Examples](docs/examples.md)** — Ready-to-use examples for common IoT scenarios\n- **[Contributing](docs/contributing.md)** — Testing, local development, CI/CD\n\n## Compatibility\n\n**Tested on:**\n- MicroPython 1.19+ (ESP32, ESP8266, RP2040)\n- CPython 3.x (for development/testing)\n\n**Memory requirements:**\n- ESP32: Works well (~240KB+ RAM)\n- ESP8266: Works with careful memory management (~40KB free)\n- RP2040: Works excellently (264KB RAM)\n\n## Limitations\n\n- **Synchronous only** — No async/await support\n- **No connection pooling** — New connection per request\n- **Basic Auth** — Email/password only (no OAuth, MFA, magic links)\n- **No session persistence** — Sessions cleared on reboot (security feature)\n- **No Realtime** — WebSocket subscriptions not supported\n- **No RPC** — Database function calls not supported\n\n## License\n\nMIT License — See [LICENSE](LICENSE) for details.\n\n## Support\n\n- [GitHub Issues](https://github.com/supabase/supabase-micro/issues)\n- [Supabase Discord](https://discord.supabase.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupabase%2Fsupabase-micro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsupabase%2Fsupabase-micro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupabase%2Fsupabase-micro/lists"}