Skip to content

A starter template with Django and Next.js. Provides Postgres, Redis, and Celery out of the box.

License

Notifications You must be signed in to change notification settings

marknotfound/django-nextjs-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Next.js Starter

This project provides a quickstart to develop a project with a Next.js frontend served by a Django backend. Out of the box, it includes:

  • Next.js 13.4 + TypeScript app created with npx create-next-app
  • Django 4.2 project created with django-admin startproject
    • Preconfigured with
      • Postgres
      • Redis
      • Celery

The Django and Next.js projects are located in the backend and client directories respectively. See backend/README.md and client/README.md for more information about how to configure them.

Django will run at http://localhost:8000 and Next.js will run at http://localhost:3000.

Environment Variables

Both Django and Next.js make use of environment variables. There is a .env.dist file in both the backend and client directories. You must copy this file into the relevant environment files:

cp backend/.env.dist backend/.env
cp client/.env.dist client/.env.local

Docker

docker-compose.yml defines all of the backend services. You may comment out or remove services which aren't needed. It is preconfigured with Postgres, Redis, and Celery which is a fairly standard Django stack.

The backend/Dockerfile is used for the backend and celery services. It is, in my opinion, suitable for production use, but open a pull request if something looks off.

Deploying

This repo is generally unopinionated on deploying. I unofficially recommend Vercel for Next.js and Railway for Django. Both support monorepos such as this by allowing you to specify a root directory. Ultimately it is up to you how you want to deploy. The backend uses DATABASE_URL and REDIS_URL environment variables which are commonly used in PaaS offerings.

About

A starter template with Django and Next.js. Provides Postgres, Redis, and Celery out of the box.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published