This project is a full-stack web application that consists of a Next.js frontend and a Django backend. The frontend provides a user interface for interacting with the backend, which offers various APIs and handles business logic. Docker and Docker Compose are used to manage the development environment, ensuring that both services run consistently across different environments.
project-root/
│
├── backend/
│ ├── Dockerfile
│ ├── backend/ # Your Django project
│ ├── manage.py
│ └── ... # Other backend files and directories
│
├── frontend/
│ ├── Dockerfile
│ ├── next.config.js
│ ├── src/
│ ├── public/
│ ├── package.json
│ └── ... # Other frontend files and directories
│
├── compose.yml
└── README.md
git clone <repository-url>
cd project-rootCreate a .env file in the root directory of the project and define the necessary environment variables for both frontend and backend.
Example for Django backend:
DJANGO_SECRET_KEY=your_secret_key
DATABASE_URL=postgres://user:password@db:5432/dbname
Example for Next.js frontend:
NEXT_PUBLIC_API_URL=http://localhost:8000
To build and run the containers for both frontend and backend, execute the following command:
docker-compose -f compose.yaml up --buildThis command will:
- Build the Docker images for both the frontend and backend.
- Start the containers and set up the necessary services.
- Frontend: http://localhost:3000
- Backend: http://localhost:8000
To start the Next.js development server with hot-reloading:
cd frontend
npm install
npm run devTo start the Django development server:
cd backend
pip install -r requirements/local.txt
python manage.py runserverTo run the frontend tests:
cd frontend
npm testTo run the backend tests:
cd backend
python manage.py test- Fork the repository
- Create your feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/your-feature) - Open a pull request
This project is licensed under the MIT License - see the LICENSE file for details.