β‘ 3-Minute Bootstrap: Hello WorldΒΆ
Get up and running with Neuroglia in under 3 minutes! This quick-start guide gets you from zero to a working API in the fastest way possible.
π Want a Production-Ready Starting Point?
For a fully-featured application template with authentication, frontend, and all common concerns pre-configured, check out the Starter App Repository. This guide shows the minimal hello-world approach.
π― What You'll Build
A minimal "Hello Pizzeria" API with one endpoint that demonstrates the basic framework setup.## π Quick Setup
PrerequisitesΒΆ
- Python 3.8+ installed
- pip package manager
InstallationΒΆ
# Create new directory
mkdir hello-pizzeria && cd hello-pizzeria
# Install Neuroglia
pip install neuroglia-python[web]
π Create Your First APIΒΆ
Create main.py:
from neuroglia.hosting.web import WebApplicationBuilder
from neuroglia.mvc import ControllerBase
from classy_fastapi.decorators import get
class HelloController(ControllerBase):
"""Simple hello world controller"""
@get("/hello")
async def hello_world(self) -> dict:
"""Say hello to Mario's Pizzeria!"""
return {
"message": "Welcome to Mario's Pizzeria! π",
"status": "We're open for business!",
"framework": "Neuroglia Python"
}
def create_app():
"""Create the web application"""
builder = WebApplicationBuilder()
# Add SubApp with controllers
builder.add_sub_app(
SubAppConfig(
path="/api",
name="api",
controllers=[HelloController]
)
)
# Build app
app = builder.build()
return app
if __name__ == "__main__":
import uvicorn
app = create_app()
uvicorn.run(app, host="0.0.0.0", port=8000)
πββοΈ Run Your APIΒΆ
π Test Your APIΒΆ
Open your browser and visit:
- API Endpoint: http://localhost:8000/hello
- API Documentation: http://localhost:8000/docs
You should see:
{
"message": "Welcome to Mario's Pizzeria! π",
"status": "We're open for business!",
"framework": "Neuroglia Python"
}
β What You've AccomplishedΒΆ
In just 3 minutes, you've created:
- β A working FastAPI application with Neuroglia
- β Automatic API documentation (Swagger UI)
- β Controller-based routing with clean architecture
- β Automatic module discovery
- β Dependency injection container setup
π Next StepsΒΆ
Now that you have the basics working:
- π οΈ Local Development Setup - Set up a proper development environment
- π Mario's Pizzeria Tutorial - Build a complete application (1 hour)
- π― Architecture Patterns - Learn the design principles
- π Framework Features - Explore advanced capabilities
π Key Concepts IntroducedΒΆ
This hello world example demonstrates:
- Controller Pattern - Web request handling
- Dependency Injection - Service container setup
- WebApplicationBuilder - Application bootstrapping
π― Pro Tip
This is just the beginning! The framework includes powerful features like CQRS, event sourcing, and advanced data access patterns. Continue with the Local Development Setup to explore more.