A full-stack Local Store web application built with Django (REST API backend) and React (frontend). This repository contains both the backend API and the frontend single-page application used for development and testing.
- Python 3.8+ and pip
- Node.js 14+ and npm
- PostgreSQL (for production or if you want to run with the project's DB settings)
- Git (to clone the repository)
- backend/getit_be — Django backend project (apps:
account,product) - frontend/getit_fe — React frontend (Create React App)
-
Open a terminal and change to the backend project folder:
cd backend\getit_be
-
Create a virtual environment and activate it (Windows example):
python -m venv venv venv\\Scripts\\activate
-
Install Python dependencies:
pip install -r requirements.txt
-
Environment variables
The Django settings use environment variables read by python-decouple. Create a
.envfile insidebackend/getit_be(same folder asmanage.py) with at least:SECRET_KEY=your-secret-key DBPASS=your-db-passwordNotes:
- The project settings currently point to a PostgreSQL database by default. For local development you can either set
DBPASSfor your DB credentials and ensure the other DB fields match, or modifyDATABASESingetit_be/settings.pyto use SQLite for quick local testing.
- The project settings currently point to a PostgreSQL database by default. For local development you can either set
-
Run database migrations and create a superuser:
python manage.py migrate python manage.py createsuperuser
-
Start the Django development server:
python manage.py runserver
The API will be available at http://127.0.0.1:8000/ by default.
-
Open a terminal and change to the frontend folder:
cd frontend\getit_fe
-
Install Node dependencies:
npm install
-
Start the development server:
npm start
The React app runs on http://localhost:3000 and is configured (CORS) to communicate with the backend at http://127.0.0.1:8000.
- Custom user model: The backend uses a custom user model
account.Account(seebackend/getit_be/account/models.py). - Authentication: The backend uses Knox token authentication. The REST framework authentication classes are configured in settings.
- CORS:
CORS_ALLOWED_ORIGINSincludeshttp://localhost:3000so the frontend can talk to the backend in development. - Media files: Uploaded media is stored under the
media/directory in the backend project root. EnsureMEDIA_ROOTandMEDIA_URLare configured appropriately when deploying.
-
Backend: Add and run Django tests with:
cd backend\getit_be python manage.py test
-
Frontend: Use the React test runner:
cd frontend\getit_fe npm test
- For production, set
DEBUG=False, configureALLOWED_HOSTSand a production-ready database. Serve static files with a web server (e.g., nginx) and use a WSGI/ASGI server (e.g., gunicorn, daphne). - Keep secret values out of version control. Use environment variables or a secrets manager.
- Feel free to open issues or submit pull requests. Include a clear description of the change, and run existing tests before submitting.
- Backend:
backend/getit_be/account/,backend/getit_be/product/,backend/getit_be/getit_be/(settings and URLs). - Frontend:
frontend/getit_fe/src/components/,frontend/getit_fe/src/containers/.