How mohdzain98/curlmin works
Project type and purpose
• Curlmin is a full-stack web application for URL shortening, QR/barcode generation, and “curltags.”
• The frontend is a React single-page app (in src/ and build/), and the backend is a Node.js/Express API (in backend/). It persists data in a MySQL database.
File structure
• Top-level:
• public/ & src/: React app sources and static files
• build/: React production build output
• backend/: Express server, routes, models, middleware, custom event emitter
• sitemap-generator.js: build-time script for sitemap.xml
• CI/CD: .github/workflows/main.yml for both root and backend
• Patterns:
• MVC-style backend—models/ for Sequelize or custom ORM wrappers, routes/ for controllers, middleware/ for request interceptors
• EventEmitter-based logic (backend/eventEmitter.js)
• Separation of concerns: mysql.js & db.js abstracts database connection; functions/ houses core utilities
• React Context API for global state (src/Context)
README for additional insights
• Confirms core features: URL shortening, QR/barcode, curltags
a. Main components to include
• User Device (Browser/Mobile)
• Frontend (React SPA)
• Backend API (Express Server)
• MySQL Database
• External Services:
– Email service (SMTP) for mail routes
– Optional storage service for background images (if used by curltags)
– CI/CD pipelines (GitHub Actions)
b. Relationships & interactions
• User ↔ Frontend via HTTPS (React UI in browser)
• Frontend ↔ Backend via RESTful API calls (endpoints in backend/routes)
• Backend ↔ MySQL DB for CRUD on URL, User, Count models
• Backend ↔ Email service for verification, password reset
• sitemap-generator.js runs at build time to update sitemap.xml used by search engines
c. Architectural patterns & principles
• MVC separation in backend
• Event-driven logic for asynchronous tasks (eventEmitter.js)
• React component hierarchy and Context API for state management
• CI/CD with GitHub Actions for automated tests and deployments
d. Key technologies & frameworks
• Frontend: React, React Router, Context API, JSX, CSS modules
• Backend: Node.js, Express.js, MySQL, custom event emitter
• Build Tools: Webpack (via create-react-app), npm scripts
• DevOps: GitHub Actions, VSCode launch configs, sitemap-generator
Detailed capturing of essential elements
• Sequence of a URL-shortening request:
1. UI submits long URL → POST /core
2. API generates short code → stores in Url model
3. API returns short URL → UI renders and offers QR/barcode
• Redirect flow:
1. User clicks short URL → API route /:code
2. API increments Urlcount → eventEmitter triggers analytics function → redirects to original URL
• Context Providers in React (UserState, userContext) managing global user/session state