Getting Started with P8s¶
This guide will walk you through creating your first P8s application.
Prerequisites¶
- Python 3.10+
- Node.js 18+ (for frontend)
- pip or uv package manager
Installation¶
Option 1: Install from source (recommended for development)¶
Option 2: Install from PyPI (coming soon)¶
Create a New Project¶
This creates the following structure:
myapp/
├── backend/
│ ├── __init__.py
│ ├── main.py # FastAPI application entry point
│ ├── models.py # Your database models
│ └── settings.py # Project configuration
├── frontend/ # React + Vite frontend
│ ├── src/
│ ├── package.json
│ └── vite.config.ts
├── .env # Environment variables
└── pyproject.toml
Run the Development Server¶
# Start both backend and frontend
p8s dev
# Or specify a port
p8s dev --port 8000
# Backend only (no frontend)
p8s dev --no-frontend
Output:
P8s (Prometheus)
━━━━━━━━━━━━━━━━━━━
Starting development server...
Backend: http://0.0.0.0:8000
Frontend: http://localhost:5173
[backend] INFO: Uvicorn running on http://0.0.0.0:8000
[frontend] VITE ready in 500ms
Access Your Application¶
| URL | Description |
|---|---|
http://localhost:8000 |
Backend API |
http://localhost:8000/admin/ |
Admin panel |
http://localhost:8000/docs |
OpenAPI docs (admin-only) |
http://localhost:5173 |
Frontend (Vite dev server) |
Create a Superuser¶
To access the admin panel, create a superuser:
Create an App¶
Add a new app (e.g., products):
This creates:
backend/apps/products/
├── __init__.py
├── models.py # Database models
└── router.py # API endpoints
Register the app in backend/settings.py:
Next Steps¶
- Models & Database - Define your data models
- Authentication - User management and JWT
- Admin Panel - Django-style admin interface
- AI Features - AIField and VectorField