Cursor Rules Templatescursor_rules_template

Cursor Rules Template for Django Bootcamp Management Platform

Cursor Rules Template for building a Django bootcamp management platform with cohorts, assignments, grading, attendance, and mentor feedback. Paste the .cursorrules block into your project root to guide Cursor AI in scaffolding and enforcing patterns.

.cursorrules templatecursor-rulescursor rules templatedjangobootcampcohortsassignmentsgradingattendancementor feedbackCursor AI rules

Target User

Developers building a Django-based bootcamp management platform

Use Cases

  • Scaffold Django apps for cohorts, assignments, grading, attendance, and mentor feedback
  • Define Django models and DRF serializers
  • Generate RESTful API endpoints with DRF ViewSets and Routers
  • Seed initial data for cohorts, assignments, and students
  • Enforce authentication, permissions, and security patterns in a Django stack

Markdown Template

Cursor Rules Template for Django Bootcamp Management Platform

# Cursor Rules for Django Bootcamp Management Platform
# Framework Role & Context
Framework: Django 4.x, DRF, PostgreSQL
Context: You are an AI software engineer guiding the development of a Django-based bootcamp management system with modules for cohorts, assignments, grading, attendance, and mentor feedback.

# Code Style and Style Guides
Style: Python (PEP8); Formatting: Black; Import Ordering: isort; DRF Serializers should be used for API responses; Follow DRF ViewSet conventions.

# Architecture & Directory Rules
ProjectRoot: bootcamp_platform
Apps: cohorts, assignments, grading, attendance, mentors, core
Structure: bootcamp_platform/ (settings, URLs, wsgi/asgi); apps/cohorts/, apps/assignments/, apps/grading/, apps/attendance/, apps/mentors/; tests/ for all apps

# Authentication & Security Rules
Auth: Django auth with DRF token/JWT where appropriate
Security: CSRF protection on APIViews with session-based clients; HTTPS in prod; use environment vars for secrets; restrict admin access; proper user roles

# Database and ORM patterns
ORM: Django ORM (PostgreSQL)
Models: Cohort, Student, Mentor, Assignment, Submission, Grade, AttendanceRecord, MentorFeedback
Constraints: Unique together on (cohort, student, assignment); ForeignKey with related_name; Use ManyToMany for students in cohorts; Index frequently queried fields

# Testing & Linting Workflows
Tests: pytest-django; coverage goals; factory_boy or fixtures for test data
Linting: Black, isort, flake8; CI runs tests and linting on PRs

# Prohibited Actions and Anti-patterns for the AI
Do not: Write raw SQL without necessity; bypass ORM; include credentials in code; hardcode secret keys; place business logic in views; expose admins with default configurations

Overview

The Cursor rules configuration provides a Django-focused, end-to-end blueprint for a bootcamp management platform. It covers cohorts, assignments, grading, attendance, and mentor feedback, with a strong emphasis on the Django stack (Django 4.x, DRF, PostgreSQL). The Cursor rules template delivers a copyable .cursorrules block and a recommended project structure you can paste into your repo root to initialize consistent patterns across teams.

Direct answer: paste the included .cursorrules block into your project root to guide Cursor AI in scaffolding Django apps for bootcamp management and to enforce secure, testable, and scalable code generation.

When to Use These Cursor Rules

  • At project kickoff to establish architecture and directory structure for a Django-based bootcamp management system.
  • During code generation for models, endpoints, and serializers for cohorts, assignments, grading, attendance, and mentor feedback modules.
  • To enforce security patterns (auth, permissions, token-based DRF auth) and production readiness (settings, environment vars, HTTPS).
  • In CI pipelines for automated tests (pytest-django) and linting (Black, isort, flake8) with Django integration.
  • When migrating from monolith to modular apps, ensuring clear boundaries and DRY patterns.

Copyable .cursorrules Configuration

# Cursor Rules for Django Bootcamp Management Platform
# Framework Role & Context
Framework: Django 4.x, DRF, PostgreSQL
Context: You are an AI software engineer guiding the development of a Django-based bootcamp management system with modules for cohorts, assignments, grading, attendance, and mentor feedback.

# Code Style and Style Guides
Style: Python (PEP8); Formatting: Black; Import Ordering: isort; DRF Serializers should be used for API responses; Follow DRF ViewSet conventions.

# Architecture & Directory Rules
ProjectRoot: bootcamp_platform
Apps: cohorts, assignments, grading, attendance, mentors, core
Structure: bootcamp_platform/ (settings, URLs, wsgi/asgi); apps/cohorts/, apps/assignments/, apps/grading/, apps/attendance/, apps/mentors/; tests/ for all apps

# Authentication & Security Rules
Auth: Django auth with DRF token/JWT where appropriate
Security: CSRF protection on APIViews with session-based clients; HTTPS in prod; use environment vars for secrets; restrict admin access; proper user roles

# Database and ORM patterns
ORM: Django ORM (PostgreSQL)
Models: Cohort, Student, Mentor, Assignment, Submission, Grade, AttendanceRecord, MentorFeedback
Constraints: Unique together on (cohort, student, assignment); ForeignKey with related_name; Use ManyToMany for students in cohorts; Index frequently queried fields

# Testing & Linting Workflows
Tests: pytest-django; coverage goals; factory_boy or fixtures for test data
Linting: Black, isort, flake8; CI runs tests and linting on PRs

