Skip to content

Commit

Permalink
feat(init): ⚡initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
timothystewart6 committed Aug 10, 2021
0 parents commit f8ac025
Show file tree
Hide file tree
Showing 48 changed files with 2,435 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: timothystewart6
patreon: technotim
57 changes: 57 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI for releases

on:
push:
branches:
- master

jobs:
js-install-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [v14.17.4]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@master
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies, Test, and Build
run: |
yarn install --frozen-lockfile --check-files
env:
CI: true

build-and-push-docker-image:
needs: [js-install-and-test]
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Show structure
run: |
ls -R
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/386
push: true
tags: timothystewart6/littlelink-server:latest
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14.17.4
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:14.17.4-alpine
RUN apk --no-cache add \
gettext \
bash
ENV NODE_ENV=production
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --check-files --production=true
COPY www ./www
COPY app.js ./
COPY ./entrypoint.sh /
RUN chmod +x /entrypoint.sh
EXPOSE 3000
ENTRYPOINT ["/entrypoint.sh"]
CMD [ "node", "app.js" ]

25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 🔗 LittleLink-Server

[![Docker Build Status](https://img.shields.io/docker/pulls/timothystewart6/littlelink-server.svg)](https://hub.docker.com/r/timothystewart6/littlelink-server/)

This project is based on the great work from [littlelink](https://github.com/sethcottle/littlelink)
It takes the same simple approach to a link page and hosts it within a nodeJS server containerized for you to use. Now, customizing `littlelink` with `littlelink-server` is as easy as passing in some environment variables.



# 👇 What is `littlelink`?

![LittleLink](https://cdn.cottle.cloud/littlelink/social-circle.png)

LittleLink is a lightweight DIY alternative to services like [Linktree](https://linktr.ee)
and [many.link](https://www.google.com). LittleLink was built using [Skeleton](http://getskeleton.com/), a dead simple, responsive boilerplate—we just stripped out some additional code you wouldn't need and added in branded styles for popular services. 😊

![Themes](https://cdn.cottle.cloud/littlelink/themes.png)

LittleLink has more than 20 company button styles you can use and we'll be throwing more in soon. You'll also find a light and dark theme ready to go. Not a fan of the colors? Update `skeleton-light.css` or `skeleton-dark.css` to the HEX values of your choosing.

![Performance](https://cdn.cottle.cloud/littlelink/performance.png)

Using [Skeleton](http://getskeleton.com/) let us build something that loads quickly & doesn't have any of the unnecessary bloat you would get from using a large framework for a page that requires nothing more than simplicity. LittleLink scored a 99/100 in performance when tested with [Google Lighthouse](https://developers.google.com/web/tools/lighthouse).

![Publish](https://cdn.cottle.cloud/littlelink/fork-edit-publish.png)
24 changes: 24 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require('dotenv').config()
const express = require('express')
const helmet = require("helmet");
const morgan = require('morgan')
const compression = require('compression')

const app = express();
app.use(
helmet.contentSecurityPolicy({
useDefaults: true,
directives: {
"img-src": '* data:', // this is needed to load images off site
},
})
);
app.use(morgan('combined'));
app.use(express.static('www'));
app.use(compression())

const server = app.listen(process.env.PORT || 3000, () => {
const host = server.address().address
const port = server.address().port
console.log('Express app listening at http://%s:%s', host, port)
})
32 changes: 32 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# this is used for local development and testing
version: '3.0'
services:
little-link:
build:
context: ./
dockerfile: Dockerfile
environment:
- META_TITLE=Techno Tim
- META_DESCRIPTION=Techno Tim Link page
- META_AUTHOR=Techno Tim
- THEME=Dark
- FAVICON_URL=https://pbs.twimg.com/profile_images/1286144221217316864/qIAsKOpB_400x400.jpg
- AVATAR_URL=https://pbs.twimg.com/profile_images/1286144221217316864/qIAsKOpB_400x400.jpg
- AVATAR_ALT=Techno Tim Profile Pic
- NAME=TechnoTim
- BIO=Hey! Just a place where you can connect with me!
- GITHUB=https://github.com/timothystewart6
- TWITTER=https://twitter.com/TechnoTimLive
- INSTAGRAM=https://www.instagram.com/techno.tim
- YOUTUBE=https://www.youtube.com/channel/UCOk-gHyjcWZNj3Br4oxwh0A/
- TWITCH=https://www.twitch.tv/technotim/
- DISCORD=https://discord.gg/DJKexrJ
- KIT=https://kit.co/TechnoTim
- FOOTER=Thanks for stopping by!

ports:
- 8080:3000
restart: unless-stopped
security_opt:
- no-new-privileges:true
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
originalfile="/usr/src/app/www/js/env.js"
tmpfile=$(mktemp)
cp --attributes-only --preserve $originalfile $tmpfile
cat $originalfile | envsubst | tee $tmpfile && mv $tmpfile $originalfile
exec "$@"
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "littlelink-server",
"version": "1.0.0",
"description": "A server based on littlelink",
"main": "app.js",
"license": "MIT",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/timothystewart6/littlelink.git"
},
"keywords": [
"littlelink",
"linktree",
"linktr.ee",
"javascript",
"open",
"source",
"html",
"css",
"docker"
],
"author": "Timothy Stewart",
"bugs": {
"url": "https://github.com/timothystewart6/littlelink/issues"
},
"homepage": "https://github.com/timothystewart6/littlelink#readme",
"dependencies": {
"compression": "^1.7.4",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"helmet": "^4.6.0",
"morgan": "^1.10.0"
}
}
Loading

0 comments on commit f8ac025

Please sign in to comment.