Code Monkey home page Code Monkey logo

django-nextjs-boilerplate's Introduction

Django and Next.js Boilerplate

I made this project template to make it easy to quickly bootstrap a full stack application following modern practices ๐Ÿš€.

Install with cookiecutter ๐Ÿช

cookiecutter gh:sicksid/django-nextjs-boilerplate

Features

  • 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 command npm run generate-client ๐Ÿ“ฆ
  • Easy management with the task command (see available tasks by running task --list after installing task) ๐Ÿ› 
  • Use .env files for local development ๐Ÿ’ผ
  • Github Actions workflows for CI/CD ๐Ÿ”ง

Project Structure

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 ๐Ÿณ

Requirements

  • 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 ๐Ÿ› ๏ธ

Getting Started ๐Ÿš€

Setup with Docker ๐Ÿ‹

  1. Clone the repository: git clone https://github.com/sicksid/django-nextjs-project-template.git
  2. Rename the project with your desired name: mv django-nextjs-project-template yourprojectname and cd yourprojectname
  3. Build and start the containers: docker-compose up --build
  4. The application should now be running at http://localhost:3000 for the frontend and http://localhost:8080 for the backend ๐ŸŽ‰

Setup locally ๐Ÿ–ฅ๏ธ

  1. Clone the repository: git clone https://github.com/sicksid/django-nextjs-project-template.git
  2. Rename the project with your desired name: mv django-nextjs-project-template yourprojectname and cd yourprojectname
  3. Start the database in the background: docker-compose up -d database
  4. Install the python dependencies: cd backend && pdm install
  5. Install the frontend dependencies: cd frontend && npm install
  6. Run the frontend: cd frontend && npm run dev
  7. Run the backend: cd backend && python manage.py runserver
  8. The application should now be running at http://localhost:3000 for the frontend and http://localhost:8000 for the backend ๐ŸŽ‰

django-nextjs-boilerplate's People

Contributors

abdul-hamid-achik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.