Coder Social home page Coder Social logo

starsrivers / magic-link Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lilac-milena/magic-link

0.0 0.0 0.0 133 KB

Serverless and open source link shortener | 无服务器且开源的链接缩短器

Home Page: https://maglink.vercel.app/

License: Mozilla Public License 2.0

JavaScript 42.10% HTML 57.90%

magic-link's Introduction

✨ Magic Link

该页面的 简体中文版本

Serverless URL shortening service based on Nodejs and Express. You can deploy the project using Vercel, Netlify, or other Serverless services, and for Vercel and Netlify, it's completely free.

This document was originally a supporting Chinese document for the old version of ShortUrl, now it has been modified to be used as a document for Magic-Link, and the old version of the Shortlink project will no longer provide updates except for security updates. The database structure of the old version is currently not applicable to the new version of ShortUrl, the conversion tool of the old and new database structure will be available soon.

🎉 Features

  • No server
  • Automatically prevents generation of duplicate short URLs
  • Background administration page
    • Add Short URL
    • Short URL List
    • Delete Short URLs
    • Customize URL
  • API
  • Can be used for secondary development
  • Database Cache

😎Demo

Test link: https://go.muna.uk/eXw8n

image

😜 Deployment

Part 1

Claiming the Mongodb database Video version: Youtube Part1 Since the short link service needs to store URL data, you need to request a free Mongodb database from Mongodb.com for data storage.

In this section, you will get a Mongodb url, please save it and we will use it in the next section.

Open https://account.mongodb.com/account/register to register an account image image image image

Create a database account and record the account password

image

Authorize all IP connections

image

Create

image

image

Click this option

image

Copy the link URL

image

Replace "< password >" in the URL with the password you just set.

image


Part 2

1. Deploy the repository to Vercel:

You need to click the button below to go to the Vercel deployment page

Vercel

If you have not logged in or registered with Vercel, please follow the page to register/log in and then click the Deploy button above again.

If everything is ready, you will see the following page after clicking the button:

image

You need to give your project a name and fill in the "Repository Name" input box, click the "Create" button.

image

At this point Vercel will automatically create a repository with the same name in your Github and pull the code for the project.

image

Once the pull is complete, Vercel will start the project deployment, which is also automated.

image

When you see this page, the project has been successfully deployed.

image

2.Add Environment Variables

Once the deployment is complete, you need to click the "Continue to Dashboard" button located in the upper right corner of the page.

image

If you accidentally close this page, you can simply open the program on the home page. On the new page, click the "Settings" button in the menu bar.

Click the "Environment Variables" button to open the Environment Variables Settings page.

image

On the Environment Variable Settings screen, create a new environment variable according to the table below:

Variable name Value Example
linkLen An integer, optional, defaults to 8, is the length of the random string used to generate the short link 10
mongodbCollection optional, Database Collection Database tables used to distinguish between different services (created automatically if they don't exist) Link
mongodbDB optional, database name (will be created automatically if it does not exist) MyService1
AdminSession The key used to log into the shortlink management page and request APIs. 123456
mongodbUrl mongodbUrl, In the previous section get mongodb+srv://xxx:xxx

Check that the "Production", "Preview" and "Development" options below are all selected.

Finally, click the "Save" button to save.

image

We need to click on the "Deployments" button in the navigation bar to open the Deployments tab.

image

Click the "..." button to the right of the first record. button to the right of the first record to redeploy the project.

image

Click the "REDEPLOY" button to redeploy.

image

When you see this page, the service has been successfully deployed

image

You can access the administration page through the domain name + /admin/ (**admin must be followed by the / sign **), the login password is the value of "AdminSession" in the environment variable you set.

image

If you need to customize your domain name, you can bind it yourself on the setup page.

magic-link's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.