| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Interactive P4 Program Visualizer - Upload and visualize P4 programs with an intuitive, interactive pipeline flow diagram.
Crafted by Sankalp Jha
p4Lens/ ├── backend/ # FastAPI backend for P4 parsing │ ├── main.py # API endpoints │ ├── parser_utils.py # P4 parsing logic │ ├── Dockerfile # Backend container │ └── requirements.txt ├── frontend/ # React + Vite frontend │ ├── src/ │ │ ├── App.jsx # Main application │ │ └── components/ui/ │ │ ├── PipelineFlow.jsx # ReactFlow visualization │ │ ├── card.jsx │ │ └── button.jsx │ ├── Dockerfile # Frontend container │ └── package.json └── docker-compose.yml
You can bootstrap everything with the helper script:
./start.sh # local FastAPI + Vite dev servers
./start.sh docker # production-like docker compose stack
./stop.sh # stops either mode (auto-detects docker)The script automatically installs dependencies, manages background processes, and cleans up containers so you don't get orphaned docker instances.
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --host 0.0.0.0 --port 8000The backend API will be available at http://localhost:8000
cd frontend
npm install
npm run devThe frontend will be available at http://localhost:5173
# Build and start all services
docker-compose up --build
# Or run in detached mode
docker-compose up -d --buildHealth check endpoint
Returns API health status
Upload and parse a P4 file
Request:
Response:
{
"filename": "example.p4",
"structure": {
"ParserName": {
"type": "parser",
"tables": [],
"headers": [],
"externs": [],
...
},
"_tables": {...},
"_headers": {...},
"_externs": [...],
...
}
}The P4 parser extracts:
Contributions are welcome! Feel free to:
MIT License - feel free to use this project for your own purposes.
For issues, questions, or suggestions, please open an issue on GitHub or reach out via sankalpjha.dev.
Built with ❤️ for the P4 community
The backend is deployed to Myprod/Nomad at https://p4lens-api.sankalpjha.dev. Changes under backend/ on main are validated, built for Linux ARM64, published to the internal ghcr.io/openlabnetworks/p4lens-backend package, deployed by immutable digest, and verified through /health by .github/workflows/backend-deploy.yml.
The workflow uses the repository-scoped GITHUB_TOKEN to publish the package and the MYPROD_P4LENS_DEPLOY_TOKEN Actions secret to call a deployment endpoint that can update only p4lens-api. Neither token belongs in source control or local environment files.
| Back | FazBrowse Home | New Git URL |