- Go 42.5%
- templ 22.3%
- CSS 20.3%
- JavaScript 12.3%
- HTML 2.1%
- Other 0.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github | ||
| config | ||
| database | ||
| server | ||
| static | ||
| templates | ||
| utils | ||
| .dockerignore | ||
| .gitignore | ||
| .sops.yaml | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| haloy.yaml | ||
| LICENSE.md | ||
| main.go | ||
| README.md | ||
| secrets.yaml | ||
Glyphtones
Nothing is making phones with programmable LED lights on the back. They call it "Glyph Interface" and there is a bunch of ringtones preinstalled. Nothing also made an app called Glyph Composer, which allows users to create new ringtones, but the options are quite limited. Users have figured out a way to create custom ringtones and started making popular songs with matching lights.
Glyphtones is a platform, where people can either share their custom compositions, or find those they like.
Tech stack
The app uses Go + echo + templ to render HTML pages for the client (and a little bit of htmx). Data is stored in a PostgreSQL database.
Production
The website is running in Germany, Falkenstein on Hetzner VPS.
Database Schema
Or take a look here: ./database/init.sql
How to run (for developers)
With Docker/Podman
- Clone the repository
git clone https://github.com/firu11/nothing-glyphtones.git
cd nothing-glyphtones
- Create a Docker network
docker network create glyphtones
- Run PostgreSQL
docker run -d \
--name glyphtones-postgres \
--network glyphtones \
-e POSTGRES_USER=chris \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=glyphtones \
-v glyphtones-postgres:/var/lib/postgresql/data \
-v ./database/init.sql:/docker-entrypoint-initdb.d/init.sql:ro \
postgres:17
PostgreSQL runs database/init.sql when initializing a new data volume. If the glyphtones-postgres volume already exists, remove it with docker volume rm glyphtones-postgres before starting PostgreSQL to run the script again.
- Build the application image
docker build -t glyphtones .
- Run the application container
docker run --rm \
--network glyphtones \
-p 8080:8080 \
-e DB_CONNECTION_STRING="postgresql://chris:password@glyphtones-postgres:5432/glyphtones?sslmode=disable" \
-e GOOGLE_SECRET="<GOOGLE_CONSOLE_SECRET>" \
-e GOOGLE_ID="<GOOGLE_CONSOLE_ID>" \
-e GOOGLE_REDIRECT_URL="http://localhost:8080/google-callback" \
-e TOKEN_KEY="change-me" \
glyphtones
It will be available on http://localhost:8080
Bare-metal (better for local development)
- Install Go compiler and PostgreSQL server
- Install Templ via
go install - Create a new database in psql
- Clone this repository
- Run the ./database/init.sql file to setup the database
- Configure your environment variables
- Run the project (
templ generate && go run .)
MacOS example:
# INSTALLATION
brew install go # go
brew install postgresql@17 # postgresql
go install github.com/a-h/templ/cmd/templ@latest # templ
# SETUP
brew services start postgresql # start postgresql
psql postgres # open postgresql
# --- inside postgres ---
postgres=# CREATE ROLE chris WITH LOGIN PASSWORD 'password'; # create user with password
postgres=# CREATE DATABASE glyphtones OWNER chris; # create a database called "glyphtones" with chris being the owner
postgres=# \q # exit
# --- back in terminal ---
git clone https://github.com/firu11/nothing-glyphtones.git # clone the repository
# CONFIGURATION
cd nothing-glyphtones # go into the project
psql glyphtones < database/init.sql # load the init.sql file into the database
# RUN
export DB_CONNECTION_STRING="postgresql://chris:password@localhost:5432/glyphtones?sslmode=disable"
export GOOGLE_SECRET="<GOOGLE_CONSOLE_SECRET>"
export GOOGLE_ID="<GOOGLE_CONSOLE_ID>"
export GOOGLE_REDIRECT_URL="http://localhost:8080/google-callback"
export TOKEN_KEY="change-me"
templ generate # generate html templates
go run . # run the code
# go to: http://localhost:8080 and voilà
