# sanic-org/sanic

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/sanic-org-sanic).**

18,639 stars · 1,585 forks · Python · mit

## Links

- GitHub: https://github.com/sanic-org/sanic
- Homepage: https://sanic.dev
- awesome-repositories: https://awesome-repositories.com/repository/sanic-org-sanic.md

## Topics

`api-server` `asgi` `asyncio` `framework` `python` `sanic` `web` `web-framework` `web-server`

## Description

Sanic is an asynchronous Python web framework designed for building high-performance APIs and services. It operates as a production-ready ASGI web server, utilizing a non-blocking event loop to handle concurrent requests and maximize throughput. The framework is built to support scalable architectures, offering built-in worker process management to distribute traffic across available CPU cores.

What distinguishes Sanic is its focus on modularity and developer-centric tooling. It features a blueprint-based system for organizing complex applications into pluggable components, alongside a robust CLI that supports zero-downtime worker reloading, interactive debugging, and administrative inspection of running instances. The framework also provides native support for real-time WebSocket communication and granular control over the request-response lifecycle through a middleware-driven pipeline.

The framework covers a broad capability surface, including comprehensive request validation, dependency injection, and secure authentication mechanisms. It provides extensive configuration options for environment variables, custom error handling, and automated API documentation generation. Developers can manage application state across workers, integrate with asynchronous database toolkits, and handle large data streams or file uploads with built-in streaming support.

Sanic is designed for production environments, offering built-in TLS support, proxy-aware request handling, and container-ready deployment patterns. It is distributed as a standard Python package, with documentation and tooling provided to facilitate both local development and scalable server execution.

## Tags

### Web Development

