How 1pt-co/1pt works
Main Components
• Frontend Application: A React-based SPA residing in the “src” and “public” directories. This includes the App.js, several pages (Dashboard, Home, 404, Redirect), components (Header, InfoRow, LongURL, etc.), and styling files.
• Backend API: Although the backend isn’t part of this repository, its existence is crucial. It is a PHP-based API hosted externally (endpoint provided in the README) that accepts URL creation requests (e.g., via /addURL) and manages the data.
• MySQL Database: The README informs us that the backend stores redirects in a MySQL database. Although external, it’s an essential system component.
• Optional: Although not directly in the source, the info.1pt.co service (which prepares metadata previews) is an extension to this architecture.
Relationships and Interactions
• Users open a browser and load the React application from the public/index.html.
• The React app (frontend) provides multiple pages. For instance, the Home page for entering long URLs, a Redirect page that handles the redirection logic, and an Info or Dashboard page that displays metadata.
• The API, in turn, interacts with the MySQL database to store and retrieve URL mapping information.
• Once the API responds with the short URL, the frontend processes and presents the information back to the user.
• There is an optional flow for metadata preview using a special “info” prepended URL, which is a derivation of the shortened URL leading to additional information before redirection.
Relevant Technologies/Frameworks
• React: Mentioned by the presence of “src/App.js”, “src/index.js”, and components.
• CSS/SCSS: Files in “src/styles” and CSS modules in components.
• PHP API: Referenced in the README as the backend technology.
• MySQL: Used for storing URL redirects.
• Additional: The project uses package management (package.json/package-lock.json) indicating Node.js/JavaScript tooling for the frontend.
Essential Elements
– React Frontend (with subdivisions if needed to indicate pages, components, static assets)
– PHP Backend API
– MySQL Database
– User’s Web Browser (client)
– User interactions from the Browser to the React Application.
– API requests from the React Application to the PHP API.
– Data flow between the PHP API and MySQL Database.
• Notes or legends indicating key HTTP methods (like POST /addURL) and data exchanges.