Thanks for considering contributing to PasarGuard!
Please don’t use GitHub Issues to ask questions. Instead, use one of the following platforms:
- 💬 Telegram: @Pasar_Guard
- 🗣️ GitHub Discussions: PasarGuard Discussions
When reporting a bug or issue, please include:
- ✅ What you expected to happen
- ❌ What actually happened (include server logs or browser errors)
- ⚙️ Your
xrayJSON config and.envsettings (censor sensitive info) - 🔢 Your PasarGuard version and Docker version (if applicable)
If there's no open issue for your idea, consider opening one for discussion before submitting a PR.
You can contribute to any issue that:
- Has no PR linked
- Has no maintainer assigned
No need to ask for permission!
- Always branch off of the
nextbranch - Keep
mainstable and production-ready
.
├── app # Backend code (FastAPI - Python)
├── cli # CLI code (Typer - Python)
├── dashboard # Frontend code (React Router - TypeScript)
└── tests # API tests
The project uses uv for Python dependency management and bun for frontend dependencies.
- Install
uvif you haven't already. - Initialize the virtual environment and install dependencies:
make setup
- Run database migrations:
make run-migration
- Start the application:
make run
- Install
bunif you haven't already. - Install frontend dependencies:
make install-front
The backend is built with FastAPI and SQLAlchemy:
- Pydantic models: app/models/
- Database structure: app/db/
- SQLAlchemy models: app/db/models.py
- Database CRUD operations: app/db/crud/
- Alembic migrations: app/db/migrations/
- Core backend logic: app/operation/
- API Routers: app/routers/
🧩 Note: Ensure all core backend business logic is organized and implemented in the app/operation module. This keeps route handling, database access, and service logic clearly separated and easier to maintain.
Enable the DOCS flag in your .env file to access:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
Format and lint backend Python code with:
make check
make formatApply Alembic migrations to your database:
make run-migrationCheck migrations integrity:
make check-migrations
⚠️ We no longer upload pre-built frontend files.
The frontend is located in the dashboard/ directory and is built using:
- React Router 7 + TypeScript
- Tailwind CSS v4 + Shadcn UI
- Orval (for API client generation)
The frontend uses generated API clients via Orval. If you change backend routes or models, regenerate the TypeScript client by running:
make gen-apiFormat frontend code using Prettier:
make fformat- Follow Tailwind + Shadcn best practices.
- Keep components single-purpose.
- Prioritize readability and maintainability.
PasarGuard’s CLI is built using Typer.
- CLI codebase: cli/ and the entrypoint script pasarguard-cli.py.
- To run the CLI in development:
make run-cli
We use pytest for backend tests.
- Run tests:
make test - Run tests in watch mode:
make test-whatch
To run the project in debug mode with auto-reload, set DEBUG=true in your .env file.
When you run make run (or uv run main.py) with DEBUG=true:
- The backend FastAPI server starts in reload mode via Uvicorn.
- The frontend Vite dev server (
bun run dev) automatically spins up on a separate port. - The API client generator runs in the background to keep the frontend types in sync.
Install frontend dependencies first before running in debug mode:
make install-front💡 Note: In production mode (
DEBUG=false), the backend will check if thedashboard/builddirectory exists. If it doesn't, it will build the frontend once usingbun run buildand then mount and serve the static files fromdashboard/build/at/dashboard/.
Feel free to reach out via Telegram or GitHub Discussions if you have any questions. Happy contributing! 🚀