Shorten, create and share memorable links for IBANS
BIG REFACTORING STARTED
Shorten IBAN numbers with url such as :
- iban.im/user/alias
- iban.im/fakturk/garanti
- Go
- GraphQL : graphql-go
- ORM : gorm
- Vue 3
- Vite
- Tailwind CSS v4
- Vue Router
- Vuex
The frontend is built and embedded into the Go binary as static files, creating a single deployable artifact.
- New users should Sign Up & Sign In
- Change a Password of user
- Change a Profile of user
- Delete a Profile of user
- Get Profile of user
- New IBAN add for user
- Update IBAN for user
- Delete IBAN for user
- Get IBAN's of user
- When adding new IBAN check if is it exist with same name (we can add with different names)
- A user should add iban to only itself
The easiest way to get started with development is using Docker with hot reloading:
# With PostgreSQL (recommended)
docker compose -f docker-compose.dev.yml up
# With SQLite (lightweight)
docker compose -f docker-compose.dev.sqlite.yml upSee DOCKER_DEV.md for complete Docker development documentation.
- Create a database
postgres=# CREATE DATABASE ibanim;- Create a user as owner of database
postgres=# CREATE USER ibanim WITH ENCRYPTED PASSWORD 'ibanim';
postgres=# ALTER DATABASE ibanim OWNER TO ibanim;- Grant all privileges to user for the database
postgres=# GRANT ALL PRIVILEGES ON DATABASE ibanim TO ibanim;- Configure the db in
db.go
// ConnectDB : connecting DB
func ConnectDB() (*DB, error) {
db, err := gorm.Open("postgres", "host=localhost port=5432 user=ibanim dbname=ibanim password=ibanim sslmode=disable")
if err != nil {
panic(err)
}
return &DB{db}, nil
}or with Docker
host address should be edited to
host.docker.internalto connect a host interface.
// ConnectDB : connecting DB
func ConnectDB() (*DB, error) {
db, err := gorm.Open("postgres", "host=host.docker.internal port=5432 user=ibanim dbname=ibanim password=ibanim sslmode=disable")
if err != nil {
panic(err)
}
return &DB{db}, nil
}$ go run ./migrations/init.goor with Docker
$ docker build -t ibanim .
$ docker run --rm ibanim migrate
This will generate the users table in the database as per the User Model declared in ./model/user.go
The frontend is embedded into the Go binary. You must build the frontend first, then build the Go application.
$ make build
$ ./iban.imThis will automatically build the frontend and copy it to static/dist/ before building the Go binary.
# Build frontend
$ cd web
$ npm install
$ npm run build
$ cd ..
# Copy frontend to static package
$ cp -r web/dist static/
# Build Go binary
$ go build
$ ./iban.imThe server will serve both the API (GraphQL) and the frontend (Vue.js SPA).
or with Docker
$ docker run --rm -d -p 8080:8080 ibanim
The frontend is a Vue 3 single-page application (SPA) with Tailwind CSS. For detailed information about building and embedding the frontend, see FRONTEND_BUILD.md.
For frontend development with hot-reload:
cd web
npm install
npm run devThe development server runs on http://localhost:4881 and proxies API requests to http://localhost:4880.
cd web
npm run build
cp -r dist ../static/Then rebuild the Go binary to include the updated frontend:
go buildConnect to http://localhost:8080
You need to set the Http request headers Authorization: {JWT_token}
You can configure the app via environment variables and/or YAML files. Load order and precedence:
- Built-in defaults
- YAML files (if present):
config/database.yml,config/smtp.yml,config/application.yml - Environment variables (highest precedence)
Supported environment variables:
- PORT
- ENV
- DEBUG
- TIMEOUT
- MAX_REFRESH
- AUTH_KEY
- REALM
- DB_ADAPTER
- DB_HOST
- DB_PORT
- DB_NAME
- DB_USER
- DB_PASSWORD
Example .env file (copy to .env and adjust as needed):
# Application
PORT=7000
ENV=localhost
DEBUG=false
TIMEOUT=60
MAX_REFRESH=60
AUTH_KEY=12345678
REALM=ibanim zone
# Database
DB_ADAPTER=postgres
DB_HOST=localhost
DB_PORT=5432
DB_NAME=ibanim
DB_USER=ibanim
DB_PASSWORD=ibanim
mutation {
signUp(
email: "test@test.com"
password: "12345678"
firstName: "graphql"
lastName: "go"
handle:"test"
) {
ok
error
user {
id
handle
email
firstName
lastName
bio
avatar
createdAt
updatedAt
}
}
}mutation {
signIn(email: "test@test.com", password: "12345678") {
ok
error
token
}
}mutation {
changePassword(password: "87654321") {
ok
error
user {
id
handle
email
firstName
lastName
bio
avatar
createdAt
updatedAt
}
}
}mutation {
changeProfile(bio: "Go developer", avatar: "go-developer.png") {
ok
error
user {
id
handle
email
firstName
lastName
bio
avatar
createdAt
updatedAt
}
}
}mutation {
deleteProfile(confirmPassword: "your_current_password") {
ok
error
message
}
}query {
getMyProfile {
ok
error
user {
id
handle
email
firstName
lastName
bio
avatar
createdAt
updatedAt
}
}
}mutation {
ibanNew(text:"TR320010009999901234567890",password:"fatih",handle:"fakturk"){
ok
error
iban{
id
handle
text
password
createdAt
updatedAt
}
}
}mutation {
ibanUpdate(text:"TR420010009999901234567891",password:"fatih",handle:"garanti"){
ok
error
iban{
id
handle
text
password
createdAt
updatedAt
}
}
}query {
getMyIbans {
ok
error
iban {
id
handle
text
password
createdAt
updatedAt
ownerId
}
}
}