Quick Start
Create a working Pyxle app in under 5 minutes.
1. Scaffold a new project
pyxle init my-appThis creates a my-app/ directory with a complete starter project.
2. Install dependencies
cd my-app
pyxle installThis runs both pip install -r requirements.txt and npm install. You can also run them separately:
pip install -r requirements.txt
npm install3. Build Tailwind CSS
In a separate terminal, start the Tailwind watcher:
npm run dev:cssThis compiles pages/styles/tailwind.css into public/styles/tailwind.css and watches for changes. The dev server also auto-starts Tailwind if it detects a config file, so this step is optional if you use pyxle dev with the --tailwind flag (enabled by default).
4. Start the dev server
pyxle devOpen http://localhost:8000 in your browser. You should see the Pyxle landing page with a hero section, feature cards, and a dark mode toggle.
What just happened?
When you ran pyxle dev, the framework:
- Compiled
pages/index.pyxl-- split the Python server code from the React JSX - Started Vite -- the JavaScript bundler that serves your React components with hot reload
- Started Starlette -- the Python ASGI server that handles routing, SSR, and API requests
- Ran the
@serverloader -- fetched data on the server and passed it as props to React - Rendered HTML on the server -- sent fully-rendered HTML to the browser (SSR)
- Hydrated on the client -- React took over the server-rendered HTML for interactivity
5. Make a change
Open pages/index.pyxl in your editor. Find the title value inside the load_home function and change it:
@server
async def load_home(request):
return {
"hero": {
"title": "Hello from Pyxle!",
# ...
},
}Save the file. The browser reloads automatically with your updated title.
6. Check your routes
pyxle routesThis prints the route table derived from your pages/ directory:
Route File Loader
/ pages/index.pyxl load_home
/api/pulse pages/api/pulse.py --7. Validate your project
pyxle checkThis validates .pyxl syntax, checks your config file, and reports any issues.
Next steps
- Understand what each file does: Project Structure
- Learn the
.pyxlfile format: `.pyxl` Files - Add a new page with data loading: Data Loading