How cs340-25/notex works
Project type and purpose
• Notex is a desktop note-taking application built with Electron (to package a web app as a desktop app), a React/Vite frontend, and a Python/Flask backend.
• It provides CRUD operations on notes and user data via REST endpoints, persisting data in a local database (likely SQLite) through the Backend/db_connection module.
Main system components
A. Electron shell
• Files: Electron/main.js, Electron/preload.js, Electron/forge.config.js
• Role: Hosts the React frontend in a Chromium window, bridges renderer→main via the preload script, and bundles everything for distribution.
B. Frontend (React + Vite)
• Top-level: Frontend/index.html, Frontend/src/main.jsx, Frontend/vite.config.js
• UI layers:
• Pages (Frontend/src/pages/...)
• Reusable components (Frontend/src/components/...)
• Context Providers (Frontend/src/Providers/...)
• API wrappers (Frontend/src/api/DataApi.jsx, UserApi.jsx)
• Build system: Vite (package.json scripts, npm run dev)
C. Backend API (Flask)
• Entry point: Backend/app.py
• Route modules: Backend/routes/data_routes.py, user_routes.py
• DB access layer: Backend/db_connection/connection.py, and CRUD helpers (read.py, insert.py, etc.)
D. Database
• Likely an on-disk SQLite file managed by db_connection/connection.py and utilities.
Relationships & data flows
• User interacts with UI in Electron’s renderer process.
• React components call DataApi / UserApi → send HTTP requests to http://localhost:5000/api/....
• Flask app receives requests in app.py, dispatches to route handlers in routes/, which call into db_connection for CRUD.
• db_connection modules open a connection, execute SQL, return results.
• Responses travel back over HTTP to the React app.
Architectural patterns & design principles
• Layered architecture: Presentation (React), API (Flask routes), Data Access (db_connection).
• MVC-like separation in the backend (routes vs. data layer).
• React uses Provider pattern (AuthContext, ThemeProvider, WorkspaceProvider).
• Electron uses a main/renderer split with a preload bridge for secure IPC if needed.