{"id":24503947,"url":"https://github.com/ashifhassandev/snap-url-shortener-postgres","last_synced_at":"2025-04-14T06:43:11.211Z","repository":{"id":268841850,"uuid":"905619181","full_name":"ashifhassandev/snap-url-shortener-postgres","owner":"ashifhassandev","description":"𝐬𝐧𝐚𝐩𝐔𝐑𝐋! 𝐢𝐬 𝐚 𝐍𝐨𝐝𝐞.𝐣𝐬, 𝐄𝐱𝐩𝐫𝐞𝐬𝐬, 𝐚𝐧𝐝 𝐏𝐨𝐬𝐭𝐠𝐫𝐞𝐒𝐐𝐋-𝐛𝐚𝐬𝐞𝐝 𝐚𝐩𝐩 𝐭𝐡𝐚𝐭 𝐬𝐡𝐨𝐫𝐭𝐞𝐧𝐬 𝐥𝐨𝐧𝐠 𝐔𝐑𝐋𝐬 𝐟𝐨𝐫 𝐞𝐚𝐬𝐲 𝐬𝐡𝐚𝐫𝐢𝐧𝐠.","archived":false,"fork":false,"pushed_at":"2025-01-06T15:11:10.000Z","size":38,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T20:23:17.773Z","etag":null,"topics":["bootstrap5","css","ejs","expressjs","html5","javascript","nodejs","postgresql"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashifhassandev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-19T07:36:47.000Z","updated_at":"2025-01-19T09:25:49.000Z","dependencies_parsed_at":"2024-12-19T08:33:44.705Z","dependency_job_id":"2148714c-38d0-45c4-9263-c89d29e42f25","html_url":"https://github.com/ashifhassandev/snap-url-shortener-postgres","commit_stats":null,"previous_names":["ashif1996/snap-url-shortener-postgres","ashifhassandev/snap-url-shortener-postgres"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashifhassandev%2Fsnap-url-shortener-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashifhassandev%2Fsnap-url-shortener-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashifhassandev%2Fsnap-url-shortener-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashifhassandev%2Fsnap-url-shortener-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashifhassandev","download_url":"https://codeload.github.com/ashifhassandev/snap-url-shortener-postgres/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248837264,"owners_count":21169373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootstrap5","css","ejs","expressjs","html5","javascript","nodejs","postgresql"],"created_at":"2025-01-21T23:19:13.998Z","updated_at":"2025-04-14T06:43:11.167Z","avatar_url":"https://github.com/ashifhassandev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# snapURL! - URL Shortener Application  \n\n**snapURL!** is a simple, efficient, and fast URL shortener built with **Node.js**, **Express**, and **PostgreSQL**. It allows users to shorten long URLs for easier sharing and faster access. The platform provides an intuitive user interface and a backend powered by PostgreSQL to store and manage the shortened URLs.\n\n## 🚀 Features  \n\n- **URL Shortening**: Convert long URLs into short, easy-to-share links.  \n- **Easy Sharing**: Share shortened URLs through social media or messaging apps.    \n- **Error Handling**: Custom error pages for 404 and internal server errors.  \n\n## 🛠️ Tech Stack  \n\n### Backend  \n- **Node.js**: JavaScript runtime environment.  \n- **Express.js**: Web framework for handling routing and middleware.  \n- **PostgreSQL**: Relational database for storing URL data.  \n\n### Frontend  \n- **EJS**: Template engine for rendering dynamic HTML views.  \n- **CSS**: For styling the application (custom CSS files).  \n- **JavaScript**: For client-side interactivity.\n\n## 📂 Project Structure  \n\n```plaintext\nsnap-url-shortener-postgres/\n├── config/                   # Configuration files (DB, email, etc.)\n│   ├── dbConfig.js           # Database connection settings\n│   ├── emailConfig.js        # Email configuration for notifications\n├── controllers/              # Business logic for the app\n│   ├── indexControllers.js   # Controller for handling URL-related routes\n├── models/                   # Database models\n│   ├── urlModel.js           # Model for managing shortened URLs\n├── public/                   # Static files (CSS, JS, Images)\n│   ├── css/                  # Stylesheets\n│   ├── js/                   # JavaScript files\n│   ├── 404.css               # Custom CSS for 404 page\n│   ├── loader.css            # Loader CSS\n│   ├── mainStyle.css         # Main styles for the application\n│   ├── email.js              # JS for email interactions\n│   ├── loader.js             # JS for loader animations\n│   ├── result.js             # JS for handling result page\n│   ├── urlForm.js            # JS for URL form validation\n├── routes/                   # Application routes\n│   ├── indexRoutes.js        # Routes for handling URL shortening and navigation\n├── utils/                    # Utility functions\n│   ├── emailUtils.js         # Helper functions for email-related tasks\n│   ├── httpStatusCodes.js    # Standard HTTP status codes\n│   ├── responseUtils.js      # Helper functions for crafting responses\n│   ├── urlShortenerUtils.js  # Helper functions for URL shortening logic\n├── views/                    # EJS templates for frontend views\n│   ├── layouts/              # Layouts for rendering the app\n│   ├── partials/             # Reusable components like header and footer\n│   ├── errorLayout.ejs       # Layout for error pages\n│   ├── mainLayout.ejs        # Main layout for the application\n│   ├── footer.ejs            # Footer partial\n│   ├── header.ejs            # Header partial\n│   ├── 404.ejs               # 404 error page\n│   ├── about.ejs             # About page\n│   ├── contact.ejs           # Contact page\n│   ├── index.ejs             # Home page for shortening URLs\n│   ├── internalError.ejs     # Internal server error page\n│   ├── result.ejs            # Page showing the shortened URL\n├── .gitignore                # Git ignore file\n├── README.md                 # Documentation for the project\n├── app.js                    # Main entry point for the application\n├── package.json              # Project metadata and dependencies\n├── package-lock.json         # Lock file for dependencies\n```\n\n## 🔧 Setup and Installation  \n\n### Prerequisites  \n- **Node.js** (v16+ recommended)  \n- **PostgreSQL** (local or cloud instance)  \n- **npm** (Node Package Manager)  \n\n### Steps  \n1. **Clone the repository**:  \n   ```bash\n   git clone https://github.com/your-username/snap-url-shortener-postgres.git\n   cd snap-url-shortener-postgres\n   ```\n\n2. **Install dependencies**:  \n   ```bash\n   npm install\n   ```\n\n3. **Set up environment variables**:  \n   Create a `.env` file in the root directory with the following configuration:  \n   ```plaintext\n   PORT=3000\n   DB_USER=your_db_user\n   DB_PASSWORD=your_db_password\n   DB_HOST=your_db_host\n   DB_PORT=5432\n   DB_NAME=your_db_name\n   SESSION_SECRET=your_session_secret\n   SEND_EMAIL=\"your_email\"\n   SEND_EMAIL_PASS=\"your_email_password\"\n   ```\n\n4. **Set up PostgreSQL**:  \n   - Ensure your PostgreSQL database is running and accessible.\n   - Create a database with the name specified in `.env`.\n\n5. **Run the application**:  \n   ```bash\n   npm start\n   ```\n\n6. Open your browser and go to `http://localhost:3000` to access the app.  \n\n## 📜 Usage  \n\n### For Users  \n- **Shorten a URL**: Enter a long URL in the form to get a shortened version.\n- **View Shortened URLs**: The shortened URL will be displayed along with a button to copy it.\n\n## 📈 Learning Outcomes  \n\n- Understanding **PostgreSQL** and how to interact with it using Node.js.  \n- Building a **URL shortener** from scratch with a simple user interface.  \n- Implementing **error handling** with custom pages for 404 and internal errors.  \n- Learning **email notification** for user action.  \n\n## 📜 License  \n\nThis project is licensed under the **MIT License**.\n\n## 🌟 Acknowledgements  \n\n- Thanks to the open-source community for providing essential libraries and tools.\n\nHappy Coding! 🎉  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashifhassandev%2Fsnap-url-shortener-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashifhassandev%2Fsnap-url-shortener-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashifhassandev%2Fsnap-url-shortener-postgres/lists"}