How samanba81/note_django works
Project type and purpose
• This is a monolithic, full‐stack web server built with Django. It serves two kinds of front ends:
• A REST API (“apis” app) consumed by an external Flutter mobile client (note_flutter).
• A traditional server‐rendered web UI (“view” app) for end users, plus the built‐in Django admin.
• Purpose: allow users to create, read, update, and delete notes via either the mobile client or a browser interface, and give administrators control over users/notes.
File structure
• Top‐level Django project called “Notes” (contains settings, URLs, WSGI/ASGI).
• Two Django apps:
• apis/ – models.py, serializers.py, views.py, URLs, migrations, tests. Exposes REST endpoints.
• view/ – models.py, views.py, URLs, templates/, static/ (CSS/JS), tests. Renders HTML for user login, registration, note listing/editing.
• Configuration: manage.py, db.sqlite3. No Docker or CI files yet.
Key insights from README
• Version 1.0 server for note_flutter.
• Provides both API and web view (HTML/CSS/JS).
• Admin interface via Django admin.
• Uses cookies/sessions for the web UI.
Main components and their interactions
a. Clients
• Flutter mobile app: issues HTTP(S) requests to /api/... endpoints.
• Web browser: issues HTTP(S) requests to / (login/register), /notes, etc., receives HTML/CSS/JS, uses cookies for session state.
• Admin user: uses Django admin at /admin.
b. Server (Django monolith)
• URL router in Notes/urls.py directs “/api/” to apis/urls.py and other paths to view/urls.py or admin.
• apis app: handles JSON requests, uses DRF serializers, updates models in db.sqlite3.
• view app: renders templates (master.html, notes.html, login/register), serves static assets (forms.css, forms.js), and handles form submissions.
c. Database
• SQLite (db.sqlite3) stores User, Note, NoteColor, and any other models.
d. Optional external services
• (Future) password‐reset email service or cloud DB, but none configured now.
Architectural patterns and design principles
• Django’s MVT (Model‐View‐Template) pattern: models in each app, views (controllers) handling request logic, and templates for HTML.
• Separation of concerns:
• REST API layer (apis app) for programmatic clients.
• Server‐rendered UI layer (view app) for browser users.
• Single database for both layers.
• Session management for web UI via cookies.
• Admin interface auto‐generated by Django admin for management.