Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hormesiel/vercel-basic-auth
How to add BASIC AUTHENTICATION to a VERCEL deployment for FREE using various techniques.
https://github.com/hormesiel/vercel-basic-auth
authentication basic-auth basic-authentication language nodejs now serverless static-site vercel vercel-now
Last synced: 3 days ago
JSON representation
How to add BASIC AUTHENTICATION to a VERCEL deployment for FREE using various techniques.
- Host: GitHub
- URL: https://github.com/hormesiel/vercel-basic-auth
- Owner: hormesiel
- License: mit
- Created: 2019-01-21T18:22:23.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-11-20T16:15:56.000Z (about 1 month ago)
- Last Synced: 2024-12-22T05:09:11.648Z (3 days ago)
- Topics: authentication, basic-auth, basic-authentication, language, nodejs, now, serverless, static-site, vercel, vercel-now
- Language: TypeScript
- Homepage:
- Size: 627 KB
- Stars: 108
- Watchers: 3
- Forks: 15
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Goal
This repo contains examples of how to add *Basic Authentication* to a Vercel deployment using various languages / frameworks, along with some numbers that show the differences between each method.
Each example contains its own README file with some additional information.
## Adding basic auth to SSR / API routes
All the examples in this repo only show how to add basic auth to **static pages**. If you want to add basic auth to SSR or API routes, you'll have to do it manually or use a package specifically designed for the framework you're using, like [nextjs-basic-auth-middleware](https://www.npmjs.com/package/nextjs-basic-auth-middleware) if your project uses Next.js.
## Structure
- The `_static` directory contains the source code for the "website" that each implementation serves for demonstration purposes : HTML, CSS, images ... 1
- All the other directories are the different ways you can add Basic Authentication to a Vercel deployment. Checkout their code to see how to implement it in your project1 The demo website has a public area and a restricted `/admin` area **(username / pass : `admin` / `admin`)**.
## Comparison
| Example | 📦 Lambda size | 🔗 Deployment URL | 👨💻 Ease of implementation |
| ---------------- | -------------- | -------------------------------------------------------------- | ----------------------------- |
| node | 0.08 MB | [Link](https://vercel-basic-auth-node.vercel.app/) | ⭐ |
| node-express | 0.38 MB | [Link](https://vercel-basic-auth-node-express.vercel.app/) | ⭐⭐ |
| node-static-auth | 0.08 MB | [Link](https://vercel-basic-auth-node-static-auth.vercel.app/) | ⭐⭐⭐ |## Contributing
Issues and PR are welcome!
- 🔀 Fork and clone the project
- 🆕 Create a directory named after the language / framework you want to add (for example `php` or `node-polka`)
- 👨💻 Add the implementation
- 🎉 Submit your PR