A modern full-stack web application boilerplate with Django REST Framework backend and React frontend.
- Django 4.2+ with REST Framework
- CORS headers configured for React
- Sample CRUD API with Items model
- Admin panel setup
- Environment variable configuration
- PostgreSQL ready (SQLite by default)
- React 18 with Hooks
- React Router for navigation
- Axios for API calls
- Sample CRUD operations
- Responsive design
- Modern UI components
- Python 3.8+
- Node.js 14+
- npm or yarn
-
Create and activate virtual environment:
python -m venv venv # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables:
cp .env.example .env # Edit .env file with your settings -
Run migrations:
python manage.py makemigrations python manage.py migrate
-
Create superuser (optional):
python manage.py createsuperuser
-
Start the development server:
python manage.py runserver
The API will be available at
http://localhost:8000/api/
-
Navigate to frontend directory:
cd frontend -
Install dependencies:
npm install
-
Configure environment variables:
cp .env.example .env # Edit .env if needed (default points to localhost:8000) -
Start the development server:
npm start
The React app will open at
http://localhost:3000/
GET /api/health/- Health check endpointGET /api/items/- List all itemsPOST /api/items/- Create a new itemGET /api/items/{id}/- Get a specific itemPUT /api/items/{id}/- Update an itemDELETE /api/items/{id}/- Delete an item
- Start the Django backend server (port 8000)
- Start the React frontend server (port 3000)
- React will proxy API requests to Django automatically
- Make changes and see them hot-reload
python manage.py testcd frontend
npm testpython manage.py collectstatic
# Configure your production server (Gunicorn, nginx, etc.)cd frontend
npm run buildThe optimized production build will be in frontend/build/
- Environment Variables: Use environment variables for sensitive data
- Database: Switch to PostgreSQL for production
- Static Files: Configure proper static file serving
- CORS: Update CORS settings for your production domain
- Security: Set
DEBUG=Falseand configureALLOWED_HOSTS
- Make sure Django CORS settings include your React development server
- Check that the proxy setting in
package.jsonis correct
- Verify Django server is running on port 8000
- Check that API_URL in React .env matches your backend
- Run migrations:
python manage.py migrate - Check database configuration in settings.py
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - feel free to use this boilerplate for your projects!