Skip to content

πŸš€ Process of building a Company Management System with Express.js.

License

Notifications You must be signed in to change notification settings

mscbuild/CHMS_expressJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Company Management System.

A simple Company Management System built with Express.js and MongoDB. This system allows for basic functionalities like user authentication, employee management, and more. It provides an API for managing employees and authenticating users.

Project Structure

company-management-system/
β”‚
β”œβ”€β”€ config/
β”‚   └── db.js            # MongoDB connection configuration
β”œβ”€β”€ controllers/          # API logic for different routes
β”‚   └── employeeController.js
β”œβ”€β”€ models/               # Mongoose models for database
β”‚   └── Employee.js
β”‚   └── User.js           # User model for authentication
β”œβ”€β”€ routes/               # Route definitions
β”‚   └── employeeRoutes.js
β”‚   └── authRoutes.js     # Authentication routes (login/signup)
β”œβ”€β”€ .env                  # Environment variables
β”œβ”€β”€ server.js             # Main Express server file
└── package.json

Features

  • User Authentication: Register and log in using JWT authentication.
  • Employee Management: Create, read, update, and delete employee records.
  • Task Management: (Optional, can be added later)
  • Department Management: Organize employees by departments.
  • Leave & Attendance: (Optional, can be added later)
  • Payroll Management: (Optional, can be added later)

    Tech Stack.

  • Backend: Node.js with Express.j s
  • Database: MongoDB
  • Authentication: JSON Web Tokens (JWT)
  • Password Hashing: Bcrypt.js
  • Environment Variables: dotenv
  • Development Tools: Nodemon for automatic server reload

    Prerequisites.

    Installation.

    1. Clone the repository:
    git clone https://github.com/mscbuild/CHMS_expressJS.git cd CHMS_expressJS
    1. Install dependencies:

    Run the following command to install the necessary dependencies:

    npm install
    1. Set up environment variables:

    Create a .env file in the root directory and define the following environment variables:

    MONGO_URI=mongodb://localhost:27017/companyDB
    JWT_SECRET=your_jwt_secret_key
    PORT=5000

    MONGO_URI: Your MongoDB connection string. If you're using MongoDB Atlas, use the connection string provided by Atlas.

    JWT_SECRET: A secret key for JWT encoding.

    PORT: The port the application will run on (default is 5000).

    Running the Application

    To start the development server, use:

    npx nodemon server.js

    The server will run at http://localhost:5000 by default.

    API Endpoints.

    Authentication Routes.

  • POST /api/auth/register: Register a new user.
  • Request body: ```ruby { "username": "user1", "password": "password123" } ```
  • POST /api/auth/login: Login with existing credentials.
  • Request body: ```ruby { "username": "user1", "password": "password123" } ``` # Employee Management Routes.
  • POST /api/employees: Create a new employee.
  • Request body:
    {
      "name": "John Doe",
      "role": "Software Engineer",
      "department": "Engineering",
      "contact": "[email protected]",
      "salary": 70000
    }
  • GET /api/employees: Get all employees.

    Development

  • If you'd like to contribute or develop new features, follow these steps:
  • About

    πŸš€ Process of building a Company Management System with Express.js.

    Topics

    Resources

    License

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published