A professional-grade REST API built with Django REST Framework for managing products and users with full CRUD operations.
- Products Management: Complete CRUD operations for products
- Users Management: Complete CRUD operations for users
- SQLite Database: Lightweight development database (PostgreSQL ready)
- API Documentation: Auto-generated Swagger/OpenAPI docs
- CORS Support: Cross-origin resource sharing enabled
- Admin Interface: Django admin for easy data management
- Backend: Django REST Framework
- Database: SQLite (Development) / PostgreSQL (Production)
- Documentation: Swagger (OpenAPI)
- Deployment: Railway/Render ready
- Python 3.8+
- pip
- Clone the repository
git clone https://github.com/ADCarthan88/REST_API_CRUD.git
cd REST_API_CRUD- Create virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # macOS/Linux- Install dependencies
python -m pip install -r requirements.txt- Setup database
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser- Run the server
python manage.py runserverGET /api/products/- List all productsPOST /api/products/- Create new productGET /api/products/{id}/- Get specific productPUT /api/products/{id}/- Update productDELETE /api/products/{id}/- Delete product
GET /api/users/- List all usersPOST /api/users/- Create new userGET /api/users/{id}/- Get specific userPUT /api/users/{id}/- Update userDELETE /api/users/{id}/- Delete user
- Swagger UI: http://localhost:8000/swagger/
- ReDoc: http://localhost:8000/redoc/
- Admin Panel: http://localhost:8000/admin/
POST http://localhost:8000/api/products/
Content-Type: application/json
{
"name": "Sample Product",
"description": "A sample product description",
"price": "29.99",
"stock": 100
}POST http://localhost:8000/api/users/
Content-Type: application/json
{
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"phone": "123-456-7890"
}REST_API_CRUD/
├── my_cutsom_api/ # Main Django project
│ ├── settings.py # Django settings
│ ├── urls.py # URL routing
│ └── wsgi.py # WSGI config
├── products/ # Products app
│ ├── models.py # Product model
│ ├── serializers.py # API serializers
│ ├── views.py # API views
│ └── urls.py # Product URLs
├── users/ # Users app
│ ├── models.py # User model
│ ├── serializers.py # API serializers
│ ├── views.py # API views
│ └── urls.py # User URLs
├── requirements.txt # Dependencies
├── manage.py # Django management
└── README.md # This file
- Connect your GitHub repository
- Add environment variables
- Deploy automatically
- Create new Web Service
- Connect repository
- Add environment variables
- Deploy
SECRET_KEY=your-production-secret-key
DEBUG=False
DB_NAME=your_db_name
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=your_db_host
DB_PORT=5432- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Adam Carthan
- GitHub: @ADCarthan88
- Django REST Framework team
- Django community
- All contributors
⭐ Star this repo if you find it helpful!