Skip to content

Quick Start

Get up and running with Nexios in minutes ⏱️. This guide will walk you through creating your first Nexios application.

Prerequisites

  • Python 3.8+
  • pip (Python package manager)

Installation

  1. Create a new virtual environment (recommended) :

    bash
    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  2. Install Nexios :

    bash
    pip install nexios

Your First Application

A simple Nexios one file application will look like this:

python
from nexios import NexiosApp
from nexios.http import Response,Request

app = NexiosApp()

@app.get("/")
async def home(request:Request,response:Response):
    return response.json({"message": "Welcome to Nexios!"})

if __name__ == "__main__":
    import uvicorn
       uvicorn.run(app, host="0.0.0.0", port=8000)
  1. Run your application ▶️:

    bash
    python main.py
  2. Open your browser and visit http://localhost:8000 You should see: {"message": "Welcome to Nexios!"}

Adding More Route

python
from nexios import NexiosApp
from nexios.http import Response,Request

app = NexiosApp()

@app.get("/")
async def home(request:Request,response:Response):
    return response.json({"message": "Welcome to Nexios!"})

@app.get("/hello/{name}")
async def greeting(request:Request,response:Response,name: str):
    return response.html(f"<h1>Hello, {name}!</h1>")

@app.post("/data")
async def create_data(request:Request,response:Response):
    data = await request.json
    return response.json({"received": data, "status": "success"})

Interactive API Documentation

Nexios automatically generates interactive API documentation:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

Next Steps

Need Help?