- [Asynchronous Web Frameworks](https://awesome-repositories.com/f/web-development/asynchronous-web-frameworks.md) — Builds high-performance web services and APIs using asynchronous request handling to maximize concurrency and throughput.
- [Asynchronous Request Handlers](https://awesome-repositories.com/f/web-development/asynchronous-request-handlers.md) — Processes incoming HTTP traffic using an asynchronous event loop to maintain high performance and scalability. ([source](https://sanic.dev/en/guide/introduction.html))
- [Asynchronous API Routing](https://awesome-repositories.com/f/web-development/backend-development/web-frameworks/routing-request-handling/asynchronous-api-routing.md) — Maps incoming HTTP requests to asynchronous functions for high-performance, non-blocking execution. ([source](https://sanic.dev/en/guide/getting-started.html))
- [Web Application Frameworks](https://awesome-repositories.com/f/web-development/web-application-frameworks.md) — Provides a comprehensive platform for building scalable web applications with integrated routing, security, and architecture. ([source](https://sanic.dev/en/guide/running/running.html))
- [Web Servers](https://awesome-repositories.com/f/web-development/web-infrastructure-deployment/web-infrastructure/web-servers.md) — Provides a production-ready ASGI web server with multi-process worker management and zero-downtime reloading capabilities.
- [Web Servers](https://awesome-repositories.com/f/web-development/web-servers.md) — Implements the ASGI specification to provide a production-ready, high-throughput web server.
- [Modular Routing Systems](https://awesome-repositories.com/f/web-development/backend-development/web-frameworks/routing-request-handling/modular-routing-systems.md) — Organizes application logic into pluggable, blueprint-based modular components.
- [High-Performance Web Frameworks](https://awesome-repositories.com/f/web-development/high-performance-web-frameworks.md) — Operates as a lightweight, high-performance web microframework optimized for speed and efficiency.
- [Request Handling](https://awesome-repositories.com/f/web-development/request-handling.md) — Handles multiple incoming requests simultaneously using asynchronous execution to maximize resource efficiency. ([source](https://sanic.dev/en/guide/basics/handlers.html))
- [HTTP Response Handling](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/http-response-handling.md) — Returns various content types including text, HTML, JSON, or files to the client with configurable status codes. ([source](https://sanic.dev/en/guide/basics/response.html))
- [Request Body Validations](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/request-body-validations.md) — Enforces schema constraints on incoming query parameters and request bodies to ensure data integrity. ([source](https://sanic.dev/en/guide/introduction.html))
- [HTTP Request Handlers](https://awesome-repositories.com/f/web-development/backend-development/web-frameworks/routing-request-handling/http-request-handlers.md) — Executes functions that return formatted responses like JSON, HTML, or redirects based on incoming traffic. ([source](https://sanic.dev/en/guide/basics/handlers.html))
- [Compatibility Layers](https://awesome-repositories.com/f/web-development/compatibility-layers.md) — Implements the ASGI specification for interoperability with modern asynchronous web servers.
- [Middleware](https://awesome-repositories.com/f/web-development/middleware.md) — Allows wrapping endpoints with middleware logic to enforce cross-cutting concerns like authentication or logging. ([source](https://sanic.dev/en/guide/advanced/class-based-views.html))
- [Real-Time Communication](https://awesome-repositories.com/f/web-development/real-time-communication.md) — Offers native support for persistent, bidirectional WebSocket communication for real-time data exchange.
- [Request Interception Middleware](https://awesome-repositories.com/f/web-development/request-interception-middleware.md) — Executes custom logic before or after a route handler processes an incoming request to modify data or perform side effects. ([source](https://sanic.dev/en/guide/basics/middleware.html))
- [Request Parsing](https://awesome-repositories.com/f/web-development/request-parsing.md) — Extracts incoming data from JSON bodies, form submissions, and file uploads into structured objects. ([source](https://sanic.dev/en/guide/basics/request.html))
- [Route Grouping](https://awesome-repositories.com/f/web-development/route-grouping.md) — Groups multiple modular components into hierarchical structures with shared URL prefixes and versioning. ([source](https://sanic.dev/en/guide/best-practices/blueprints.html))
- [API Versioning](https://awesome-repositories.com/f/web-development/api-versioning.md) — Provides built-in support for API versioning at the route, group, or application level. ([source](https://sanic.dev/en/guide/advanced/versioning.html))
- [Application Lifecycle Managers](https://awesome-repositories.com/f/web-development/application-lifecycle-managers.md) — Enables administrative inspection, reloading, and scaling of worker processes for live applications. ([source](https://sanic.dev/en/guide/running/inspector.html))
- [HTTP Request Handling](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/http-request-handling.md) — Provides utilities for parsing, routing, and managing incoming HTTP requests and their associated data payloads. ([source](https://sanic.dev/en/guide/basics/app.html))
- [HTTP Error Handling](https://awesome-repositories.com/f/web-development/http-error-handling.md) — Interrupts request execution to return specific HTTP status codes and error messages to the client. ([source](https://sanic.dev/en/guide/best-practices/exceptions.html))
- [Request Parameter Parsers](https://awesome-repositories.com/f/web-development/request-parameter-parsers.md) — Extracts values from URL path segments and query strings to dynamically handle incoming requests. ([source](https://sanic.dev/en/guide/basics/request.html))
- [Request Validation Middleware](https://awesome-repositories.com/f/web-development/request-validation-middleware.md) — Wraps route handlers to inspect incoming requests and perform authorization checks before executing primary logic. ([source](https://sanic.dev/en/guide/best-practices/decorators.html))
- [Response Streaming Interfaces](https://awesome-repositories.com/f/web-development/response-streaming-interfaces.md) — Sends data to the client incrementally as it becomes available to support real-time data delivery. ([source](https://sanic.dev/en/guide/advanced/streaming.html))
- [Path Parameter Converters](https://awesome-repositories.com/f/web-development/routing-systems/routing/parameter-handling-utilities/path-parameter-converters.md) — Captures dynamic segments from URL paths and injects them into handler functions with automatic data casting. ([source](https://sanic.dev/en/guide/advanced/class-based-views.html))
- [Component Registration Systems](https://awesome-repositories.com/f/web-development/component-registration-systems.md) — Automates the discovery and registration of blueprints, middleware, and listeners by scanning modules. ([source](https://sanic.dev/en/guide/how-to/autodiscovery.html))
- [Framework Plugins](https://awesome-repositories.com/f/web-development/framework-plugins.md) — Integrates plugins to provide automated documentation, request validation, dependency injection, and cross-origin resource sharing. ([source](https://sanic.dev/en/guide/getting-started.html))
- [HTTP Redirects](https://awesome-repositories.com/f/web-development/http-redirects.md) — Issues HTTP redirect responses to navigate the client to a different path or URL based on application logic. ([source](https://sanic.dev/en/guide/basics/response.html))
- [HTTP Servers](https://awesome-repositories.com/f/web-development/http-servers.md) — Configures the server to handle different HTTP versions, including simultaneous support for HTTP/1.1 and HTTP/3. ([source](https://sanic.dev/en/guide/running/running.html))
- [Request Body Handling](https://awesome-repositories.com/f/web-development/request-body-handling.md) — Reads request body content incrementally as bytes arrive to handle large payloads without loading them into memory. ([source](https://sanic.dev/en/guide/advanced/streaming.html))
- [Regex-Based URL Dispatchers](https://awesome-repositories.com/f/web-development/routing-systems/routing/matching-algorithms/regex-based-url-dispatchers.md) — Supports complex URL matching using regular expressions for dynamic route handling. ([source](https://sanic.dev/en/guide/basics/routing.html))
- [Static File Servers](https://awesome-repositories.com/f/web-development/static-file-servers.md) — Serves static assets directly to reduce processing overhead and improve response times. ([source](https://sanic.dev/en/guide/deployment/caddy.html))
- [Streaming Responses](https://awesome-repositories.com/f/web-development/streaming-responses.md) — Transmits large files to the client incrementally in chunks to manage memory usage and improve performance. ([source](https://sanic.dev/en/guide/advanced/streaming.html))
- [URL Generators](https://awesome-repositories.com/f/web-development/url-generators.md) — Enables programmatic URL generation by referencing handler names to avoid hardcoded paths. ([source](https://sanic.dev/en/guide/basics/headers.html))

### Programming Languages & Runtimes

- [Asynchronous Event Loops](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/concurrency-models/asynchronous-event-loops.md) — Utilizes a non-blocking event loop to handle concurrent requests and maximize throughput.
- [High-Performance Server](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/runtimes/deployment-specific-runtimes/high-performance-server.md) — Executes web applications using a built-in, high-performance server designed for production environments. ([source](https://sanic.dev/en/guide/getting-started.html))

### Networking & Communication

- [WebSocket Managers](https://awesome-repositories.com/f/networking-communication/websocket-managers.md) — Provides native support for persistent, bidirectional WebSocket communication. ([source](https://sanic.dev/en/guide/advanced/websockets.html))
- [Request Contexts](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/request-processing-architectures/request-processing/request-contexts.md) — Maintains isolated data containers scoped to the lifetime of a single request. ([source](https://sanic.dev/en/guide/basics/request.html))
- [Client IP Identification](https://awesome-repositories.com/f/networking-communication/client-ip-identification.md) — Extracts the true client IP address from incoming request headers by configuring trusted proxy settings. ([source](https://sanic.dev/en/guide/advanced/proxy-headers.html))
- [Proxy Headers](https://awesome-repositories.com/f/networking-communication/proxy-headers.md) — Configures the application to trust forwarded headers from reverse proxies for accurate client IP identification. ([source](https://sanic.dev/en/guide/deployment/caddy.html))

### Testing & Quality Assurance

- [Worker Process Management](https://awesome-repositories.com/f/testing-quality-assurance/testing-infrastructure-management/test-orchestration/worker-process-management.md) — Manages worker processes to distribute traffic across available CPU cores for high-performance execution.
- [Worker Lifecycle Controls](https://awesome-repositories.com/f/testing-quality-assurance/testing-infrastructure-management/test-orchestration/worker-process-management/worker-lifecycle-controls.md) — Controls the inspection, restarting, or termination of individual or all worker processes during application runtime. ([source](https://sanic.dev/en/guide/running/manager.html))

### DevOps & Infrastructure

- [Zero-Downtime Deployments](https://awesome-repositories.com/f/devops-infrastructure/zero-downtime-deployments.md) — Performs zero-downtime reloads by starting new worker processes and verifying readiness before terminating existing ones. ([source](https://sanic.dev/en/guide/running/manager.html))
- [Background Task Runners](https://awesome-repositories.com/f/devops-infrastructure/automation-orchestration/task-execution-frameworks/task-job-management/background-task-runners.md) — Executes asynchronous background tasks during application startup and runtime. ([source](https://sanic.dev/en/guide/basics/tasks.html))
- [Web Server Integrations](https://awesome-repositories.com/f/devops-infrastructure/web-server-integrations.md) — Runs the application using third-party web servers for compatibility with alternative deployment ecosystems. ([source](https://sanic.dev/en/guide/running/running.html))

### Security & Cryptography

- [User Access Management](https://awesome-repositories.com/f/security-cryptography/user-access-management.md) — Provides centralized tools for managing user identity and enforcing access permissions across application routes. ([source](https://sanic.dev/en/guide/how-to/table-of-contents.html))
- [Authentication and Authorization](https://awesome-repositories.com/f/security-cryptography/authentication-and-authorization.md) — Implements secure authentication and authorization mechanisms to protect sensitive API endpoints.
- [Request Access Restrictions](https://awesome-repositories.com/f/security-cryptography/domain-access-restrictions/request-access-restrictions.md) — Validates user credentials or tokens on incoming requests to determine if the client is authorized to access specific application routes. ([source](https://sanic.dev/en/guide/how-to/authentication.html))
- [TLS Management](https://awesome-repositories.com/f/security-cryptography/tls-management.md) — Encrypts web traffic using SSL/TLS certificates with support for automated SNI-based selection and host validation. ([source](https://sanic.dev/en/guide/how-to/tls.html))
- [Administrative Security](https://awesome-repositories.com/f/security-cryptography/administrative-security.md) — Secures administrative interfaces using TLS encryption and API key authentication. ([source](https://sanic.dev/en/guide/running/inspector.html))
- [Token-based Authorization](https://awesome-repositories.com/f/security-cryptography/token-based-authorization.md) — Parses standard authentication headers from incoming requests to extract tokens for use in route handlers. ([source](https://sanic.dev/en/guide/basics/headers.html))
- [Cookie Management](https://awesome-repositories.com/f/security-cryptography/cookie-management.md) — Provides interfaces to read, write, and delete client cookies with configurable security and scoping attributes. ([source](https://sanic.dev/en/guide/basics/cookies.html))
- [CORS Policies](https://awesome-repositories.com/f/security-cryptography/cors-policies.md) — Configures cross-origin resource sharing security policies to control which external domains can access application resources. ([source](https://sanic.dev/en/guide/how-to/table-of-contents.html))

### Software Engineering & Architecture

- [Request Middleware](https://awesome-repositories.com/f/software-engineering-architecture/request-middleware.md) — Implements a middleware-driven pipeline for intercepting and processing the request-response lifecycle.
- [Modular Application Architectures](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/layering-presentation/application-layer-architectures/application-architecture-patterns/modular-application-architectures.md) — Organizes application logic into pluggable components and route groups to improve maintainability and project structure. ([source](https://sanic.dev/en/guide/best-practices/blueprints.html))
- [Application Configuration](https://awesome-repositories.com/f/software-engineering-architecture/application-lifecycle-management/configuration-management/configuration-scopes/application-configuration.md) — Manages application settings using dictionary-like syntax or environment variables to control runtime behavior. ([source](https://sanic.dev/en/guide/basics/app.html))
- [Lifecycle Event Systems](https://awesome-repositories.com/f/software-engineering-architecture/application-lifecycle-management/lifecycle-event-systems.md) — Triggers custom callbacks at specific server stages for initialization and graceful shutdown.
- [Error Handling](https://awesome-repositories.com/f/software-engineering-architecture/error-handling.md) — Registers custom logic to intercept and process specific exceptions or catch-all errors globally. ([source](https://sanic.dev/en/guide/basics/app.html))
- [Dependency Injection](https://awesome-repositories.com/f/software-engineering-architecture/integration-extensibility/dependency-injection.md) — Supplies required objects or services directly into route handlers to simplify data access and improve modularity. ([source](https://sanic.dev/en/guide/introduction.html))
- [Application Factories](https://awesome-repositories.com/f/software-engineering-architecture/application-lifecycle-management/configuration-management/configuration-scopes/application-configuration/application-factories.md) — Uses a factory function to instantiate the application, enabling isolated configuration and modularity. ([source](https://sanic.dev/en/guide/basics/app.html))
- [Event Dispatchers](https://awesome-repositories.com/f/software-engineering-architecture/event-dispatchers.md) — Triggers asynchronous callbacks across different parts of an application to decouple logic and notify components. ([source](https://sanic.dev/en/guide/advanced/signals.html))

### Development Tools & Productivity

- [Hot-Reloading Servers](https://awesome-repositories.com/f/development-tools-productivity/hot-reloading-servers.md) — Restarts the server process automatically whenever source files are modified to reflect changes immediately. ([source](https://sanic.dev/en/guide/running/development.html))
- [API Documentation Generators](https://awesome-repositories.com/f/development-tools-productivity/api-documentation-generators.md) — Generates interactive API documentation automatically from application definitions. ([source](https://sanic.dev/en/guide/introduction.html))
- [CLI Command Extensions](https://awesome-repositories.com/f/development-tools-productivity/cli-command-extensions.md) — Registers custom functions as executable command-line subcommands for administrative or application-specific tasks. ([source](https://sanic.dev/en/guide/advanced/commands.html))
- [Administrative Command Extensions](https://awesome-repositories.com/f/development-tools-productivity/command-line-extensions/administrative-command-extensions.md) — Exposes custom administrative methods as both command-line subcommands and HTTP endpoints for inspection. ([source](https://sanic.dev/en/guide/running/inspector.html))

### Data & Databases

- [Database ORMs](https://awesome-repositories.com/f/data-databases/database-orms.md) — Connects asynchronous database toolkits to the application lifecycle to manage connections and schema generation automatically. ([source](https://sanic.dev/en/guide/how-to/orm.html))

### System Administration & Monitoring

- [Lifecycle Hooks](https://awesome-repositories.com/f/system-administration-monitoring/administrative-operations/service-and-infrastructure-management/server-management/lifecycle-hooks.md) — Provides lifecycle hooks for managing process initialization and worker setup. ([source](https://sanic.dev/en/guide/basics/listeners.html))
- [Application Logging](https://awesome-repositories.com/f/system-administration-monitoring/diagnostic-tools/diagnostics/telemetry-and-log-collectors/application-logging.md) — Records internal, access, and server events using standard logging interfaces with configurable output. ([source](https://sanic.dev/en/guide/best-practices/logging.html))

### User Interface & Experience

- [Server-Side Template Engines](https://awesome-repositories.com/f/user-interface-experience/layout-utilities/presentation-engines/template-engines/server-side-rendering-engines/server-side-template-engines.md) — Processes server-side templates to generate HTML responses for web interfaces using integrated templating engines. ([source](https://sanic.dev/en/guide/introduction.html))
