master.sh is a one-shot bootstrap script that scaffolds a complete full-stack
starter project with FastAPI backend, Vite/React UI, and PostgreSQL database via
Docker Compose.
- 🔍 Environment Detection: Automatically detects Python, Node.js, Docker, Git, and their versions
- 🏗️ Project Scaffolding: Creates complete project structure with API and UI directories
- 📦 Dependency Management: Installs Python and Node.js dependencies automatically
- 🐳 Docker Support: Generates docker-compose.yml with PostgreSQL, API, and UI services
- 🔧 Git Integration: Initializes Git, creates .gitignore, and sets up pre-commit hooks
- 🚀 CI/CD Ready: Generates GitHub Actions workflow for automated testing and building
- 💻 Development Commands: Simple commands to run services locally or via Docker
./master.sh detectThis will show you which tools are available on your system.
./master.sh setupThis single command will:
- Create
api/directory with FastAPI application - Create
ui/directory with Vite/React application - Generate Docker Compose configuration
- Install Python and Node.js dependencies
- Initialize Git repository
- Set up pre-commit hooks
- Create GitHub Actions CI workflow
Option A: Run locally (without Docker)
./master.sh runOption B: Run with Docker Compose
./master.sh docker.
├── api/
│ ├── main.py # FastAPI application with /health endpoint
│ ├── requirements.txt # Python dependencies (FastAPI, Uvicorn)
│ ├── start.sh # Startup script
│ ├── Dockerfile # Docker image for API
│ └── venv/ # Python virtual environment
├── ui/
│ ├── src/
│ │ └── main.jsx # React app that checks API health
│ ├── index.html # HTML entry point
│ ├── package.json # Node.js dependencies (React, Vite)
│ ├── vite.config.mjs # Vite configuration
│ ├── Dockerfile # Multi-stage Docker build
│ └── node_modules/ # Node.js dependencies
├── .github/
│ └── workflows/
│ └── ci.yml # GitHub Actions CI workflow
├── hooks/
│ └── pre-commit.sh # Git pre-commit hook
├── docker-compose.yml # Docker Compose configuration
├── .gitignore # Git ignore rules
└── master.sh # This bootstrap script
Detect available development tools on your system.
./master.sh detectOutput example:
ℹ️ Detection Summary:
Python: ✓
Node.js: ✓
npm: ✓
Docker: ✓
Docker Compose: ✓
Git: ✓
Run complete project setup including scaffolding, dependency installation, and configuration.
./master.sh setupCustom Configuration:
PROJECT_NAME=myproject API_PORT=8080 UI_PORT=3000 ./master.sh setupStart API and UI services locally without Docker (requires Python and Node.js).
./master.sh runServices will be available at:
Press Ctrl+C to stop both services.
Start all services using Docker Compose (requires Docker).
./master.sh dockerThis will:
- Build Docker images for API and UI
- Start PostgreSQL database
- Start API service (waits for DB health check)
- Start UI service (depends on API)
Interactive helper to push your project to GitHub.
./master.sh github-pushThis will guide you through:
- Checking for existing Git remote
- Adding a new remote if needed
- Committing changes
- Pushing to GitHub
Show help message with all available commands and configuration options.
./master.sh helpAll configuration is done via environment variables:
| Variable | Default | Description |
|---|---|---|
PROJECT_NAME |
myapp |
Name of the project |
DEFAULT_GITHUB_ORG |
(empty) | Default GitHub organization/username |
DEFAULT_GITHUB_VISIBILITY |
public |
Repository visibility (public/private) |
API_PORT |
8000 |
Port for FastAPI server |
UI_PORT |
3001 |
Port for Vite dev server / nginx |
DB_PORT |
5432 |
Port for PostgreSQL |
DB_NAME |
myapp_db |
PostgreSQL database name |
DB_USER |
postgres |
PostgreSQL username |
DB_PASSWORD |
postgres |
PostgreSQL password |
PY_VERSION |
3.11 |
Python version for Dockerfile |
NODE_VERSION_HINT |
18 |
Node.js version for Dockerfile |
FORCE_OVERWRITE |
0 |
Set to 1 to overwrite existing files |
PROJECT_NAME=awesome-app \
API_PORT=9000 \
UI_PORT=4000 \
DB_PASSWORD=secure_password \
./master.sh setupThe generated FastAPI application includes:
-
GET / - Root endpoint
{ "message": "Hello from FastAPI!", "status": "running" } -
GET /health - Health check endpoint
{ "status": "healthy", "service": "api" }
The generated React application:
- Polls the API
/healthendpoint every 5 seconds - Displays API status with visual feedback (green for healthy, red for error)
- Shows API response in formatted JSON
- Includes getting started information
- Image:
postgres:15-alpine - Port: 5432 (configurable)
- Includes health check
- Persistent volume for data
- Built from
api/Dockerfile - Port: 8000 (configurable)
- Waits for database to be healthy
- Auto-restart enabled
- Multi-stage build: Node.js builder + nginx server
- Port: 3001 (configurable)
- Depends on API service
- Production-optimized build
The generated CI workflow includes:
- Sets up Python
- Installs API dependencies
- Runs tests (placeholder - add your tests)
- Sets up Node.js
- Installs UI dependencies
- Builds production bundle
- Uploads build artifacts
Located at hooks/pre-commit.sh and symlinked to .git/hooks/pre-commit.
Default placeholder implementation - customize for your needs:
- Linting
- Code formatting
- Unit tests
- Static analysis
Running ./master.sh setup multiple times is safe:
- Existing files are not overwritten by default
- Use
FORCE_OVERWRITE=1to override this behavior - Dependencies are only installed if needed
Install Python 3:
# Ubuntu/Debian
sudo apt-get install python3 python3-venv
# macOS
brew install python@3.11Install Node.js:
# Ubuntu/Debian
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
# macOS
brew install node@18Install Docker:
- Ubuntu/Debian: https://docs.docker.com/engine/install/ubuntu/
- macOS: https://docs.docker.com/desktop/install/mac-install/
- Windows: https://docs.docker.com/desktop/install/windows-install/
Change the ports using environment variables:
API_PORT=8001 UI_PORT=3002 ./master.sh runMake scripts executable:
chmod +x master.sh api/start.sh hooks/pre-commit.sh- Edit
api/requirements.txt - Add your packages
- Re-run dependency installation:
cd api source venv/bin/activate pip install -r requirements.txt
- Edit
ui/package.jsonor use npm:cd ui npm install <package-name>
Edit api/main.py:
@app.get("/api/users")
async def get_users():
return {"users": []}Edit ui/src/main.jsx to add components and functionality.
Add a migration tool like Alembic:
cd api
source venv/bin/activate
pip install alembic
alembic init migrations- Environment Variables: Use
.envfiles for configuration (add to.gitignore) - Secrets: Never commit passwords or API keys
- Testing: Add tests to
api/tests/andui/src/__tests__/ - Linting: Configure ESLint for UI and pylint/black for API
- Type Safety: Use TypeScript for UI and type hints for Python
- Documentation: Keep API documentation updated (FastAPI auto-generates
docs at
/docs)
For production, update docker-compose.yml:
- Use secrets for passwords
- Add resource limits
- Configure proper networking
- Use production-grade PostgreSQL settings
Generate Kubernetes manifests from Docker Compose:
kompose convert -f docker-compose.ymlCreate environment-specific files:
.env.development.env.staging.env.production
This bootstrap script generates MIT-licensed starter code. Customize as needed for your project.
For issues or questions:
- Check this guide
- Review generated files
- Open an issue on GitHub: https://github.com/Algodons/algo
master.sh version 1.0.0