Bhagad House Booking is a private app created in golang with gioui and other libraries. It's a private app but it's code are open sourced and MIT-Licensed. You are free to use it.
-
Build and run docker images for backend,frontend and postgresql.
docker compose up
- Refer to Local Development
- Make sure your postgresql database is running at 5432.
- Create a database named
bhagad_house_booking
locally (DB_URL=postgresql://root:secret@localhost:5432/bhagad_house_booking?sslmode=disable) and necessary tables.
postgres15 createdb --username=root --owner=root bhagad_house_booking
cd common && make migrateup
- Create a user (Optional, only if admin role is desired).
cd common && go run cmd/main.go
The above command will create a user named Owner Admin
and email admin@bhagadhouse.com
and password 12345678
.
You will need to add a role named Admin
in the users table of bhagad_house_booking
- Run the backend app locally on port 8001
export PORT=8001 && cd backend && go run cmd/server/main.go
- Build the static files for web
cd frontend && gogio -target js -o output/wasm ./cmd/main.go
- Copy generated wasm file to static directory
cd frontend && cp output/wasm/main.wasm cmd/static/dist/main.wasm
- Copy environment variables for frontend(client) app
echo "window.API_URL = 'http://localhost:8001';" >> frontend/cmd/static/dist/wasm.js
- Serve the static files
export window.STATIC_FOLDER = 'dist'
export window.INNER_PORT = '8002'
cd frontend/cmd/static && go run main.go
CGO_ENABLED=1 GOOS=windows CC=x86_64-w64-mingw32-gcc go build -ldflags -H=windowsgui -o output/windows/booking.exe cmd/main.go
Note: -ldflags -H=windowsgui
- The frontend needs to be served as static app
- The frontend also needs env vars
- The backend in turn needs postgres database to be running.
flyctl deploy -a bhagad-house-booking-frontend --build-arg API_URL=https://bhagad-house-booking-backend.fly.dev -e GIN_MODE=release -c frontend.fly.toml
flyctl deploy -a bhagad-house-booking-backend -e GIN_MODE=release -c backend.fly.toml