> ## Documentation Index
> Fetch the complete documentation index at: https://fluxcrud.mahimai.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Start building with FluxCRUD in under 5 minutes

## Setup

<Steps>
  <Step title="Install Library">
    Install FluxCRUD and its dependencies.

    ```bash theme={null}
    pip install fluxcrud
    ```

    *Optional: Install `uvicorn` for running the server.*

    ```bash theme={null}
    pip install uvicorn
    ```
  </Step>

  <Step title="Create App">
    Create a file named `main.py`:

    ```python theme={null}
    from typing import Optional
    from fastapi import FastAPI
    from fluxcrud import Flux, Base, Schema
    from sqlalchemy.orm import Mapped, mapped_column

    # 1. Define Model
    class Task(Base):
        __tablename__ = "tasks"
        id: Mapped[int] = mapped_column(primary_key=True)
        title: Mapped[str]
        done: Mapped[bool] = mapped_column(default=False)

    # 2. Define Schema
    class TaskSchema(Schema):
        title: str
        done: bool

    class TaskCreate(Schema):
        title: str

    class TaskUpdate(Schema):
        title: Optional[str] = None
        done: Optional[bool] = None

    # 3. Initialize Flux
    app = FastAPI()
    flux = Flux(app, db_url="sqlite+aiosqlite:///app.db")
    flux.attach_base(Base)

    # 4. Register Resource
    flux.register(
        model=Task,
        schema=TaskSchema,
        create_schema=TaskCreate,
        update_schema=TaskUpdate,
        prefix="/tasks",
        tags=["Tasks"]
    )
    ```
  </Step>

  <Step title="Run Server">
    Run the application:

    ```bash theme={null}
    uvicorn main:app --reload
    ```
  </Step>

  <Step title="Test API">
    Open your browser to `http://127.0.0.1:8000/docs`.

    You will see a fully functional CRUD API for Tasks!
  </Step>
</Steps>
