Skip to content

niku-raaz/UserManagementSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

User Management System with PostgreSQL, Redis, Kafka, and Prometheus

This Go-based web application provides a user management system with the following features:

  • CRUD operations for users
  • Caching with Redis
  • Event streaming and reading with Kafka
  • Monitoring with Prometheus

Features

Technologies Used:

  • Go (Golang)
  • PostgreSQL for database
  • Redis for caching
  • Kafka for streaming events
  • Prometheus for monitoring
  • Gorilla Mux for routing

API Endpoints

Endpoint Method Description
/users POST Create a new user
/users/:id GET Get a user by ID
/users/:id PUT Update user by ID
/users/:id DELETE Delete user by ID
/users/{id}/status PUT Mark a user as inactive
/users GET Fetch all users
/metrics GET Prometheus metrics
/metric GET Show hit counters (custom)

Getting Started

Prerequisites

  • Go installed
  • PostgreSQL server running
  • Redis server running
  • Kafka broker running

Setup

  1. Clone the repository

    git clone https://github.com/niku-raaz/UserManagementSystem
    cd UserManagement
  2. Update PostgreSQL connection string In producer.go, update the following line with your credentials:

    conStr := "postgres://YOURUSERNAME:YOURPASSWORD@localhost:5432/USERDB?sslmode=disable"
  3. Run Kafka locally Make sure Kafka is running at localhost:9092.

  4. Run Redis Ensure Redis is running at localhost:6379.

  5. Run the application

    go run producer.go

Kafka Usage

The app produces user creation events to Kafka under the topic user-events.

Redis Usage

  • Users are cached in Redis after retrieval from the database.
  • On update/delete, the corresponding Redis entry is invalidated.

Prometheus Monitoring

  • The app exposes metrics at /metrics

  • Tracks:

    • Number of API hits (api_hits_total)
    • Latency of each API call (api_latency_seconds)
    • Number of server errors (api_errors_total)

Author

  • Built by Niku Raj as part of a full-stack distributed systems project.

About

A complete scalable backend for User Management having CRUD operation, written in GO

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages