Skip to content

Server layer service for url shortener application written in Spring Boot

Notifications You must be signed in to change notification settings

Wonderpol/url-shortener-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Url shortener backend service

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. TODO

About The Project

Server layer of an application that gives an opportunity to shorten url. The application solves problem with long unreadable links. In the next step of development process it will allow to collect statistics about shorten link.

Here's why:

  • Some users are scared of long links
  • Easy link management
  • Keep track of link traffic

The project is still in development due to that some features may not be available.

(back to top)

Built With

The application is built with Java and Spring boot framework, Postgresql database and Docker. For authentication, it uses JWT bearer tokens.

  • Java
  • Spring-boot
  • Postgres

(back to top)

Getting Started

To setup and run the project follow instructions below.

Prerequisites

  • Docker
    • To install docker you can use some kind of package manager like sudo apt install docker - linux or brew install docker - macos
    • On windows go to docker website and download installer: Docker installer

Installation

  1. Clone the repo

    git clone https://github.com/Wonderpol/url-shortener-service.git
  2. Open the following file: src/main/resources/application-prod.yml

    vim src/main/resources/application-prod.yml

    or open it in different text editor.

  3. In config section enter your front end url and jwt secret key. The secret key can be generated using Allkeysgenerator. In the mail section provide your SMTP provider, email, and password.

    config:
      frontend-url: FRONT_END_URL
      email-confirm-frontend-endpoint: /confirm-email
      request-password-reset-frontend-endpoint: /reset-password
      jwt:
        secret-key: JWT_SECRET_KEY
      email-template:
        confirm-email: email-confirm.html
        reset-password: reset-password.html
    
    spring:
      datasource:
        url: jdbc:postgresql://db:5432/urlshortenerdb
        username: admin
        password: password
        driver-class-name: org.postgresql.Driver
      jpa:
        hibernate:
          ddl-auto: update
        show-sql: true
        properties:
          hibernate:
            format_sql: false
        database: postgresql
        database-platform: org.hibernate.dialect.PostgreSQLDialect
      mail:
        host: smtp.gmail.com
        port: 587
        username: YOUR_EMAIL
        password: YOUR_PASSWORD
        properties:
          mail:
            smtp:
              auth: true
              starttls:
                enable: true
            debug: true
            protocol: smtp
            test-connection: false
  4. Now within the root folder open terminal and type:

    docker-compose up

Now if everything went well the application will be available at: localhost:8080

(back to top)

Usage

Email template customization: feel free to customize emails templates that are sent to users. Go to src/main/resources/templates, open and edit html template.

Usage will be moved to OpenAPI Documentation

(back to top)

TODO

  • Move Usage section to OpenAPI documentation
  • Add all available endpoints to README
  • Add reset password feature
  • Add link statistics
  • Add notification 30 days before link expire
  • Multi-language Email Support
    • Polish

See the open issues for a full list of proposed features ( and known issues).

(back to top)

Project status

Project is still in development

(back to top)

About

Server layer service for url shortener application written in Spring Boot

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published