A Full-Stack URL Shortener application built with ASP.NET Core (Backend) and Angular (Frontend). Application allows users to shorten long URLs, manage their links, and admin features (e.g. change the about section about the algorithm). Has a secure login system using Identity and a SQLite database.
- Backend: ASP.NET Core Web API 9.0 (C#)
- Frontend: Angular 19+ (TypeScript, Bootstrap)
- Database: SQLite (Entity Framework Core Code-First approach)
- Testing: xUnit, Moq
- Authentication: ASP.NET Core Identity (Cookie-based Auth with CORS support)
-
Public Access: View list of shortened URLs.
-
User Accounts: Login (seeded users available)
-
Admin:
- E-mail: admin@vitalii.com
- Password: Vitalii123!
- Permissions: Create, View, Delete ALL links, Edit About Page
-
Plain User:
- E-mail: user@vitalii.com
- Password: User123!
- Permissions: Create, View, Delete OWN links only
-
-
Role-Based Access Control:
- Users: Create short links, delete only their own links, view info of their own links.
- Admins: Delete any link, View any link, edit the "About" page content.
-
Smart Redirection: Navigate to http://localhost:5152/{shortCode} to be redirected to the original URL.
-
Duplicate Prevention: Prevents creating duplicate short codes for the same URL.
- .NET 9.0 SDK
- Node.js (LTS version recommended)
- Angular CLI (
npm install -g @angular/cli)
The project uses SQLite. You need to apply migrations to create the database file (app.db).
- Navigate to the backend folder:
cd URLShortener- Restore dependencies:
dotnet restore- Update the database (Runs migrations & creates app.db):
dotnet ef database updateNote: If you don't have the EF tool installed, run:
dotnet tool install --global dotnet-ef- Run the Backend Server:
dotnet runThe API will start at http://localhost:5152. Note: On the first run, the app will automatically seed default users.
- Open a new terminal and navigate to the frontend folder:
cd ClientApp- Install dependencies:
npm install3.Run the Angular App:
ng serve -oThe application will open automatically at http://localhost:4200.
The solution includes Unit Tests for the Service Layer (Business Logic).
- Navigate to the test project directory:
cd URLShortener.Tests- Run the tests:
dotnet test