Type-safe Django REST API for managing exotic plants, built with Django 5.2, Django REST Framework, and full mypy type checking.
View Live Demo → View Live API →
# Activate virtual environment
source .venv/bin/activate
# Run development server
python manage.py runserver
# Or use Makefile
make dev
Visit:
# Development
make dev # Run server
make test # Run tests
make type-check # Check types (catches errors!)
make format # Auto-format code
make check # Format, type-check, and test
# Or manually
source .venv/bin/activate
python manage.py runserver
pytest
mypy plants config
black .
isort .
GET /api/plants/ - List all plantsPOST /api/plants/ - Create plantGET /api/plants/{id}/ - Get specific plantPUT /api/plants/{id}/ - Update plantDELETE /api/plants/{id}/ - Delete plantGET /api/plants/in_stock/ - Get in-stock plants# List plants
curl http://localhost:8000/api/plants/
# Create plant
curl -X POST http://localhost:8000/api/plants/ \
-H "Content-Type: application/json" \
-d '{
"name": "Monstera Deliciosa",
"scientific_name": "Monstera deliciosa",
"price": "29.99",
"in_stock": true,
"description": "Beautiful tropical plant"
}'
# Get in-stock plants
curl http://localhost:8000/api/plants/in_stock/
This project uses mypy for type checking. Run make type-check before committing to catch errors!
.
├── config/ # Django settings
├── plants/ # Plants app
│ ├── models.py # Plant model
│ ├── serializers.py # API serializers
│ ├── views.py # API views
│ ├── tests.py # Tests
│ └── admin.py # Admin interface
├── .env # Environment variables
├── pyproject.toml # Project config
├── pytest.ini # Test config
├── mypy.ini # Type checking config
└── Makefile # Dev commands
| TypeScript Concept | Django Equivalent |
|---|---|
| Prisma/Drizzle | Django ORM |
| TypeScript | Python + mypy |
| Express routes | Django URLs + Views |
| Zod validation | Serializers |
| npm/package.json | uv/pyproject.toml |
| npm test | pytest |
| tsc | mypy |
| prettier | black + isort |
python manage.py createsuperuser