{"id":24522479,"url":"https://github.com/guduchango/sanic-python-example","last_synced_at":"2026-04-17T06:34:35.532Z","repository":{"id":269598704,"uuid":"907820226","full_name":"guduchango/sanic-python-example","owner":"guduchango","description":"sanic framework, migration, seed, docker-compose","archived":false,"fork":false,"pushed_at":"2024-12-24T18:17:58.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T13:12:19.702Z","etag":null,"topics":["docker","docker-compose","mysql","python","sanic-framework"],"latest_commit_sha":null,"homepage":"","language":"Python","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/guduchango.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":"2024-12-24T13:21:02.000Z","updated_at":"2025-01-06T23:16:06.000Z","dependencies_parsed_at":"2024-12-24T18:38:38.108Z","dependency_job_id":null,"html_url":"https://github.com/guduchango/sanic-python-example","commit_stats":null,"previous_names":["guduchango/sanic-python-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/guduchango/sanic-python-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guduchango%2Fsanic-python-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guduchango%2Fsanic-python-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guduchango%2Fsanic-python-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guduchango%2Fsanic-python-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guduchango","download_url":"https://codeload.github.com/guduchango/sanic-python-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guduchango%2Fsanic-python-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31918728,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["docker","docker-compose","mysql","python","sanic-framework"],"created_at":"2025-01-22T03:20:23.039Z","updated_at":"2026-04-17T06:34:35.523Z","avatar_url":"https://github.com/guduchango.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 🚀 Sanic CRUD API Example\n\nA simple CRUD API built with [Sanic](https://sanic.dev/) for practicing the basics of building high-performance web APIs in Python. This project includes a modular structure with controllers, models, database seeding, and runs easily with Docker.\n\nIdeal for developers looking to explore Sanic’s asynchronous capabilities, request handling, and best practices for structuring a web API.\n\n---\n\n## 📦 Features\n\n✅ Fully asynchronous API with Sanic  \n✅ CRUD endpoints for a single entity (`Item`)  \n✅ Modular structure with controllers and models  \n✅ Database migration and seed scripts  \n✅ Docker \u0026 Docker Compose support for easy setup  \n✅ Ready-to-use environment for experimenting with Sanic\n\n---\n\n## 🗂️ Project Structure\n\n.\n├── app/\n│   ├── controllers/       # Route handlers (controllers)\n│   ├── models/            # Database models\n│   ├── seeds/             # Seed scripts for database population\n│   └── main.py            # Entry point for the Sanic app\n├── database/\n│   ├── migrate.py         # Migration script\n│   └── seed.py            # Seed script\n├── Dockerfile             # Docker image definition\n├── docker-compose.yml     # Docker Compose services configuration\n├── requirements.txt       # Python dependencies\n└── README.md              # Project documentation\n\n---\n\n## 🚀 Getting Started\n\n### Clone the repository\n\n```bash\ngit clone https://github.com/guduchango/sanic-python-example.git\ncd sanic-python-example\n```\n\n---\n\n## 🐳 Running with Docker\n\nBuild the Docker image:\n\n```bash\ndocker-compose build\n```\n\nStart the containers:\n\n```bash\ndocker-compose up\n```\n\n---\n\n## 🛠️ Database Migrations \u0026 Seeding\n\nRun database migrations:\n\n```bash\ndocker-compose run web python database/migrate.py\n```\n\nSeed the database with initial data:\n\n```bash\ndocker-compose run web python database/seed.py\n```\n\n---\n\n## 📚 API Endpoints\n\nOnce the app is running on **http://localhost:8000**, the following CRUD routes are available:\n\n| Method | Route                 | Description               |\n|--------|-----------------------|---------------------------|\n| GET    | `/`                   | Health check/test route   |\n| GET    | `/items`              | List all items            |\n| GET    | `/items/\u003citem_id\u003e`    | Retrieve an item by ID    |\n| POST   | `/items`              | Create a new item         |\n| PUT    | `/items/\u003citem_id\u003e`    | Update an existing item   |\n| DELETE | `/items/\u003citem_id\u003e`    | Delete an existing item   |\n\n---\n\n## ✅ Example Requests with curl\n\n**List all items**\n```bash\ncurl -X GET http://localhost:8000/items\n```\n\n**Get a specific item**\n```bash\ncurl -X GET http://localhost:8000/items/1\n```\n\n**Create a new item**\n```bash\ncurl -X POST http://localhost:8000/items -H \"Content-Type: application/json\" -d '{\"name\": \"New Item\", \"description\": \"A new item added to the database\"}'\n```\n\n**Update an item**\n```bash\ncurl -X PUT http://localhost:8000/items/1 -H \"Content-Type: application/json\" -d '{\"name\": \"Updated Item\", \"description\": \"Updated description\"}'\n```\n\n**Delete an item**\n```bash\ncurl -X DELETE http://localhost:8000/items/1\n```\n\n---\n\n## 🔗 Access the API\n\nOnce running, your API will be available at:\n\n```\nhttp://localhost:8000\n```\n\n---\n\n## 📝 Prerequisites\n\n- Docker\n- Docker Compose\n\n---\n\n## 📄 License\n\nMIT License.\n\n---\n\n## 🙌 Contributing\n\nContributions are welcome! Feel free to fork the repo and submit a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguduchango%2Fsanic-python-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguduchango%2Fsanic-python-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguduchango%2Fsanic-python-example/lists"}