Backend API for the Parlor salon management platform. Handles authentication, appointment booking, client management, onboarding, and more.
| Category | Technology |
|---|---|
| Language | Go 1.25 |
| Framework | Gin |
| Database | PostgreSQL 18 |
| Cache | Redis 7.4 |
| Auth | JWT + Google OAuth2 (SSO) |
| Mailtrap | |
| SQL Generation | sqlc |
| Docs | OpenAPI 3.1 / Swagger UI |
| Containers | Docker & Docker Compose |
| Testing | testcontainers (real PostgreSQL) |
| Release | GoReleaser + Semantic Release |
cmd/api/main.go # Entry point
internal/
├── server/ # Server init & route registration
├── modules/
│ ├── auth/ # Registration, login, JWT tokens
│ ├── sso/ # Google OAuth2 sign-in
│ ├── profile/ # User profile CRUD
│ ├── onboarding/ # Onboarding flow & step tracking
│ └── contact_form/ # Contact form submissions
├── middleware/
│ ├── auth/ # JWT authentication guard
│ ├── rbac/ # Role-based access control
│ └── origin/ # Origin validation
├── database/
│ └── sqlc/ # Generated type-safe query code
├── logger/ # Structured logging
├── email/ # Mailtrap email service
└── helper/ # Shared utilities
migrations/
├── schema/ # Database schema migrations
└── queries/ # SQL queries (sqlc input)
docs/ # OpenAPI spec & Swagger UI
config/nginx/ # File storage nginx config
test/ # Integration & unit tests
| Method | Path | Description | Auth |
|---|---|---|---|
GET |
/health |
Health check | No |
POST |
/auth/register |
Register user | No |
POST |
/auth/login |
Login | No |
POST |
/auth/refresh |
Refresh JWT token | No |
GET |
/auth/me |
Current user info | Yes |
POST |
/auth/logout |
Logout | Yes |
GET |
/auth/google |
Start Google OAuth | No |
GET |
/auth/google/callback |
Google OAuth callback | No |
GET |
/profile |
Get profile | Yes |
PATCH |
/profile |
Update profile | Yes |
GET |
/onboarding |
Get onboarding progress | Yes |
POST |
/onboarding |
Save onboarding selections | Yes |
POST |
/onboarding/step |
Save individual step | Yes |
POST |
/contact-form |
Submit contact form | Origin |
GET |
/contact-form |
List submissions | Yes |
GET |
/swagger |
Swagger UI | No |
Core tables: users, salons, sso, services, clients, appointments, notifications, contact_form, onboarding_steps, onboarding_options, salon_onboarding_selection.
User roles: admin, owner, employee, customer
Appointment statuses: pending, confirmed, cancelled, done, no-show
- Go 1.25+
- Docker & Docker Compose
- golang-migrate (for manual migrations)
# Clone and configure
cp .env.example .env
# Edit .env with your values
# Run with Docker (PostgreSQL + Redis + app + nginx)
make docker-run
# Or run locally
make run
# Hot reload (requires air)
make watchmake migrate-up # Apply all migrations
make migrate-down # Rollback last migration
make migrate-down-all # Rollback all migrations
make migrate-create name=my_migration # Create new migration
make migrate-status # Check current versionmake test # Runs integration tests with testcontainersmake queries_gen # Regenerate sqlc code from SQL queriesSee .env.example for all required variables. Key groups:
- Database:
DB_HOST,DB_PORT,DB_DATABASE,DB_USERNAME,DB_PASSWORD - Redis:
REDIS_HOST,REDIS_PORT,REDIS_PASSWORD - JWT:
JWT_SECRET(min 32 chars in production),JWT_EXPIRATION_HOURS - Google OAuth:
GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET,GOOGLE_REDIRECT_URL - Email:
MAILTRAP_TOKEN,MAILTRAP_URL - URLs:
FRONTEND_URL,LANDING_PAGE_URL
Use .env.local to override values for local development without modifying .env.
Adds the salon dashboard and updates the onboarding endpoint. Builds on top of the management module work. Includes Swagger documentation updates.
Key commits:
111ebf5feat: add dashboard and updated onboarding endpoint86bc42ffix: remove unnecessary doc
Introduces the salon/service management module — CRUD operations for salons, services, and clients. Adds Swagger API documentation integration.
Key commits:
9fc553dfeat: add managment29bdec7feat: add in swaggerf37a3e5fix: fix managment packages structure and swagger
Integration branch. Currently has the management module merged ahead of main.
Adds Swagger UI documentation endpoint to the API.
Key commit:
4a8bc25feat: added swagger
These branches have been merged into main and represent completed work:
Fixed SQL migration conflicts after multiple feature branches were merged. Consolidated migration files.
Added CI workflow for building and publishing Docker image artifacts via GitHub Actions.
Added the user onboarding flow — multi-step wizard with selectable options stored per salon.
Implemented Google OAuth2 Single Sign-On. Added SSO database table, OAuth flow handlers, and token exchange.
Added Role-Based Access Control middleware. Restricts endpoints based on user roles (admin, owner, employee, customer).
Added the contact form submission endpoint with origin-based access restriction (landing page only).
Integrated Mailtrap email service for transactional emails (registration confirmation, notifications).
Migrated primary keys from default UUIDs to UUIDv7 for time-sortable, index-friendly identifiers.
Breaking change — overhauled CI/CD pipeline with semantic release, GoReleaser, and conventional commit linting.
| Version | Highlights |
|---|---|
| v2.2.1 | Merged SQL migration fixes, CI ref fixes |
| v2.2.0 | Onboarding module, Docker artifact CI, SSO + RBAC merge into main |
| v2.1.0 | Nginx port mapping via environment variable |
| v2.0.0 | SSO (Google OAuth), RBAC, logger, contact form handler |
| v1.x | Initial auth system, base API structure, early features |
This project uses Conventional Commits. Commit messages are linted via CI.
feat: add new endpoint → minor version bump
fix: correct token validation → patch version bump
feat!: redesign auth flow → major version bump