I made this project template to make it easy to quickly bootstrap a full stack application following modern practices 🚀.
cookiecutter gh:sicksid/django-nextjs-boilerplate
- Full stack development with Django and Next.js 💻
- Authentication with next-auth.js and Django REST framework simplejwt 🔒
- Docker-compose for easy setup and deployment 🐳
- Automatic API documentation generation with a
/docs
endpoint and exportable/schema
file 📜 - openapi 3 typesafe generated axios client in
./client
by running the commandnpm run generate-client
📦 - Easy management with the
task
command (see available tasks by runningtask --list
after installing task) 🛠 - Use .env files for local development 💼
- Github Actions workflows for CI/CD 🔧
The project is structured with two separate directories for the frontend and backend 📂. The backend, which is built using Django REST framework 🐍, is located in the ./backend
directory 💻, where you can find the api, settings, shared, urls and wsgi files. The frontend, which is built using Next.js 🚀, is located in the ./frontend
directory 💻, where you can find the pages, styles, and server files.
For a more detailed view of the project structure 📜, you can run the command tree -L 3 -I 'node_modules|.venv|client|__pycache__'
🌳.
Additionally, the project includes:
pyproject.toml
in./backend
for managing python dependencies using pdm 🐍package.json
in./frontend
for managing frontend dependencies using npm 📦Taskfile.yml
for easy task running using task 🛠docker-compose.yml
that contains the necessary configurations to run the project with Docker 🐳
- Docker and Docker Compose 🐳
- Node.js and npm (optional) 🚀
- Python 3.11 and pdm (optional) 🐍
Note: If you don't want to use Docker, you can install the dependencies manually and run the project locally. See the Dockerfile
and docker-compose.yml
for more details.
Optionally install asdf to run asdf install
and get python and node.js automatically installed 🛠️
- Clone the repository:
git clone https://github.com/sicksid/django-nextjs-project-template.git
- Rename the project with your desired name:
mv django-nextjs-project-template yourprojectname
andcd yourprojectname
- Build and start the containers:
docker-compose up --build
- The application should now be running at
http://localhost:3000
for the frontend andhttp://localhost:8080
for the backend 🎉
- Clone the repository:
git clone https://github.com/sicksid/django-nextjs-project-template.git
- Rename the project with your desired name:
mv django-nextjs-project-template yourprojectname
andcd yourprojectname
- Start the database in the background:
docker-compose up -d database
- Install the python dependencies:
cd backend && pdm install
- Install the frontend dependencies:
cd frontend && npm install
- Run the frontend:
cd frontend && npm run dev
- Run the backend:
cd backend && python manage.py runserver
- The application should now be running at
http://localhost:3000
for the frontend andhttp://localhost:8000
for the backend 🎉