Skip to content

User Management API - a robust backend system to manage user data in the automotive industry. To build a simple RESTful API for user registration, authentication, and vehicle preferences.

Notifications You must be signed in to change notification settings

chandravamshi/User-Management-API

Repository files navigation

User Management API Backend

Backend API with authentication and authorization doing crud operations. Used state of art libs for clean and efficient code.

I used Node.js, TypeScript, Express, RoutingControllers, ClassValidators

Postman

  • I used postman for making request so i saved all my request and aded here in this project as cloud it is post man collection json file.

what i did (everthing with screenshot explained in this readmefile)

  • User Registration and Authentication
  • Vehicle Preferences
  • Logging
  • Documentation(i showed you basic example using apidoc lib)

Setup

  • clone the repo
$ npm i
$ npm start

npm start will start the server on port 3000 which is .env file. You can change portnumber according to your wish.

  • For generating api doc
 npm install -g apidoc
apidoc -i src/ -o apidoc/

Folder Structure

user-management-api/
|-- build/
|-- src/
|   |-- controllers/
|   |   |-- userController.ts // for creating, deleting updating, reading users (endpoints)

|   |-- database/ // I am using json file as db for storing details about user(array of users) and vechiles
|   |   |-- users.json
|   |   |-- vehicle.json

|   |-- dto/ //types
|   |   |-- user.dto.ts // type of user

|   |-- interfaces/ 
|   |   |-- responseInterfaces.ts // interface of responses

|   |-- middelware/
|   |   |-- authMiddleware.ts // authentication middleware for accessing resources
|   |   |-- validationErrors.ts //if we make error request then structured understandable error response is sent

|   |-- services/ //for accessing database
|   |   |-- userService.ts  // for CRUD on users database (users.json)

|   |-- index.ts/ // main file

|-- .env/ // basic project settings

|-- package.json
|-- README.md
|-- tsconfig.json

API DOC example (used apidoc lib)

  • A sample image of API Doc apidoc sampel image

User

creating user

  • Befor creating new user(users.json) befor creating user (users.json)

  • postman request for creating new user postman request creating user (users.json)

  • logger i used morgan lib for this logger while creating user (users.json)

  • after creating new user(users.json) after creating user (users.json)

User Vechile preferences - only authenticated user can insert the vechile preferences

create vechile preference

  • Add new vechile preference add vechile preference (vechilepreference.json) add vechile preference (vechilepreference.json)

update vechile preference

update vechile preference (vechilepreference.json) update vechile preference (vechilepreference.json)

delete vechile preference

delete vechile preference (vechilepreference.json)

About

User Management API - a robust backend system to manage user data in the automotive industry. To build a simple RESTful API for user registration, authentication, and vehicle preferences.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published