Quick Start Guide ================= This guide will help you create your first Gobstopper application in minutes. Your First Application ---------------------- Create a file called ``app.py``: .. code-block:: python from gobstopper import Gobstopper, Request, jsonify app = Gobstopper(__name__) @app.get("/") async def hello(request: Request): return jsonify({"message": "Hello from Gobstopper!"}) @app.get("/users/") async def get_user(request: Request, user_id: str): return jsonify({"user_id": user_id, "name": f"User {user_id}"}) Running the Application ----------------------- Run your application with the Gobstopper CLI: .. code-block:: bash gobstopper run --reload Or with Granian directly: .. code-block:: bash granian --interface rsgi --reload app:app Visit http://localhost:8000 in your browser to see your application running. Type-Safe Request Validation ----------------------------- Gobstopper supports automatic request validation using msgspec: .. code-block:: python from gobstopper import Gobstopper, Request, jsonify from msgspec import Struct app = Gobstopper(__name__) class User(Struct): name: str email: str age: int = 0 @app.post("/api/users") async def create_user(request: Request, user: User): # user is automatically validated! # Returns 422 if validation fails return jsonify({"created": user.name, "email": user.email}) Templates --------- Enable Jinja2 templates: .. code-block:: python from gobstopper import Gobstopper, Request app = Gobstopper(__name__) app.init_templates("templates") @app.get("/") async def index(request: Request): return await app.render_template("index.html", message="Hello World!") Create ``templates/index.html``: .. code-block:: html Gobstopper App

{{ message }}

Background Tasks ---------------- Add background task processing: .. code-block:: python from gobstopper import Gobstopper, Request, jsonify, TaskPriority import asyncio app = Gobstopper(__name__) @app.task("send_email", "notifications") async def send_email(to: str, subject: str): await asyncio.sleep(1) # Simulate work print(f"Email sent to {to}: {subject}") return {"status": "sent"} @app.post("/api/notify") async def notify(request: Request): data = await request.get_json() task_id = await app.add_background_task( "send_email", "notifications", TaskPriority.HIGH, to=data["email"], subject=data["subject"] ) return jsonify({"task_id": task_id}) # Start workers @app.on_startup async def startup(): await app.start_task_workers("notifications", worker_count=2) WebSockets ---------- Add WebSocket support: .. code-block:: python from gobstopper import Gobstopper app = Gobstopper(__name__) @app.websocket("/ws/chat") async def chat_handler(websocket): await websocket.accept() while True: message = await websocket.receive() await websocket.send_text(f"Echo: {message.data}") Configuration Files ------------------- Create a ``production.toml`` config: .. code-block:: toml app = "app:app" host = "0.0.0.0" port = 8080 workers = 4 threads = 2 reload = false Run with config: .. code-block:: bash gobstopper run --config production Next Steps ---------- * :doc:`tutorial/index` - Complete tutorial series * :doc:`api/application` - Application API reference * :doc:`features/background_tasks` - Background tasks guide * :doc:`features/websockets` - WebSocket guide * :doc:`cli` - CLI tools documentation