Core Concepts
Folder Structure of Next-DRF
The Next-DRF framework comes with a well-organized folder structure that helps developers maintain clear separation between the frontend and backend components. Understanding the folder structure is essential for efficient development and deployment. Below is an overview of the generated folder structure when you create a new Next-DRF project.
Project Structure Overview
my-next-drf-project/
├── next-frontend/ # Next.js frontend application
├── drf-backend/ # Django Rest Framework backend
├── auth/ # Prebuilt authentication services
├── scripts/ # CLI automation scripts
└── README.md # Project documentation
1. next-frontend/
This folder contains all the files related to the Next.js frontend application. It includes the following subfolders and files:
- pages/: The core folder for defining routes and pages for the frontend. Each file in this folder represents a page in the application.
- components/: Reusable React components used across multiple pages.
- styles/: CSS and Tailwind CSS files used for styling the frontend.
- public/: Static files such as images, icons, and fonts.
- package.json: Defines the dependencies and scripts for the frontend application.
2. drf-backend/
The drf-backend folder contains the Django Rest Framework backend, which handles the API and server-side logic. It includes:
- apps/: Custom Django apps that provide different functionalities within the backend.
- models/: Defines the data models used in the application.
- serializers/: Converts complex data types, like querysets and model instances, into native data types for rendering as JSON.
- views/: Defines the logic for handling API requests and responses.
- urls.py: Maps URLs to the appropriate views.
- settings.py: Configuration settings for the Django project, including database and authentication settings.
- manage.py: A command-line utility for interacting with the Django project.
3. auth/
The auth/ folder includes prebuilt authentication services compatible with different platforms. It helps developers easily integrate user authentication into their project. It contains:
- auth0_service.py: Handles authentication using Auth0.
- cognito_service.py: Manages user authentication via AWS Cognito.
- firebase_service.py: Provides Firebase authentication integration.
- custom_jwt_service.py: Implements custom JWT-based authentication.
- okta_service.py: Manages user authentication with Okta.
4. scripts/
The scripts/ folder contains CLI automation scripts that make routine tasks simpler. These scripts are useful for:
- Installing Dependencies: Automate the installation of both backend and frontend dependencies.
- Creating Django Apps: Scaffold new Django apps quickly.
- Running Build Commands: Build the frontend or backend for production.
5. README.md
The README.md file provides documentation for getting started with the project, including installation steps, setup guides, and instructions for development and deployment. It serves as an entry point for developers new to the project.
Summary
The folder structure of Next-DRF is designed to maintain a clear separation between the frontend and backend, while also providing built-in authentication and automation tools. By following this structure, developers can work efficiently and maintain scalability as their application grows. Understanding each folder's purpose helps in navigating the project and contributes to a more streamlined development experience.
Use this organized folder structure to start building robust and scalable full-stack applications with Next-DRF!