How annibadakh/notes_taking_frontend works
Project Type & Purpose
• This is a full-stack web application:
– Frontend: React single-page app (Vite, Tailwind CSS)
– Backend: Node.js + Express API server
– Database: MySQL via Sequelize ORM
– External services: Google OAuth, email (Nodemailer)
• Purpose: user-authenticated note creation, editing, organizing with rich-text, auto-save, pin/archive, pagination.
File Structure (Frontend)
• Top-level files:
– index.html, vite.config.js: build & serve frontend
– src/main.jsx: React app bootstrap
– src/Api.jsx: centralized HTTP client for API calls
– src/Context/AuthContext.jsx: global auth state, JWT storage
– src/ProtectedRoute.jsx: route guard for private pages
• Pages folder: HomePage, Login, Signup, Dashboard, NoteEditor, NoteViewer
• Utils: toast notifications
• Public: static assets & redirect rules
README for Backend & Architecture Insights
• Backend repo (separate) provides:
– Express.js REST endpoints for auth & note CRUD
– JWT issuance & verification middleware
– Bcrypt hashing, Sequelize models, MySQL schema
– Nodemailer for email OTP delivery
– Google OAuth endpoints
Main Components & Interactions
a. Client Layer (Browser / Mobile)
– React SPA hosted on Netlify (or similar)
– Sends HTTP/HTTPS requests to API (JWT in headers)
b. CDN / Static Hosting
– Serves index.html, JavaScript bundles, CSS, assets
c. Frontend Application
– UI Components (Pages, Editor, Dashboard)
– AuthContext for user state & token
– Api.jsx handles fetch/axios calls
d. Backend API Server
– Express.js routes: /auth (login/signup/otp), /notes (CRUD)
– Middleware: JWT verification, input validation
– OAuth controller for Google sign-in
– Email controller for OTP via Nodemailer
e. Database Layer
– MySQL database (notes_app)
– Sequelize models: User, Note, OTP, etc.
f. External Services
– Google OAuth provider
– SMTP/email service for OTP
g. Developer Tools / CI/CD (optional)
– GitHub for code, CI pipelines, Heroku/DigitalOcean for backend, Netlify/Vercel for frontend
Relationships & Data Flows
• User → Frontend: browser loads JS, user interacts
• Frontend → API:
– Auth flows: signup/login → receive JWT
– Note CRUD: include JWT in Authorization header
• API → Database: Sequelize queries for user & note data
• API → External Services:
– Google OAuth token exchange & profile fetch
– Nodemailer SMTP requests for OTP emails
• Database → API → Frontend: data responses as JSON
Architectural Patterns & Design Principles
• Single-Page Application (SPA) architecture on frontend
• Context API for global state (AuthContext)
• Protected routes for access control
• RESTful API on backend with stateless JWT auth
• Layered architecture: Presentation → Business → Data
• ORM abstraction (Sequelize) for database interactions
• Externalize configuration via environment variables