Development Setup
Set up your development environment for contributing to Duckling.
Prerequisites
- Python 3.10+
- Node.js 18+
- Git
Backend Setup
cd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
Frontend Setup
Running Development Servers
Backend
Backend runs at: http://localhost:5001
Frontend
Frontend runs at: http://localhost:3000
Project Structure
duckling/
βββ backend/
β βββ duckling.py # Flask application entry
β βββ config.py # Configuration
β βββ models/ # Database models
β βββ routes/ # API endpoints
β βββ services/ # Business logic
β βββ tests/ # Backend tests
βββ frontend/
β βββ src/
β β βββ components/ # React components
β β βββ hooks/ # Custom React hooks
β β βββ services/ # API client
β β βββ types/ # TypeScript types
β βββ tests/ # Frontend tests
βββ docs/ # Documentation
IDE Setup
VS Code
Recommended extensions:
- Python
- Pylance
- ESLint
- Prettier
- Tailwind CSS IntelliSense
Settings
.vscode/settings.json:
{
"python.defaultInterpreterPath": "./backend/venv/bin/python",
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
Environment Variables
Create .env files for local development:
Backend (.env)
Frontend (.env.local)
Hot Reloading
Both servers support hot reloading:
- Backend: Flask debug mode auto-reloads on file changes
- Frontend: Vite HMR updates components without page refresh
Debugging
Backend (VS Code)
.vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "duckling.py",
"FLASK_DEBUG": "1"
},
"args": ["run", "--port", "5001"],
"jinja": true,
"cwd": "${workspaceFolder}/backend"
}
]
}
Frontend
Use browser DevTools with React Developer Tools extension.