This is a URL Shortener web application that allows users to shorten URLs and track their views over time. It also provides administrative functionalities for managing users, links, and guest users.
Check out a demo of the project in action on YouTube:
- Submit a URL in a form on the homepage.
- URLs are saved to the database.
- Access URLs using a Base62 encoded primary key ID (short code) of the URL (/v/:id).
- Copy the short URL to the clipboard.
- Record views when visiting the short code to track views per day.
- View a graph of the views over the past 2 weeks.
- Edit and delete URLs.
- Retrieve the title, description, and open graph image for the HTML document.
- This runs in the background to keep the application fast.
- Update title, description, and image if a URL is edited.
- Paginate the list of shortened URLs.
-
Dashboard
- View diagrams displaying all registered users and guest users.
- See a chart of user activity over the last 7 days.
- Track all links' views over the past 2 weeks.
-
Users Management
- View a list of all users, along with the total number of links each user has created.
- Access user profiles to see basic information, recent link views, and links created.
- Edit links on behalf of users.
- Delete or edit users and their links.
-
Guest Users
- View a list of all guest users.
- See the IP addresses associated with each guest user.
- Ruby on Rails for the backend
- PostgreSQL for the database
- Devise for authentication
- Chartkick for generating charts
- Pagy for generating pagination
- Background job processing (e.g., Sidekiq, Delayed Job) for fetching metadata asynchronously
- Tailwind CSS for front-end design and layout
- Clone the repository (
git clone https://github.com/Mdromi/url_shortener
). - Install Ruby and Rails dependencies (
bundle install
). - Set up the database (
rails db:setup
). This will create the database, load the schema, and initialize it with seed data. - Set up the database (
rails db:setup
). - Start the Rails server (
rails server
). - Visit
http://localhost:3000
in your web browser. - To login to the admin dashboard, use the following credentials:
- Email: [email protected]
- Password: password
- Register or log in to the application.
- Shorten a URL by submitting it on the homepage.
- View, edit, or delete URLs from your dashboard.
- View URL statistics and graphs.
- Access admin functionalities from the admin panel.
This project is licensed under the MIT License.