# Prohibited Actions and Anti-patterns for the AI
Do not: Write raw SQL without necessity; bypass ORM; include credentials in code; hardcode secret keys; place business logic in views; expose admins with default configurations

Recommended Project Structure

bootcamp_platform/
├ manage.py
├ requirements.txt
├ bootcamp_platform/                 # Django project settings
│   ├ __init__.py
│   ├ settings.py
│   ├ urls.py
│   └ wsgi.py
├ apps/
│   ├ cohorts/
│   │   ├ __init__.py
│   │   ├ models.py
│   │   ├ serializers.py
│   │   ├ views.py
│   │   └ urls.py
│   ├ assignments/
│   │   ├ __init__.py
│   │   ├ models.py
│   │   ├ serializers.py
│   │   ├ views.py
│   │   └ urls.py
│   ├ grading/
│   │   ├ __init__.py
│   │   ├ models.py
│   │   ├ serializers.py
│   │   ├ views.py
│   │   └ urls.py
│   ├ attendance/
│   │   ├ __init__.py
│   │   ├ models.py
│   │   ├ serializers.py
│   │   ├ views.py
│   │   └ urls.py
│   └ mentors/
│       ├ __init__.py
│       ├ models.py
│       ├ serializers.py
│       ├ views.py
│       └ urls.py
├ tests/
│   └─ test_suite.py

Core Engineering Principles

  • Schema-first design: Model your data before scaffolding APIs and UI.
  • Modularity: Clear app boundaries for cohorts, assignments, grading, attendance, and mentor feedback.
  • Security by default: Strong authentication, permissions, and secret management.
  • Testability: Automated tests at unit, integration, and end-to-end levels.
  • API-first: DRF-based endpoints and well-defined serializers.
  • CI/CD readiness: Lint, test, and deploy with minimal manual steps.
  • Performance awareness: Efficient queries and sensible database indices.

Code Construction Rules

  • Define models for Cohort, Student, Mentor, Assignment, Submission, Grade, AttendanceRecord, MentorFeedback with explicit fields and constraints.
  • Use Django ORM for all data access; avoid raw SQL unless necessary, and document any use with comments.
  • Organize serializers and viewsets in their respective apps; use routers for endpoints and proper permissions.
  • Implement authentication using Django's auth system; enable DRF token/JWT for API clients; enforce per-object permissions where needed.
  • Maintain a clean separation of concerns between business logic, API layers, and data access.
  • Provide seeding data and migrations for cohorts, students, and initial assignments.

Security and Production Rules

  • Store secrets in environment variables; do not commit credentials.
  • Use HTTPS in production and restrict admin URLs; enable CSRF protection for non-API clients.
  • Apply strong password policies and rotate API tokens regularly.
  • Enable database-level permissions and use transactions where appropriate to maintain integrity.
  • Limit query sizes and apply pagination on list endpoints to prevent data leakage and DoS.

Testing Checklist

  • Unit tests for models and utilities; test validators and model constraints.
  • Integration tests for cohorts, assignments, grading, attendance, and mentor feedback interactions.
  • API tests for DRF endpoints with authentication and permissions.
  • Linting and formatting checks in CI; run pytest-django and Black/isort.
  • Migration tests to ensure schema integrity after changes.

Common Mistakes to Avoid

  • Coupling business logic to views or serializers; keep logic in models or services.
  • Over-optimizing without profiling; premature optimization can hinder maintainability.
  • Storing plain secrets in settings or fixtures; use environment-based configurations.
  • Neglecting authentication/authorization for internal APIs; always enforce permissions.
  • Growing a monolith without modular boundaries; otherwise refactor into apps early.

Related Cursor rules templates

Explore adjacent Cursor rules templates for similar stacks, workflows, and production constraints.

FAQ

What is this Cursor Rules Template for Django Bootcamp?

This template provides a ready-to-paste Cursor rules block and Django-aligned project structure for building a bootcamp management platform. It covers cohorts, assignments, grading, attendance, and mentor feedback using Django 4.x, DRF, and PostgreSQL, with security and testing baked in.

Which stack does this template target?

The template targets Django 4.x with Django REST Framework, PostgreSQL as the database, and standard Django authentication. It emphasizes modular apps for cohorts, assignments, grading, attendance, and mentor feedback, plus CI/test practices suitable for production deployments.

How do I integrate the Cursor Rules into my project?

Copy the provided .cursorrules block into your project root. It instructs Cursor AI to scaffold Django apps, models, serializers, and API endpoints, while enforcing security, testing, and production-ready patterns for bootcamp management.

Can I customize the models for cohorts, assignments, and grading?

Yes. The template defines clear model boundaries and relationships; you should extend or customize models in their respective apps while preserving the established relationships and constraints to maintain data integrity and consistency across modules.

What are the recommended testing and CI practices?

Use pytest-django for unit and integration tests, coupled with Black and isort for linting and formatting. Integrate tests and linting into CI (GitHub Actions, GitLab CI, etc.) to run on push and pull requests, ensuring a stable codebase.

What is the recommended project structure?

The template suggests a Django project with apps for cohorts, assignments, grading, attendance, and mentors, plus a core app for shared utilities. This structure supports modular development, easy testing, and clear separation of concerns.