Skip to content

johnayinde/user-management-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User Management System API

A RESTful API for managing users, addresses, and posts built with Node.js, TypeScript, Express, and SQLite with Sequelize ORM.

Live Demo

Access the deployed API at https://user-mgt-sys-el0o.onrender.com

Postman Collection

Run in Postman

Features

  • RESTful API endpoints for users, addresses, and posts
  • TypeScript for type safety and better developer experience
  • Sequelize ORM for database interactions
  • SQLite database for development and testing
  • Winston logger for logging
  • Robust error handling and validation
  • Comprehensive test suite

Tech Stack

  • Node.js
  • TypeScript
  • Express.js
  • SQLite
  • Sequelize ORM
  • Winston Logger
  • Express Validator

API Endpoints

User Endpoints

  • GET /users - Returns a paginated list of users
  • GET /users/count - Returns the total number of users
  • GET /users/{id} - Returns details of a specific user, including their address
  • POST /users - Creates a new user

Address Endpoints

  • GET /addresses?userId={userId} - Returns the address associated with a user
  • POST /addresses - Creates an address for a user
  • PATCH /addresses/{userID} - Modifies the address associated with a user

Post Endpoints

  • GET /posts?userId={userId} - Returns all posts for a specific user
  • POST /posts - Creates a new post for a user
  • DELETE /posts/{id} - Deletes a post by its ID

Installation and Setup

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn

Installation Steps

  1. Clone the repository:

    git clone https://github.com/johnayinde/user-management-system.git
    cd user-management-system
  2. Install dependencies:

    yarn install
  3. Create a .env file in the root directory:

    NODE_ENV=development
    PORT=3000
    
  4. Start the development server:

    npm run dev
    # or
    yarn dev

Building for Production

npm run build
# or
yarn build

Running in Production

npm start
# or
yarn start

Running Tests

Run all tests:

npm test
# or
yarn test

Run specific test suites:

npm run test:user
npm run test:address
npm run test:post
# or
yarn test:user
yarn test:address
yarn test:post

Generate test coverage:

npm run test:coverage
# or
yarn test:coverage

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published