diff --git a/.env.dev b/.env.dev
index 9726515..75cd6c1 100644
--- a/.env.dev
+++ b/.env.dev
@@ -1,3 +1,5 @@
 S3_BUCKET=YOURS3BUCKET
 SECRET_KEY=YOURSECRETKEYGOESHERE
-PORT=3001
\ No newline at end of file
+PORT=3001
+DBNAME=test
+MONGOURL=mongodb://localhost:27017/test
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..608d3c6
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,15 @@
+{
+    // Use IntelliSense to learn about possible attributes.
+    // Hover to view descriptions of existing attributes.
+    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "name": "Launch Package",
+            "type": "go",
+            "request": "launch",
+            "mode": "auto",
+            "program": "${fileDirname}"
+        }
+    ]
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..d2b0065
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,22 @@
+{
+    "go.delveConfig": {
+        "GOPATH": "C:\\Users\\vinod_khetade\\Documents\\Go-work",
+        "GOMODCACHE": "C:\\Users\\vinod_khetade\\Documents\\Go-work\\pkg\\mod"
+    },
+    "go.gopath": "C:\\Users\\vinod_khetade\\Documents\\Go-work",
+    "gopls": {
+        "build.env": {
+            "GOPATH": "C:\\Users\\vinod_khetade\\Documents\\Go-work",
+            "GOMODCACHE": "C:\\Users\\vinod_khetade\\Documents\\Go-work\\pkg\\mod"
+        },
+        "dev.env": {
+            "GOPATH": "C:\\Users\\vinod_khetade\\Documents\\Go-work",
+            "GOMODCACHE": "C:\\Users\\vinod_khetade\\Documents\\Go-work\\pkg\\mod"
+        }
+    },
+    "go.terminal.activateEnvironment": false,
+    "go.toolsEnvVars": {
+        "GOPATH": "C:\\Users\\vinod_khetade\\Documents\\Go-work",
+        "GOMODCACHE": "C:\\Users\\vinod_khetade\\Documents\\Go-work\\pkg\\mod"
+    },
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index d466faa..48e1978 100644
--- a/README.md
+++ b/README.md
@@ -25,9 +25,13 @@ swag init
 
 You can run your Gin web application by executing the main.go file:
 
+
+
 go run main.go
 
 ````
+# postman collection import 
+from go-mongo-server/postman_collection
 # to call api endpoint in postman
 
 ```
diff --git a/configs/mongoconnection.go b/configs/mongoconnection.go
new file mode 100644
index 0000000..61ee9ea
--- /dev/null
+++ b/configs/mongoconnection.go
@@ -0,0 +1,44 @@
+package configs
+
+import (
+	"context"
+	"fmt"
+	"log"
+	"time"
+
+	"go.mongodb.org/mongo-driver/mongo"
+	"go.mongodb.org/mongo-driver/mongo/options"
+)
+
+func ConnectDB() *mongo.Client {
+	client, err := mongo.NewClient(options.Client().ApplyURI(EnvMongoURI()))
+	if err != nil {
+		log.Fatal(err)
+	}
+
+	ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
+	err = client.Connect(ctx)
+	if err != nil {
+		log.Fatal(err)
+	}
+
+	//ping the database
+	err = client.Ping(ctx, nil)
+	if err != nil {
+		log.Fatal(err)
+	}
+
+	fmt.Println("Connected to MongoDB 1")
+
+	return client
+}
+
+// Client instance
+var DB *mongo.Client = ConnectDB()
+
+// getting database collections
+func GetCollection(client *mongo.Client, collectionName string) *mongo.Collection {
+	collection := client.Database("golangAPI").Collection(collectionName)
+
+	return collection
+}
diff --git a/configs/mongoenv.go b/configs/mongoenv.go
new file mode 100644
index 0000000..0371cdf
--- /dev/null
+++ b/configs/mongoenv.go
@@ -0,0 +1,16 @@
+package configs
+
+import (
+	"log"
+	"os"
+
+	"github.com/joho/godotenv"
+)
+
+func EnvMongoURI() string {
+	err := godotenv.Load(".env.dev")
+	if err != nil {
+		log.Fatal("Error loading .env file")
+	}
+	return os.Getenv("MONGOURL")
+}
diff --git a/controllers/users.go b/controllers/users.go
new file mode 100644
index 0000000..3ab647f
--- /dev/null
+++ b/controllers/users.go
@@ -0,0 +1,169 @@
+package markscontrollers
+
+import (
+	"context"
+	"net/http"
+	"time"
+
+	"github.com/gin-gonic/gin"
+	"github.com/vinodnextcoder/golang-mongo-server/configs"
+	"github.com/vinodnextcoder/golang-mongo-server/models"
+	"github.com/vinodnextcoder/golang-mongo-server/responses"
+	"go.mongodb.org/mongo-driver/bson"
+	"go.mongodb.org/mongo-driver/bson/primitive"
+	"go.mongodb.org/mongo-driver/mongo"
+)
+
+var userCollection *mongo.Collection = configs.GetCollection(configs.DB, "users")
+
+func CreateUser() gin.HandlerFunc {
+	return func(c *gin.Context) {
+		ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+		var user models.User
+		defer cancel()
+
+		//validate the request body
+		if err := c.BindJSON(&user); err != nil {
+			c.JSON(http.StatusBadRequest, responses.UserResponse{Status: http.StatusBadRequest, Message: "error", Data: map[string]interface{}{"data": err.Error()}})
+			return
+		}
+
+		//use the validator library to validate required fields
+		// if validationErr := validate.Struct(&user); validationErr != nil {
+		// 	c.JSON(http.StatusBadRequest, responses.UserResponse{Status: http.StatusBadRequest, Message: "error", Data: map[string]interface{}{"data": validationErr.Error()}})
+		// 	return
+		// }
+
+		newUser := models.User{
+			Id:       primitive.NewObjectID(),
+			Name:     user.Name,
+			Location: user.Location,
+			Title:    user.Title,
+		}
+
+		result, err := userCollection.InsertOne(ctx, newUser)
+		if err != nil {
+			c.JSON(http.StatusInternalServerError, responses.UserResponse{Status: http.StatusInternalServerError, Message: "error", Data: map[string]interface{}{"data": err.Error()}})
+			return
+		}
+
+		c.JSON(http.StatusCreated, responses.UserResponse{Status: http.StatusCreated, Message: "success", Data: map[string]interface{}{"data": result}})
+	}
+}
+
+func GetAUser() gin.HandlerFunc {
+	return func(c *gin.Context) {
+		ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+		userId := c.Param("userId")
+		var user models.User
+		defer cancel()
+
+		objId, _ := primitive.ObjectIDFromHex(userId)
+
+		err := userCollection.FindOne(ctx, bson.M{"id": objId}).Decode(&user)
+
+		if err != nil {
+			c.JSON(http.StatusInternalServerError, responses.UserResponse{Status: http.StatusInternalServerError, Message: "error", Data: map[string]interface{}{"data": err.Error()}})
+			return
+		}
+
+		c.JSON(http.StatusOK, responses.UserResponse{Status: http.StatusOK, Message: "success", Data: map[string]interface{}{"data": user}})
+	}
+}
+
+func EditAUser() gin.HandlerFunc {
+	return func(c *gin.Context) {
+		ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+		userId := c.Param("userId")
+		var user models.User
+		defer cancel()
+
+		objId, _ := primitive.ObjectIDFromHex(userId)
+
+		//validate the request body
+		if err := c.BindJSON(&user); err != nil {
+			c.JSON(http.StatusBadRequest, responses.UserResponse{Status: http.StatusBadRequest, Message: "error", Data: map[string]interface{}{"data": err.Error()}})
+			return
+		}
+
+		update := bson.M{"name": user.Name, "location": user.Location, "title": user.Title}
+
+		result, err := userCollection.UpdateOne(ctx, bson.M{"id": objId}, bson.M{"$set": update})
+
+		if err != nil {
+			c.JSON(http.StatusInternalServerError, responses.UserResponse{Status: http.StatusInternalServerError, Message: "error", Data: map[string]interface{}{"data": err.Error()}})
+			return
+		}
+
+		//get updated user details
+		var updatedUser models.User
+		if result.MatchedCount == 1 {
+			err := userCollection.FindOne(ctx, bson.M{"id": objId}).Decode(&updatedUser)
+
+			if err != nil {
+				c.JSON(http.StatusInternalServerError, responses.UserResponse{Status: http.StatusInternalServerError, Message: "error", Data: map[string]interface{}{"data": err.Error()}})
+				return
+			}
+		}
+
+		c.JSON(http.StatusOK, responses.UserResponse{Status: http.StatusOK, Message: "success", Data: map[string]interface{}{"data": updatedUser}})
+	}
+}
+
+func DeleteAUser() gin.HandlerFunc {
+	return func(c *gin.Context) {
+		ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+		userId := c.Param("userId")
+		defer cancel()
+
+		objId, _ := primitive.ObjectIDFromHex(userId)
+
+		result, err := userCollection.DeleteOne(ctx, bson.M{"id": objId})
+
+		if err != nil {
+			c.JSON(http.StatusInternalServerError, responses.UserResponse{Status: http.StatusInternalServerError, Message: "error", Data: map[string]interface{}{"data": err.Error()}})
+			return
+		}
+
+		if result.DeletedCount < 1 {
+			c.JSON(http.StatusNotFound,
+				responses.UserResponse{Status: http.StatusNotFound, Message: "error", Data: map[string]interface{}{"data": "User with specified ID not found!"}},
+			)
+			return
+		}
+
+		c.JSON(http.StatusOK,
+			responses.UserResponse{Status: http.StatusOK, Message: "success", Data: map[string]interface{}{"data": "User successfully deleted!"}},
+		)
+	}
+}
+
+func GetAllUsers() gin.HandlerFunc {
+	return func(c *gin.Context) {
+		ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+		var users []models.User
+		defer cancel()
+
+		results, err := userCollection.Find(ctx, bson.M{})
+
+		if err != nil {
+			c.JSON(http.StatusInternalServerError, responses.UserResponse{Status: http.StatusInternalServerError, Message: "error", Data: map[string]interface{}{"data": err.Error()}})
+			return
+		}
+
+		//reading from the db in an optimal way
+		defer results.Close(ctx)
+		for results.Next(ctx) {
+			var singleUser models.User
+			if err = results.Decode(&singleUser); err != nil {
+				c.JSON(http.StatusInternalServerError, responses.UserResponse{Status: http.StatusInternalServerError, Message: "error", Data: map[string]interface{}{"data": err.Error()}})
+			}
+
+			users = append(users, singleUser)
+		}
+
+		c.JSON(http.StatusOK,
+			responses.UserResponse{Status: http.StatusOK, Message: "success", Data: map[string]interface{}{"data": users}},
+		)
+	}
+}
diff --git a/main.go b/main.go
index c9f7f90..09e7cc1 100644
--- a/main.go
+++ b/main.go
@@ -1,22 +1,16 @@
 package main
 
 import (
-	"fmt"
 	"log"
 	"net/http"
 	"os"
-	"context"
-    "time"
- 
-    "go.mongodb.org/mongo-driver/mongo"
-    "go.mongodb.org/mongo-driver/mongo/options"
-    "go.mongodb.org/mongo-driver/mongo/readpref"
 
-    "github.com/joho/godotenv"
 	"github.com/gin-gonic/gin"
+	"github.com/joho/godotenv"
 	swaggerFiles "github.com/swaggo/files"
 	ginSwagger "github.com/swaggo/gin-swagger"
 	_ "github.com/vinodnextcoder/golang-mongo-server/docs"
+	"github.com/vinodnextcoder/golang-mongo-server/routes"
 )
 
 // @title           Swagger Example API
@@ -35,39 +29,25 @@ import (
 func main() {
 
 	err := godotenv.Load(".env.dev")
-	
-  if err != nil {
-    log.Fatal("Error loading .env file")
-  }
 
-  // Get Client, Context, CancelFunc and 
-    // err from connect method.
-    client, ctx, cancel, err := connect("mongodb://localhost:27017/test")
-    if err != nil {
-        panic(err)
-    }
-     
-    // Release resource when the main
-    // function is returned.
-    defer close(client, ctx, cancel)
-	
-     
-    // Ping mongoDB with Ping method
-    ping(client, ctx)
+	if err != nil {
+		log.Fatal("Error loading .env file")
+	}
+	//run database
+	// configs.ConnectDB()
 
-  port := os.Getenv("PORT")
+	port := os.Getenv("PORT")
 
 	router := gin.Default()
 
 	router.GET("/", helloCall)
-	router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
+	routes.UserRoute(router)
 
+	router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
 
-	router.Run("0.0.0.0:"+port)
+	router.Run("0.0.0.0:" + port)
 }
 
-
-
 // helloCall godoc
 // @Summary hellow example
 // @Schemes
@@ -80,58 +60,3 @@ func main() {
 func helloCall(c *gin.Context) {
 	c.JSON(http.StatusOK, gin.H{"message": "Hello, You created a Web App!"})
 }
-// This is a user defined method to close resources.
-// This method closes mongoDB connection and cancel context.
-func close(client *mongo.Client, ctx context.Context,
-	cancel context.CancelFunc){
-	 
-// CancelFunc to cancel to context
-defer cancel()
-
-// client provides a method to close 
-// a mongoDB connection.
-defer func(){
-
- // client.Disconnect method also has deadline.
- // returns error if any,
- if err := client.Disconnect(ctx); err != nil{
-	 panic(err)
- }
-}()
-}
-
-// This is a user defined method that returns mongo.Client, 
-// context.Context, context.CancelFunc and error.
-// mongo.Client will be used for further database operation.
-// context.Context will be used set deadlines for process.
-// context.CancelFunc will be used to cancel context and 
-// resource associated with it.
-
-func connect(uri string)(*mongo.Client, context.Context, 
-				   context.CancelFunc, error) {
-					
-// ctx will be used to set deadline for process, here 
-// deadline will of 30 seconds.
-ctx, cancel := context.WithTimeout(context.Background(), 
-								30 * time.Second)
-
-// mongo.Connect return mongo.Client method
-client, err := mongo.Connect(ctx, options.Client().ApplyURI(uri))
-return client, ctx, cancel, err
-}
-
-// This is a user defined method that accepts 
-// mongo.Client and context.Context
-// This method used to ping the mongoDB, return error if any.
-func ping(client *mongo.Client, ctx context.Context) error{
-
-// mongo.Client has Ping to ping mongoDB, deadline of 
-// the Ping method will be determined by cxt
-// Ping method return error if any occurred, then
-// the error can be handled.
-if err := client.Ping(ctx, readpref.Primary()); err != nil {
- return err
-}
-fmt.Println("connected successfully")
-return nil
-}
diff --git a/models/user_model.go b/models/user_model.go
new file mode 100644
index 0000000..8288b36
--- /dev/null
+++ b/models/user_model.go
@@ -0,0 +1,10 @@
+package models
+
+import "go.mongodb.org/mongo-driver/bson/primitive"
+
+type User struct {
+	Id       primitive.ObjectID `json:"id,omitempty"`
+	Name     string             `json:"name,omitempty" validate:"required"`
+	Location string             `json:"location,omitempty" validate:"required"`
+	Title    string             `json:"title,omitempty" validate:"required"`
+}
diff --git a/postman_collection/gin.postman_collection.json b/postman_collection/gin.postman_collection.json
new file mode 100644
index 0000000..b7fd4fc
--- /dev/null
+++ b/postman_collection/gin.postman_collection.json
@@ -0,0 +1,159 @@
+{
+	"info": {
+		"_postman_id": "fa2b0741-c606-46a2-a4fa-6943d969fc94",
+		"name": "gin",
+		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
+		"_exporter_id": "30399582"
+	},
+	"item": [
+		{
+			"name": "create",
+			"request": {
+				"method": "POST",
+				"header": [],
+				"body": {
+					"mode": "raw",
+					"raw": "{\r\n    \"Name\": \"vinod\",\r\n    \"Location\": \"ddd\",\r\n    \"Title\": \"vinod\"\r\n}",
+					"options": {
+						"raw": {
+							"language": "json"
+						}
+					}
+				},
+				"url": {
+					"raw": "http://localhost:3001/user",
+					"protocol": "http",
+					"host": [
+						"localhost"
+					],
+					"port": "3001",
+					"path": [
+						"user"
+					]
+				}
+			},
+			"response": []
+		},
+		{
+			"name": "update",
+			"request": {
+				"method": "PUT",
+				"header": [],
+				"body": {
+					"mode": "raw",
+					"raw": "{\r\n    \"Name\": \"vinod test\",\r\n    \"Location\": \"ddd test\",\r\n    \"Title\": \"vinod\"\r\n}",
+					"options": {
+						"raw": {
+							"language": "json"
+						}
+					}
+				},
+				"url": {
+					"raw": "http://localhost:3001/user/65af7714d994f3f0953c5cb5",
+					"protocol": "http",
+					"host": [
+						"localhost"
+					],
+					"port": "3001",
+					"path": [
+						"user",
+						"65af7714d994f3f0953c5cb5"
+					]
+				}
+			},
+			"response": []
+		},
+		{
+			"name": "get user",
+			"protocolProfileBehavior": {
+				"disableBodyPruning": true
+			},
+			"request": {
+				"method": "GET",
+				"header": [],
+				"body": {
+					"mode": "raw",
+					"raw": "{\r\n     \"rollNo\": 175,\r\n        \"maths\":80,\r\n        \"science\": 90,\r\n        \"computer\":95\r\n}",
+					"options": {
+						"raw": {
+							"language": "json"
+						}
+					}
+				},
+				"url": {
+					"raw": "http://localhost:3001/user/65af7714d994f3f0953c5cb5",
+					"protocol": "http",
+					"host": [
+						"localhost"
+					],
+					"port": "3001",
+					"path": [
+						"user",
+						"65af7714d994f3f0953c5cb5"
+					]
+				}
+			},
+			"response": []
+		},
+		{
+			"name": "delete",
+			"request": {
+				"method": "DELETE",
+				"header": [],
+				"body": {
+					"mode": "raw",
+					"raw": "{\r\n     \"rollNo\": 175,\r\n        \"maths\":80,\r\n        \"science\": 90,\r\n        \"computer\":95\r\n}",
+					"options": {
+						"raw": {
+							"language": "json"
+						}
+					}
+				},
+				"url": {
+					"raw": "http://localhost:3001/user/65af7714d994f3f0953c5cb5",
+					"protocol": "http",
+					"host": [
+						"localhost"
+					],
+					"port": "3001",
+					"path": [
+						"user",
+						"65af7714d994f3f0953c5cb5"
+					]
+				}
+			},
+			"response": []
+		},
+		{
+			"name": "get user list",
+			"protocolProfileBehavior": {
+				"disableBodyPruning": true
+			},
+			"request": {
+				"method": "GET",
+				"header": [],
+				"body": {
+					"mode": "raw",
+					"raw": "{\r\n     \"rollNo\": 175,\r\n        \"maths\":80,\r\n        \"science\": 90,\r\n        \"computer\":95\r\n}",
+					"options": {
+						"raw": {
+							"language": "json"
+						}
+					}
+				},
+				"url": {
+					"raw": "http://localhost:3001/users",
+					"protocol": "http",
+					"host": [
+						"localhost"
+					],
+					"port": "3001",
+					"path": [
+						"users"
+					]
+				}
+			},
+			"response": []
+		}
+	]
+}
\ No newline at end of file
diff --git a/responses/user_response.go b/responses/user_response.go
new file mode 100644
index 0000000..cdc7698
--- /dev/null
+++ b/responses/user_response.go
@@ -0,0 +1,7 @@
+package responses
+
+type UserResponse struct {
+	Status  int                    `json:"status"`
+	Message string                 `json:"message"`
+	Data    map[string]interface{} `json:"data"`
+}
diff --git a/routes/routes.go b/routes/routes.go
new file mode 100644
index 0000000..98ff2d4
--- /dev/null
+++ b/routes/routes.go
@@ -0,0 +1,14 @@
+package routes
+
+import (
+	"github.com/gin-gonic/gin"
+	markscontrollers "github.com/vinodnextcoder/golang-mongo-server/controllers"
+)
+
+func UserRoute(router *gin.Engine) {
+	router.POST("/user", markscontrollers.CreateUser())
+	router.GET("/user/:userId", markscontrollers.GetAUser())
+	router.PUT("/user/:userId", markscontrollers.EditAUser())
+	router.DELETE("/user/:userId", markscontrollers.DeleteAUser())
+	router.GET("/users", markscontrollers.GetAllUsers())
+}
