You can set up the project in one of two ways:
- All dependencies (Python, DuckDB, VS Code, Docker) work on Windows 11.
- Use Command Prompt, PowerShell, or Git Bash for commands.
- To activate the virtual environment, use:
.venv\Scripts\activate
- For shell scripts (
setup.sh,docker-setup.sh), use Git Bash, WSL, or run commands manually as listed below. - All VS Code extensions are supported on Windows.
- Python 3.12+
- VS Code
- Recommended VS Code extensions (see
.vscode/extensions.txt)
- Clone the repository
git clone https://github.com/chsanjeev/example-fastapi.git cd example-fastapi - Create and activate a virtual environment
python -m venv .venv # On macOS/Linux: source .venv/bin/activate # On Windows (Command Prompt): .venv\Scripts\activate # On Windows (PowerShell): .venv\Scripts\Activate.ps1
- Install Python dependencies
pip install -r requirements.txt
- Install VS Code extensions
while read ext; do code --install-extension "$ext"; done < .vscode/extensions.txt
- Initial database setup
- DuckDB is file-based; no manual setup required. The app will create
data.dbautomatically.
- DuckDB is file-based; no manual setup required. The app will create
- Run the application
uvicorn app.main:app --reload
- Run tests
pytest
- Format and lint code
black . isort . flake8
- Automation script
Run the following script to automate steps 2–5:
- On macOS/Linux:
bash bash setup.sh- On Windows (Git Bash/WSL):bash bash setup.sh- On Windows (Command Prompt/PowerShell): Run the commands in steps 2–5 manually, or use Git Bash/WSL for the script.
- Docker Desktop for Windows is supported.
- Use Command Prompt, PowerShell, or Git Bash for commands.
- Docker installed
- Build and run the app in Docker:
- On macOS/Linux:
bash bash docker-setup.sh- On Windows (Git Bash/WSL):bash bash docker-setup.sh- On Windows (Command Prompt/PowerShell): Run the commands indocker-setup.shmanually, or use Git Bash/WSL for the script. This will build the Docker image and start the app in a container on port 8000. - (Optional) Run tests inside the container:
docker exec -it example-fastapi pytest