exotic-plants-django Svelte Themes

Exotic Plants Django

Python/Django/Fly.io backend with a Neon/PostgreSQL database and a Svelte/Vercel front-end

Exotic Plants Django API

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 →

Quick Start

# Activate virtual environment
source .venv/bin/activate

# Run development server
python manage.py runserver

# Or use Makefile
make dev

Visit:

Key Commands

# 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 .

API Endpoints

  • GET /api/plants/ - List all plants
  • POST /api/plants/ - Create plant
  • GET /api/plants/{id}/ - Get specific plant
  • PUT /api/plants/{id}/ - Update plant
  • DELETE /api/plants/{id}/ - Delete plant
  • GET /api/plants/in_stock/ - Get in-stock plants

Example API Usage

# 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/

Type Safety

This project uses mypy for type checking. Run make type-check before committing to catch errors!

Project Structure

.
├── 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

Django for TypeScript Developers

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

Next Steps

  1. Create superuser: python manage.py createsuperuser
  2. Add authentication
  3. Add more endpoints
  4. Deploy to production

Top categories

Loading Svelte Themes