Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

User Management API

A production-style REST API built with Go, Fiber, PostgreSQL, SQLC, Uber Zap, and Validator for managing users and dynamically calculating age from date of birth.

The application follows a clean layered architecture:

Request
→ Route
→ Handler
→ Service
→ Repository
→ SQLC
→ PostgreSQL

Features

Feature Status
Create User ✅
Get User by ID ✅
Update User ✅
Delete User ✅
List Users ✅
Dynamic Age Calculation ✅
PostgreSQL Integration ✅
SQLC Generated Queries ✅
Request Validation ✅
Structured Logging (Zap) ✅
Request ID Middleware ✅
Request Duration Logging ✅
Pagination ✅
Graceful Shutdown ✅
Docker Support ✅
Unit Tests ✅

Tech Stack

  • Go
  • Fiber
  • PostgreSQL
  • SQLC
  • Uber Zap
  • go-playground/validator
  • Docker
  • Docker Compose

API Endpoints

Method Endpoint Description
POST /users Create a user
GET /users/:id Get a user by ID
PUT /users/:id Update a user
DELETE /users/:id Delete a user
GET /users List users with pagination

Sample Response

{
  "id": 1,
  "name": "Alice Johnson",
  "dob": "1998-04-23",
  "age": 28
}

Age is calculated dynamically from the stored date of birth and is never persisted in the database.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages